barretthousen/doc/deployment.md

3.0 KiB

Deployment

Services deployed (using kustomize):

Platform components deployed (using helm):

  • Traefik
  • Postgresql

Beta

The Beta environment lives in my homelab repo, and is auto deployed using Flux w/ kustomize.

See ./env/beta for how it's set up.

  • There are only 3 environments: local, beta, prod
    • local: optimize for iteration speed, observability, mutability. Ephemeral data. Should be quick to create and destroy.
    • beta: optimize for likeness with prod, observability, and durable data.
    • prod: optimize for up time, automated change control, observability, data durability.
  • Each environment should pull from the image tag that matches it's name (ie catalog service running in beta env will use git.vdhsn.com/barretthousen/service-catalog:beta docker image)
  • All environments should have resources suffixed with their name (ie deployment/catalog-beta in beta env)
  • All environments must use kustomize, and have the same resources - configuration of those resources can vary as needed

Initial environment setup

Deploy the following with Helm (assuming we're setting up a new beta env with the following commands):

  1. Traefik:
helm repo add traefik https://traefik.github.io/charts;

helm upgrade --install  ingress traefik/traefik -n 'barretthousen-beta'\
			--set=logs.access.enabled=true
  1. Postgresql:
helm repo add bitnami https://charts.bitnami.com/bitnami;

helm install --upgrade bh-db bitnami/postgresql -n 'barretthousen-beta' \
			--set='fullnameOverride=bh-db' \
			--set='auth.enablePostgresuser=true' \
			--set='auth.postgresPassword=bh-admin' \
			--set='auth.database=bh'

Deployment steps

  1. Build and publish prod images
make build-backend-image SERVICE=catalog env=beta
make build-backend-image SERVICE=runner env=beta
make build-backend-image SERVICE=proxy-admin env=beta
make build-backend-image SERVICE=proxy-client env=beta

make build-client-image SERVICE=web-client env=beta
  1. Rolling restart deployments in the beta env
kubectl rollout restart -n barretthousen-beta deployment runner-beta
kubectl rollout status -n barretthousen-beta deployment runner-beta -w

kubectl rollout restart -n barretthousen-beta deployment catalog-beta
kubectl rollout status -n barretthousen-beta deployment catalog-beta  -w

kubectl rollout restart -n barretthousen-beta deployment proxy-admin-beta
kubectl rollout status -n barretthousen-beta deployment proxy-admin-beta -w

kubectl rollout restart -n barretthousen-beta deployment proxy-client-beta
kubectl rollout status -n barretthousen-beta deployment proxy-client-beta -w

kubectl rollout restart -n barretthousen-beta deployment web-client-beta
kubectl rollout status -n barretthousen-beta deployment web-client-beta -w

Prod

TBD