Backend part takes the exchange rates for current month and store it in mysql database. Frontend part takes stored data from database and show it in web page. Forntend part can send update query to backend part via REST API
Backend provide database schema and migrations
Applications designed to run in k8s cluster
- Create GCP Project
- Activate Kubernetes API, Compute Engine API, Cloud SQL API
- Create service account with admin access to k8s and Compute Engine. Create service json key in it
- On your local machine install gcloud cli, kubectl cli and terraform (https://cloud.google.com/sdk/docs/install) (https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) (https://learn.hashicorp.com/tutorials/terraform/install-cli)
- Git clone app code from github (git clone https://github.com/Sacrament84/cbr-grabber)
- Deploy Cluster and Mysql infrastructure from folders infra/cluster infra/mysql using terraform ( terraform init, terraform apply )
- Setup kubectl to work with your new cluster ( gcloud container clusters get-credentials cbr-grabber-gke --zone europe-west3-c )
- Deploy namespaces from infra/yaml_ns/ns.yaml ( kubectl apply -f infra/yaml_ns/ns.yaml )
- Create service account for SQL Proxy with access to Cloud SQL API and json key in it
- Create kubernetes secrets for production and staging enviroments with json key from previous step ( kubectl create secret generic sa-key --from-file=service_account.json=key.json -n production ) ( kubectl create secret generic sa-key --from-file=service_account.json=key.json -n staging )
- Install Helm on your host machine ( https://helm.sh/docs/intro/install/ )
- Install nginx ingress controller with helm ( helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace nginx )
- Take external ingress controller ip address and create dns records for production, staging, jenkins, grafana
- Install cert-manager ( kubectl apply -f https://github.com/jetstack/cert-manager/releases/download/v1.7.0/cert-manager.yaml )
- Deploy certificate issuer ( kubectl apply -f infra/yaml_other/issuer.yaml )
- Deploy files from jenkins dir ( kubectl apply -f infra/jenkins ) If Jenkins was installed edit jenkins-pv.yaml and change jenkins pv to attach it to new deploy
- Clone Repo Prometheus operator ( git clone https://github.com/prometheus-operator/kube-prometheus.git ) and go to kube-prometheus folder
- Create resources ( kubectl create -f manifests/setup )
- Deploy monitoring stack ( kubectl create -f manifests/ )
- Deploy grafana ingress ( kubectl apply -f yaml_other/ingress-grafana.yaml ) Edit this file to change grafana host
- Add helm repo ( helm repo add grafana https://grafana.github.io/helm-charts )
- Update repo ( helm repo update )
- Install Grafana-Loki stack ( helm upgrade --install loki grafana/loki-stack --namespace=monitoring )
- Go to Grafana setting and add loki source http://loki.monitoring:3100