Disclaimer
This project is a proof of concept based on our perception about how a start-up cloud infrastructure should be so it not guarantee any best practices nor any ‘ready to production’ examples.
Because the project is a bit too complex and has many concepts, the documentation does not fully cover them.
Requirement:
We need to design a continuous delivery architecture for a scalable and secure tree tier app
detailed:
apps (web and api) should
- be accesible through a public ip
- autoscale
- update without downtime
- automated ci/cd
- handle instance failures
- serve static content through CDN
database should
- not be accesible outside the cluster
- have daily backups
- be fault tolerant
the infrastructure should present relevant
- logs
- historical metrics ( at least the four golden signs )
Design
We choose Google Cloud to implement this infrastructure. The infrastructure will be provisioned with Terraform, database tier consist of a PostgreSQL Cloud instance which reside in two different zones for high availability, backed up daily and have ‘Point in time recovery’ enabled.
The computational power will be served through a Google Kubernetes Engine consist of three nodes with autoscale enabled. The cluster have a single namespace for production(can be added if needed), one for logging and one for monitoring. A simple ingress to manage traffic between live and cannary deploys and a backend for serving static assets through CDN wired to web-app Service. For variables and database password are created two ConfigMap’s and one Secret which are provided by Terraform.
Logs will be collected by Fluentd, stored in Elasticsearch and displayed through Kibana.
Monitoring is setted up with Prometheus and Grafana.
Despite that we host this code on GitHub, the CI/CD pipeline is built for GitLab. The .gitlab-ci.yml
have some basic stages to build and push the image to Google Cloud Registry and deploy it to k8s. More info’s here -> GitLab CI/CD Pipeline – Push Image to GRC and Cannary Deploy to GKE | GCP Infrastructure overview
Project setup
The following settings are tested on MacOS environment and for a fully functional infrastructure all steps presented in Readme.md are required. We encourage you to get a simple Docker image with your app to build a real scenario or you can use the simple go app from the pipeline’s repo.
GitHub repo: https://github.com/aaadipop/gcp-poc
For questions, requests, assessments or suggestions drop us a line
*billing for two weeks on europe-west4: ~$125
Happy scaling 🙂