How to configure GCS storage¶
Google Cloud Storage can be configured for Charmed MongoDB replica sets and sharded clusters with the gcs-integrator charm.
Prerequisites¶
A GCP Service account with the minimum roles needed:
Read/write/List/delete objects (recommended minimum): roles/storage.objectAdmin
Manage buckets (if the bucket does not already exists): roles/storage.admin
A replica set with at least three nodes or a shared cluster with a least one shard.
Configure gcs-integrator¶
Deploy gcs-integrator
juju deploy gcs-integrator --channel 1/edge
Create a JSON file for your service account and download it to you local file system.
Add a new secret containing the GCP service account key you just obtained to Juju, and grant its permissions to gcs-integrator:
juju add-secret mysecret secret-key#file=service_account.json
juju grant-secret mysecret gcs-integrator
The first command will return an ID like secret:d0erdgfmp25c762i8np0.
Then, configure the gcs-integrator with the newly created secret:
juju config gcs-integrator credentials=secret:d0erdgfmp25c762i7np0
To configure gcs-integrator, run juju config with the relevant parameters to your GCS storage.
Example:
juju config gcs-integrator bucket=<your-bucket> path="my/path"
Pass GCS configuration to MongoDB¶
First, determine the name of the application to pass to Juju when running back up and restore actions:
For a replica-set deployment, it is the name of your Charmed MongoDB application
For a sharded cluster deployment, it is the name of the Charmed MongoDB config-server application. Never the shard applications!
To integrate your deployment with gcs-integrator, run:
juju integrate gcs-integrator <replica-set-name | config-server-name>
Your GCS storage is now set up!