This experiment was originally built on Google Cloud's Kubernetes and makes use of gcePersistentDisk. If you are not using Google Cloud, you'll need to adjust the gcePersistentDisk volumes to use the persistent disk technology available in your cluster.
At a high level the steps look something like this, though there may be subtle errors. This experiment happened a few weeks ago and I'm creating these from memory along with the test descriptors I used.
- Setup Kubernetes and create the necessary persistent disks that are referenced in the deployment.
- Create the necessary secrets. [
01-secrets.yml
] - Create the Cog pod. [
02-deployment.yml
] - Add a load balancer service to allow Cog to be reachable [
03-loadbalancer.yml
] - Boostrap Cog, setup an admin user, and configure the relay group and relay.
- slack-token - Slack API token for your Cog instance to use.
- postgres-passwrd - Password that will be used by the
cog
admin user that is created in your Postgres container. - database-url - The database URL that Cog uses to talk to the Postgres container. You should only have to replace pgpassword with the value of the postgres-password key that tyou defineda bove.
Most of the variables are self-explanatory, but a few deserve special attention.
- COG_*_URL_HOST - The
COG_API_URL_HOST
,COG_SERVICE_URL_HOST
, andCOG_TRIGGER_URL_HOST
should be configured to point to a hostname or IP address where the ports exposed by the Cog container in the pod are reachable.
RELAY_ID
- Useuuidgen
or another method to create a UUID for the Relay. Currently, these should all be lowercase.RELAY_COG_TOKEN
- Choose a password for the Relay to use when connecting to Cog.
Once the pod is running, you have to perform normal Cog bootstrap. In testing, I used kubectl exec
to run a shell in the
cog
container where cogctl
is available. At a minimum you'll need to do something like this to bootstrap Cog, create
a new admin user, and create a new relay group and relay for the relay running in the pod.
Note, these are untested and off the top of my head, but they should be pretty close.
# Export variables to be used in steps below
export RELAY_ID=<< RELAY_ID from deployment descriptor >>
export RELAY_COG_TOKEN=<< RELAY_COG_TOKEN from deployment descriptor >>
export ADMIN_FIRST_NAME=Eliza
export ADMIN_LAST_NAME=Example
export [email protected]
export ADMIN_PASSWORD=secretshhh
export ADMIN_SLACK_HANDLE=elizaslack
# Bootstrap Cog
cogctl bootstrap
cat ~/.cogctl # and record these credentials
# Create a new admin user
cogctl users create --first-name ${ADMIN_FIRST_NAME} --last-name ${ADMIN_LAST_NAME} --email ${ADMIN_EMAIL} --username ${ADMIN_EMAIL} --password ${ADMIN_PASSWORD}
cogctl groups add cog-admin --email ${ADMIN_EMAIL}
# Create a relay and relay group named "local"
cogctl relay-groups create local
cogctl relays create local --id ${RELAY_ID} --token ${RELAY_COG_TOKEN} --groups local --enable
Here's an alternative which separates the cog pod from the relay pod (so they may run across a cluster)
https://gist.github.com/so0k/f4308160a9a2e749aa0b90715288e08b
It also sets up Postgres external to the cluster (with persistence and backups managed separately)