refactor(host): migrate from docker swarm to kubernetes
Build and Push Image / build-backend (push) Successful in 2m13s
Build and Push Image / build-frontend (push) Successful in 4m9s
Build and Push Image / push (push) Successful in 4m21s

This commit is contained in:
2026-06-19 18:18:17 +00:00 Unverified
parent 3a2ea239e8
commit 4559f4693c
54 changed files with 523 additions and 126 deletions
+28 -7
View File
@@ -57,13 +57,34 @@ jobs:
docker push mts.dgnr.us:5000/${{ gitea.repository }}:frontend-$TAG &
wait
- name: Deploy to production
- name: Install kubectl
run: |
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
curl -sLO "https://dl.k8s.io/release/v1.35.0/bin/linux/${ARCH}/kubectl"
chmod +x kubectl
mv kubectl /usr/local/bin/kubectl
- name: Configure kubectl
run: |
kubectl config set-cluster buzz --server=https://100.75.220.33:6443 --insecure-skip-tls-verify=true
kubectl config set-credentials ci-deployer --token=${{ secrets.KUBE_TOKEN }}
kubectl config set-context buzz --cluster=buzz --user=ci-deployer --namespace=buzz
kubectl config use-context buzz
- name: Deploy to k3s
run: |
TAG=${{ gitea.sha }}
docker service update \
--image mts.dgnr.us:5000/${{ gitea.repository }}:frontend-$TAG \
buzz_app
docker service update \
--image mts.dgnr.us:5000/${{ gitea.repository }}:backend-$TAG \
buzz_backend
# DB migration
kubectl delete job db-migrate -n buzz --ignore-not-found
kubectl create job db-migrate \
--image=mts.dgnr.us:5000/${{ gitea.repository }}:frontend-$TAG \
-n buzz \
-- bun dr push
kubectl wait --for=condition=complete job/db-migrate -n buzz --timeout=180s
# Roll app & backend
kubectl set image deployment/app app=mts.dgnr.us:5000/${{ gitea.repository }}:frontend-$TAG -n buzz
kubectl set image deployment/backend backend=mts.dgnr.us:5000/${{ gitea.repository }}:backend-$TAG -n buzz
kubectl rollout status deployment/app -n buzz --timeout=180s
kubectl rollout status deployment/backend -n buzz --timeout=180s