Yukioru / kit

Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KIT

Development

Prerequisites

How to start

  1. Add .env or .env.js file in root directory
# .env
TEXT=local
# .env.js
module.exports = {
  TEXT: 'local'
}
  1. Install dependencies
pnpm install
  1. Run dev script
pnpm run dev

Manual deployment

  1. Install dependencies
pnpm install
  1. Run build script
pnpm run build
  1. Check that all ok and your result in apps/*/lib directory

  2. Eject node_modules for every app from apps/*

cd apps/api/lib
pnpm -F "." deploy .release
  1. Check that all ok and your result in apps/*/.release directory

  2. Build docker image for every app in apps/* directory

cd apps/api
docker build -t kit-api .

Deployment inside BuzzGuru infrastructure

Tech stack

  • Gitlab CI (CI/CD)
  • Docker Swarm (docker orchestrator)
  • Nexus (docker registry)
  • Traefik (loadbalancer)

How to start

  1. Check deploy/gitlab-ci.yml file
  • Change DOCKER_SERVICE prefix and VIRTUAL_HOST for your.
  • Add more stages/branches if you need.
  1. Check deploy/docker-stack.yml file
  • Change loadbalancer.server.port for port of your app.
  • Change deploy.replicas if you need.
  • Change deploy.placement.constraints - node.labels for your node labels.
  • Add more paths in traefik.http.routers.*.ruleif you need.
  1. Change custom CI configuration path

For your project to deploy/.gitlab-ci.yml or place .gitlab-ci.yml to root directory

General pipelines

  1. Check or fill CI Varibles for Docker Registry
  • DOCKER_REGISTRY - registry.buzz.guru
  • DOCKER_REGISTRY_USER - username of nexus registry
  • DOCKER_REGISTRY_PASS - password of nexus registry

Variables

  1. Check or add .env and .env.js files

files in CI Variables for every stage

  • {{STAGENAME}}_env_file for .env file
  • {{STAGENAME}}_env_js for .env.js file

Variables

You can change variable names in deploy/docker-stack.yml

  1. Check you branch protected option

Protected Branches

  1. Push
  • master branch for prod stage
  • develop branch for dev stage

Deployment from BuzzGuru infrastructure to DigitalOcean Kubernetes

Manual deploy

kubectl apply -f ./deploy/k8s-deploy.yaml

Not for this project, but for all:

Config for kubectl

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

Dashboard

Install

kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml

Use

kubectl proxy

Open in browser:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

Traefik

kubectl apply -f ./deploy/traefik-deployment.yaml

Use kubectl get services until services starting with traefik get the EXTERNAL-IP

About

Kit


Languages

Language:TypeScript 80.1%Language:JavaScript 12.7%Language:CSS 5.7%Language:Dockerfile 1.4%