-
- 4.1 Microservices
- 4.2 Ingress controller
- 4.3 Metric Server
- 4.4 Dashboard
-
Register OAuth Apps in https://github.com/settings/developers (2+ for different environment)
the Authorization callback URL should be: {baseApiUrl}/user/oauth2/github/redirect
keep the ClientID and ClientSecret
-
Add parameters in aws parameter store:
use KMS customer managed keys if necessary.
3. [deprecated]Create Tables in aws DynamoDB: dlf.Memos, dlf.Users
-
Prepare an SQL Server instance to store data for finance api, table will be automatic migrated
-
Prepare database in MongoDB atlas (free forever for first 500MB)
-
database: dlw_mathematicals
-
collections: answers, questions
-
database: dlw_memo
-
collections: users, memos (replace dynamodb)
-
- install git: https://git-scm.com/downloads;
- install [dotnet 6 sdk] (https://dotnet.microsoft.com/en-us/download/dotnet/6.0);
- install nodejs and npm;
- install and configure azure cli;
- install kubectl;
- install helm;
- install terraform;
- install consul.
- [optional] install postman;
- [optional] install draw.io;
- [optional] install docker;
- [optional] install kind;
- [optional] install and configure aws cli.
after you connected to aks, you context is attached to aks by default, if you want to check your local Kubernetes status, you need switch context:
kubectl config view
kubectl config use-context kind-dlw-cluster
(Here is the Application Gateway version, Nginx version is very similar)
Service | Path | Tags |
---|---|---|
User api service | user api service | |
Memo api service | memo api service | |
Date api service | date api service | |
Finance api service | finance api service |
reference ingress
devops/metrics/*.yaml
: enable metrics server which is necessary for horizontalautoscaler or veticalautoscaler if metric server not deployed by default, --kubelet-insecure-tls args is used for local, --metric-resolution can be set to longer if use docker-desktop
cloud based kubernetes already include metric server by default.
devops/dashboard
: follow the instructions to enable dashboard.
in "devops" folder, you can find how to deploy the microservices to azure Kubernetes service.
microservice helm chart is located in "./dlw-chart" and "./dlw-chart-nossl".
## if you have docker, and want to push to docker hub
tag=latest
cd src/date-api
docker build -t dlw-date-api:$tag -f date-api/Dockerfile .
docker image tag dlw-date-api:$tag yufelix/dlw-date-api:$tag
docker image push yufelix/dlw-date-api:$tag
cd ../finance-api
docker build -t dlw-finance-api:$tag -f finance-api/Dockerfile .
docker image tag dlw-finance-api:$tag yufelix/dlw-finance-api:$tag
docker image push yufelix/dlw-finance-api:$tag
cd ../memo-api
docker build -t dlw-memo-api:$tag -f memo-api/Dockerfile .
docker image tag dlw-memo-api:$tag yufelix/dlw-memo-api:$tag
docker image push yufelix/dlw-memo-api:$tag
cd ../user-api
docker build -t dlw-user-api:$tag -f user-api/Dockerfile .
docker image tag dlw-user-api:$tag yufelix/dlw-user-api:$tag
docker image push yufelix/dlw-user-api:$tag
# from devops/docker-compose dir
docker compose build --push
## if you do not have docker, and want to push to acr
tag=latest
cd src/date-api
az acr build -t dlw-date-api:$tag -f Dockerfile -r hssdevacr -g felix-configuration-rg .
cd ../finance-api
az acr build -t dlw-finance-api:$tag -f Dockerfile -r hssdevacr -g felix-configuration-rg .
cd ../memo-api
az acr build -t dlw-memo-api:$tag -f Dockerfile -r hssdevacr -g felix-configuration-rg .
cd ../user-api
az acr build -t dlw-user-api:$tag -f Dockerfile -r hssdevacr -g felix-configuration-rg .
deploy to aks with "prod" argument will create valid cert by cert-manager, and use consul as service register,
## deploy (need AWS CLI configured)
cd aks
sh install.sh prod ## prod/dev
## destroy (need AWS CLI configured)
cd aks
sh uninstall.sh prod ## prod/dev
## install/upgrade our microservices only (don't need to configure AWS CLI)
cd aks/services
sh main_services.sh prod ## prod/dev
following: ./devops/aks_nginx/readme.md
refer: Securing NGINX-ingress, Let's Encrypt
This version contains SSL/TLS termination and https redirection, and use consul service discovery.
following: ./devops/aks_appgw/readme.md
refer: aks, application gateway for aks, application-gateway-kubernetes-ingress
There is another folder "./dlw-chart-nossl" which is for deploying to a local kind cluster, it doesn't depend on cert-manager, and consul.
follow: ./devops/kind/readme.md
implemented by ReactJs + Redux