You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
3.8 KiB
109 lines
3.8 KiB
# Deployment
|
|
|
|
Services deployed (using kustomize):
|
|
|
|
- [catalog](./src/catalog)
|
|
- [runner](./src/runner)
|
|
- [proxy-admin](./src/proxy-admin)
|
|
- [proxy-web](./src/proxy-web)
|
|
|
|
- [web-client](./src/web-client)
|
|
- [admin-client](./src/admin-client)
|
|
|
|
|
|
Platform components deployed (using helm):
|
|
|
|
- [Traefik]()
|
|
- [Postgresql]()
|
|
|
|
|
|
## [Beta](https://beta.barretthousen.com)
|
|
|
|
The [Beta](https://beta.barretthousen.com) environment lives in my [homelab repo](https://git.vdhsn.com/adam/SunnyHomeLab),
|
|
and is auto deployed using Flux w/ kustomize.
|
|
|
|
See [./env/beta](./env/beta/kustomization.yaml) 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:
|
|
```sh
|
|
helm repo add traefik https://traefik.github.io/charts;
|
|
|
|
helm upgrade --install ingress traefik/traefik -n 'barretthousen-beta'\
|
|
--set=logs.access.enabled=true
|
|
```
|
|
|
|
2. Postgresql:
|
|
```sh
|
|
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 images to `beta`
|
|
```sh
|
|
export ENV=beta; # if not specified, will only build and push for the git commit
|
|
make build-backend-image SERVICE=catalog
|
|
make build-backend-image SERVICE=runner
|
|
make build-backend-image SERVICE=auth
|
|
make build-backend-image SERVICE=proxy-admin
|
|
make build-backend-image SERVICE=proxy-web
|
|
|
|
# for prod drop `beta prefix
|
|
make build-client-image SERVICE=web-client
|
|
make build-client-image SERVICE=admin-client
|
|
```
|
|
|
|
2. Rolling restart deployments in the beta env
|
|
```sh
|
|
# for prod drop `-beta` suffix
|
|
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 auth-beta
|
|
kubectl rollout status -n barretthousen-beta deployment auth-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-web-beta
|
|
kubectl rollout status -n barretthousen-beta deployment proxy-web-beta -w
|
|
|
|
kubectl rollout restart -n barretthousen-beta deployment web-client-beta
|
|
kubectl rollout status -n barretthousen-beta deployment web-client-beta -w
|
|
|
|
kubectl rollout restart -n barretthousen-beta deployment admin-client-beta
|
|
kubectl rollout status -n barretthousen-beta deployment admin-client-beta -w
|
|
```
|
|
|
|
3. Promote images to prod
|
|
```sh
|
|
make promote-backend-prod SERVICE=catalog
|
|
make promote-backend-prod SERVICE=runner
|
|
make promote-backend-prod SERVICE=auth
|
|
make promote-backend-prod SERVICE=proxy-admin
|
|
make promote-backend-prod SERVICE=proxy-web
|
|
|
|
make promote-client-prod SERVICE=web-client
|
|
make promote-client-prod SERVICE=admin-client
|
|
```
|