-
Install the Google Cloud SDK
-
Set the current project as reach4help:
gcloud config set project reach4help
-
Login:
gcloud auth login
-
[OPTIONAL] Using the gcloud command line tool, install the Kubernetes command-line tool. kubectl is used to communicate with Kubernetes, which is the cluster orchestration system of GKE clusters:
gcloud components install kubectl
-
Run the following command in the root of the repo, which will submit the repo to cloud build, and then once the build completes the image will be stored in the container repository:
gcloud builds submit --tag gcr.io/reach4help/reach4help-chatbot
-
Deploy the latest version of the image (can be done in the Google Cloud Shell)
- Get the bot credentials
gcloud container clusters get-credentials reach4help-bot --zone=us-central1-b
- Tell kubernetes to rollout the image to the bot
kubectl set image deployment reach4help-bot reach4help-chatbot=gcr.io/reach4help/reach4help-chatbot@sha256:<sha from deployment logs>
- Get the bot credentials
-
Check that the bot successfully restarted and posted a message in the
#bot-admin
slack channel.
If you have to change deployment.yaml
for any reason, such as moving an
environment variable into a secret, then updating the image is not enough
and you need to apply the changed config like so:
kubectl apply -f deployment.yaml
If you need to upload new secrets to kubernetes, create them in a file called
.env.secrets
(which is ignored by gitignore), check that the bot works locally,
and then upload the secrets with the following command:
kubectl create secret generic chatbot --from-env-file ./.env.secrets --dry-run -o yaml | kubectl apply -f -
At which point redeploying the app should allow the new environment variables to take affect.