ohaiwalt / cog-helm

A Helm chart to deploy Cog on Kubernetes
Apache License 2.0
18 stars 4 forks source link

Add quickstart for Postgres stable chart #5

Open ohaiwalt opened 7 years ago

ohaiwalt commented 7 years ago

In the interests of getting a new user set up as quickly as possible, add a Quickstart to create a Postgres container to point Cog to.

davejlong commented 7 years ago

I looked at using Postgres from the stable repo, but it doesn't look like it'll work with GCE, which I think most people are using to get up and running quickly, since it uses a generic persistent volume claim.

ohaiwalt commented 7 years ago

@davejlong I was able to get this working in GCE. The generic setting for persistent volume claims will select whatever a default is for a given cloud provider, I believe. This isn't something you'd want to use in production, certainly, but for a quick test it's pretty neat.

helm install stable/postgresql --set postgresUser=cog,postgresDatabase=cog
PGPASSWORD=$(printf $(printf '\%o' `kubectl get secret --namespace default morbid-dolphin-postgresq -o jsonpath="{.data.postgres-password[*]}"`);echo)
helm install cog --set cog.secrets.slackAPIToken=$SLACK_API_TOKEN,cog.secrets.databaseURL=ecto://cog:$PGPASSWORD@morbid-dolphin-postgresq:5432/cog

This resulted in:

$ kubectl get pods
NAME                                        READY     STATUS    RESTARTS   AGE
binging-mongoose-cog-2713078290-6v8fl       1/1       Running   0          3m
binging-mongoose-relay-3439989241-3ipdh     1/1       Running   0          3m
morbid-dolphin-postgresq-4285123528-c0i85   1/1       Running   0          4m
$ kubectl get pvc
NAME                       STATUS    VOLUME                                     CAPACITY   ACCESSMODES   AGE
morbid-dolphin-postgresq   Bound     pvc-ce60c23f-d2ff-11e6-9a23-42010a800fe0   8Gi        RWO           4m
ohaiwalt commented 7 years ago

New Helm developments allow sufficient conditionals to make this work just adding the database instead of documentation, and that seems the entirely better route.