| .. | ||
| build.sh | ||
| deploy-prod.sh | ||
| deploy-staging.sh | ||
| deploy-test.sh | ||
| deploy.sh | ||
| env.sh | ||
| install-logging.sh | ||
| push.sh | ||
| README.md | ||
| rollback-prod.sh | ||
| update-logs-dns.sh | ||
| update-test-dns.sh | ||
Deploying to k3s (Hetzner)
Prereqs
kubectlinstalled locally.- Access to the cluster kubeconfig.
- Secrets loaded (dotenv via
scripts/load-secrets.sh).
Kubeconfig
- By default
deploy/deploy.shwill use$KUBECONFIG. If that is unset andcreds/kubeconfig.yamlexists, it will exportKUBECONFIG=$PWD/creds/kubeconfig.yaml. - Recommended flow for new devs:
- Obtain the kubeconfig from the cluster admin.
- Save it as
creds/kubeconfig.yaml(ignored by git), or setKUBECONFIGto your own path. The repo also includescreds/kubeconfig.enc.yaml(sops/age-encrypted) and a plaintext copy can be produced with the age key. - Verify access:
kubectl get ns(you should seelomavuokraus-test/staging/prod).
- If you want to keep the kubeconfig in-repo but encrypted, store it as
creds/kubeconfig.enc.yamlwith sops/age and decrypt tocreds/kubeconfig.yamlbefore deploying:- Decrypt:
SOPS_AGE_KEY_FILE=creds/age-key.txt sops -d creds/kubeconfig.enc.yaml > creds/kubeconfig.yaml - Encrypt (admin only):
SOPS_AGE_KEY_FILE=creds/age-key.txt sops -e kubeconfig.yaml > creds/kubeconfig.enc.yaml
- Decrypt:
Deploy commands
- Test:
./deploy/deploy-test.sh - Staging (default):
./deploy/deploy-staging.shorTARGET=staging ./deploy/deploy.sh - Prod:
./deploy/deploy-prod.sh
Notes
- Ensure
deploy/.last-imageexists (rundeploy/build.shfirst). AUTH_SECRET/DATABASE_URLshould be in your env or loaded viascripts/load-secrets.sh.deploy/deploy.shrunsprisma migrate deployautomatically whenDATABASE_URLis set; if it isn't, it will try to readDATABASE_URLfrom the in-clusterlomavuokraus-web-secretsin the target namespace (recommended for test/staging/prod).