---
title: Charmhub | Deploy Content Cache using Charmhub - The Open Operator Collection
description: Deploy the latest version of Content Cache on any cloud.
url: https://charmhub.io/content-cache/docs/tutorial
---

# Content Cache

[Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")

* [Canonical IS DevOps](https://charmhub.io/publisher/canonical-is-devops "View all packages from Canonical IS DevOps")
* [Monitoring](https://charmhub.io/?filter=monitoring)
* [Networking](https://charmhub.io/?filter=networking)

Platform:

24.04

22.04

20.04

18.04

stable 4b9222c

```
juju deploy content-cache
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

---

#### Contacts

##### Maintainers

+ [Content Cache Charmers](mailto:content-cache-charmers@lists.launchpad.net)

* [Submit a bug](https://bugs.launchpad.net/content-cache-charm)

---

Share your thoughts on this charm with the community on discourse.

[Join the discussion](https://discourse.charmhub.io/)

# Deploy content-cache

The content-cache charm makes deploying and managing a static web content cache with nginx easy with the help of [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators).

## [What you’ll do](https://charmhub.io/content-cache/docs/tutorial#p-40760-what-youll-do)

* Deploy the Content Cache charm.
* Deploy the Content Cache Backends Config charm.
* Integrate the two charms.

## [Requirements](https://charmhub.io/content-cache/docs/tutorial#p-40760-requirements)

* A workstation, e.g. a laptop, with amd64 architecture.
* Juju 3 installed and bootstrapped to a LXD controller. You can accomplish this process by
  using a Multipass VM as outlined in this guide:
  [Set up / Tear down your test environment](https://juju.is/docs/juju/set-up--tear-down-your-test-environment)

## [Steps](https://charmhub.io/content-cache/docs/tutorial#p-40760-steps)

* Pack the Content Cache charm. Run the following command at the root of the git repository.
  The version of the charm is an unreleased rewrite of the charm.
  In the future, it will be available on charmhub.

```
charmcraft pack
```

* Deploy the Content Cache charm.

```
juju deploy ./content-cache_amd64.charm cache
```

* Deploy the Content Cache Backends Config charm, and configure the application.

```
juju deploy content-cache-backends-config --channel=latest/edge --revision=5 backends
juju config backends backends=185.125.90.20 hostname=ubuntu.com protocol=https
```

The `backends` takes a comma-separated list of IP addresses, and `protocol` can be set to `http` or `https`.
The above configuration ask the nginx to cache the content from `https://185.125.90.20`.
The configuration can be changed to point to a different server.
The Juju machine hosting the Content Cache charm needs to be able to access the server, for the charm to work.
Whether the Juju machine is able to access to server can be tested by `juju ssh` into the Juju machine and use curl to test access.

* Integrate the two charms, and wait until the charms are in active state.

```
juju integrate cache backends
juju status --watch 5s
```

* Test the Content Cache with cURL.

```
curl http://<IP of the juju machine> -H "Host: ubuntu.com"
```

Right now `https://185.125.90.20` is responding with the following content:

```
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url=https://ubuntu.com/login" />

        <title>Redirecting to https://ubuntu.com/login</title>
    </head>
    <body>
        Redirecting to <a href="https://ubuntu.com/login">https://ubuntu.com/login</a>.
    </body>
</html>%
```

## [Cleanup](https://charmhub.io/content-cache/docs/tutorial#p-40760-cleanup)

* Remove the charms.

```
juju remove-application cache backends
```

---
