COS Lite docs - How to provision an s3 bucket with microstack

If you need a s3 bucket for testing locally some charmed workload, you can quickly provision one through the microceph charm.

What you’ll need:

  • access to a Juju machine controller

Deploy microceph

First step is to deploy three microceph units.

juju switch lxd  # replace with the name of your machine model
juju add-model ceph
juju deploy microceph -n 3 –channel edge
juju deploy ceph-radosgw --channel edge

Step 2 is to add some osds.

juju run microceph/0 add-osd loop-spec="4G,1"
juju run microceph/1 add-osd loop-spec="4G,1"
juju run microceph/2 add-osd loop-spec="4G,1"

Enable rados gateway and relate ceph to it

juju config microceph enable-rgw="*"
juju integrate ceph-radosgw microceph

Provision a bucket

Once you deployed microceph and ceph-radosgw, you can create a bucket by running:

First create a new radosgw user:

juju ssh microceph/0 sudo radosgw-admin user create --uid=myuser --display-name=myuser

This command will output a chunk of json output; you need to look for this bit:

    "keys": [
        {
            "user": "myuser",
            "access_key": "6Y25SVQHTYSEV0NXCBV1",
            "secret_key": "IgQkBBDKSCeIG4D0Q0pO8ibNAcNPhnoU1YQO5mj8"
        }
    ]

note down the access key and secret key.

juju ssh microceph/0 'sudo apt update && sudo apt install -y s3cmd'
juju ssh microceph/0 's3cmd \
    --host <microceph_machine_name  > \ # name of the machine microceph is deployed to
    --host-bucket="<microceph_machine_name>/%(bucket)" \
    --access_key=<access_key> \  # access key for the bucket
    --secret_key=<secret_key> \  # secret key for the bucket
    --no-ssl mb s3://<bucket_name>'  # name of the bucket you intend to create

The s3 endpoint is now live at [ip of the radosgw unit], and the bucket should soon be ready.

Additionally, you might want to ingress microceph and deploy an s3 integrator to use the bucket in charms that support the s3 interface.

Integrate Microceph with Traefik

In the k8s model:

juju deploy traefik-k8s traefik --channel edge --trust
juju offer traefik:traefik-route

In the machine model:

> `juju consume <k8s_controller>:admin/<k8s_model>.traefik`
> `juju integrate traefik microceph`

Use the S3 Integrator to provide an s3 relation

> `juju deploy s3-integrator --channel edge --trust`
> `juju run s3-integrator/leader sync-s3-credentials access-key=<access_key> secret-key=<secret_key>`
> `juju config s3-integrator endpoint=http://<traefik_public_IP>:80 bucket=<bucket_name>`