---
title: Charmhub | Deploy Content-cache using Charmhub - The Open Operator Collection
description: Deploy the latest version of Content-cache as a Kubernetes Operator on
  any cloud.
url: https://charmhub.io/content-cache-k8s/docs/how-to-cache-content-with-openstack-swift
---

# 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")

Platform:

stable 49

```
juju deploy content-cache-k8s
```

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

---

#### Relevant links

* [Homepage](https://github.com/canonical/content-cache-k8s-operator)

---

#### Contacts

##### Maintainers

+ [Launchpad Team](https://launchpad.net/~content-cache-charmers)

* [Submit a bug](https://github.com/canonical/content-cache-k8s-operator/issues)

---

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

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

# How to cache content with OpenStack/Swift storage

Sometimes it is desirable to cache Swift storage objects inside the charm for faster processing and reducing the number of requests to the [Swift](https://docs.openstack.org/swift/latest/) server. This also allows you to have a different hostname than the one from the Swift service.

This guide will demonstrate how to deploy this charm along with OpenStack/Swift storage.

**What you’ll need**:

* OpenStack instance and credentials. If you don’t have any credentials check [here](https://docs.openstack.org/zh_CN/user-guide/common/cli-set-environment-variables-using-openstack-rc.html) for more information.
* The content-cache-k8s charm deployed as `content-cache-k8s`.

First, connect to your OpenStack instance with your credentials, sourcing an .rc file:

```
source myfile.rc
```

The OpenStack container you are going to work with has to be globally readable. check that property:

```
swift stat <container_name>
```

And if it’s not globally readable yet, change that with:

```
swift post <container_name> --read-acl ".r:*"
```

Then list all the objects on the OpenStack container in debug mode and get the URL of the Swift connection:

```
openstack object list <container_name> -vv 2>&1 | grep "^REQ: curl" | grep AUTH | cut -d'"' -f2 | cut -d'?' -f1
```

After obtaining the URL, configure the charm to use that URL as our charm’s backend:

```
juju config content-cache-k8s backend="http://<swift_conn_url>"
```

Once configured, you can use Swift commands to push or download objects. More details about Swift commands [here](https://docs.openstack.org/ocata/cli-reference/swift.html)

You can check everything is working by executing

```
curl <swift connection url>
```

And also add a relation to the nginx-ingress-integrator charm:

```
juju deploy nginx-ingress-integrator
```

If your cluster has [RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) enabled, you’ll be prompted to run the following:

```
juju trust nginx-ingress-integrator --scope cluster
```

The deployed application name will need to resolve to the IP of your ingress controller. A great way of testing this is to upload an index.html file into the OpenStack container and confirm that that content is reachable when they browse to this URL now.

---
