- Add .env or .env.js file in root directory
# .env
TEXT=local# .env.js
module.exports = {
TEXT: 'local'
}- Install dependencies
pnpm install- Run dev script
pnpm run dev- Install dependencies
pnpm install- Run build script
pnpm run build-
Check that all ok and your result in apps/*/lib directory
-
Eject node_modules for every app from apps/*
cd apps/api/lib
pnpm -F "." deploy .release-
Check that all ok and your result in
apps/*/.releasedirectory -
Build docker image for every app in
apps/*directory
cd apps/api
docker build -t kit-api .- Gitlab CI (CI/CD)
- Docker Swarm (docker orchestrator)
- Nexus (docker registry)
- Traefik (loadbalancer)
- Check
deploy/gitlab-ci.ymlfile
- Change
DOCKER_SERVICEprefix andVIRTUAL_HOSTfor your. - Add more stages/branches if you need.
- Check
deploy/docker-stack.ymlfile
- Change
loadbalancer.server.portfor port of your app. - Change
deploy.replicasif you need. - Change
deploy.placement.constraints-node.labelsfor your node labels. - Add more paths in
traefik.http.routers.*.ruleif you need.
- Change custom CI configuration path
For your project to deploy/.gitlab-ci.yml or place .gitlab-ci.yml to root directory
- Check or fill CI Varibles for Docker Registry
DOCKER_REGISTRY-registry.buzz.guruDOCKER_REGISTRY_USER- username of nexus registryDOCKER_REGISTRY_PASS- password of nexus registry
- Check or add .env and .env.js files
files in CI Variables for every stage
{{STAGENAME}}_env_filefor .env file{{STAGENAME}}_env_jsfor .env.js file
You can change variable names in deploy/docker-stack.yml
- Check you branch protected option
- Push
masterbranch forprodstagedevelopbranch fordevstage
kubectl apply -f ./deploy/k8s-deploy.yaml
The easiest way to apply the configuration to kubectl is to put it in ~/.kube/config and check it with kubectl cluster-info, it should output the cluster ip or just no errors
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
kubectl proxy
Open in browser:
http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
kubectl apply -f ./deploy/traefik-deployment.yaml
Use kubectl get services until services starting with traefik get the EXTERNAL-IP