This repo contains code for a Node.js multi-tier application.
The application overview is as follows
web <=> api <=> db
The folders web
and api
respectively describe how to install and run each app.
- [ ] Dockerfile
- [ ] Terraform codebase
- [ ] gcloud automation
- [ ] project creation
- [ ] permission fixes
- [ ] enable api
- [ ] Automate gitlab ci variables
- [ ] Instrumentation
- [ ] prometheus
items | remarks |
---|---|
GKE | free (300$ credits) and more mature than EKS |
terraform | easier to build cluster from code, test it and nuke it later |
Makefile | easier to prepare and streamline the demo |
cloudsql | avoid dealing with persistent state onk8s cluster and other HA configuration |
gitlab-ci | easy and straight forward ci/cd also free for demo |
CloudBuild | to build the container images |
stackdriver | log the error on application |
Google CDN | caching the static resources |
loki | just for tryout, its simple straight forward logging solution |
Since we use rely on env vars for ci/cd on .gitlab-ci.yml, set thes on Setting -> CI/CD on gitlab.
- CERTIFICATE_AUTHORITY_DATA
- SERVER
- USER_TOKEN
- GCLOUD_SERVICE_KEY
We are using google cloud codebuild, to do the setup,
- create a service account for ci_builder on gcloud console. Needed permission are: container builder, storage reader and log viewer
- generate/download a json key somewhere: like /tmp/key.json
- use its base64 encode version on gitlab ci_cd variable:
GCLOUD_SERVICE_KEY
base64 -w 0 /tmp/key.json