k8s-deployment #1

Merged
darren merged 10 commits from k8s-deployment into main 2025-05-21 21:18:21 +00:00
2 changed files with 30 additions and 0 deletions
Showing only changes of commit 85e761d0d6 - Show all commits

@ -67,6 +67,10 @@ jobs:
CANVAS_API_KEY: "${{ secrets.CANVAS_API_KEY }}" CANVAS_API_KEY: "${{ secrets.CANVAS_API_KEY }}"
EOF EOF
- name: Delete old migration/seed job
run: |
kubectl delete job fusero-backend-db-init -n fusero-prod || true
- name: Deploy to Kubernetes - name: Deploy to Kubernetes
run: | run: |
helm upgrade --install fusero ./chart \ helm upgrade --install fusero ./chart \
@ -77,6 +81,16 @@ jobs:
--set backend.image.repository=registry.liquidrinu.com/fusero-backend \ --set backend.image.repository=registry.liquidrinu.com/fusero-backend \
--set frontend.image.repository=registry.liquidrinu.com/fusero-frontend --set frontend.image.repository=registry.liquidrinu.com/fusero-frontend
- name: Wait for migration/seed job
run: |
kubectl wait --for=condition=complete --timeout=300s job/fusero-backend-db-init -n fusero-prod
JOB_STATUS=$(kubectl get job fusero-backend-db-init -n fusero-prod -o jsonpath='{.status.succeeded}')
if [ "$JOB_STATUS" != "1" ]; then
echo "Migration/seed job failed!" >&2
kubectl logs job/fusero-backend-db-init -n fusero-prod
exit 1
fi
- name: Verify Deployment - name: Verify Deployment
run: | run: |
kubectl rollout status deployment/fusero-backend -n fusero-prod kubectl rollout status deployment/fusero-backend -n fusero-prod

@ -81,6 +81,7 @@ A full-stack application boilerplate with a React frontend and Node.js backend
- [CI/CD \& Automated Testing](#cicd--automated-testing) - [CI/CD \& Automated Testing](#cicd--automated-testing)
- [Troubleshooting Production](#troubleshooting-production) - [Troubleshooting Production](#troubleshooting-production)
- [🆕 Recent Improvements \& Troubleshooting](#-recent-improvements--troubleshooting) - [🆕 Recent Improvements \& Troubleshooting](#-recent-improvements--troubleshooting)
- [🚀 Production Deployment Pipeline (CI/CD)](#-production-deployment-pipeline-cicd)
--- ---
@ -821,3 +822,18 @@ The application uses a secure secrets management approach:
``` ```
--- ---
## 🚀 Production Deployment Pipeline (CI/CD)
- On every push/merge to `main`, the Gitea CI/CD pipeline will:
1. Build and push Docker images for backend and frontend.
2. Generate `secrets.prod.yaml` from Gitea CI/CD secrets.
3. **Delete the old migration/seed job** (`fusero-backend-db-init`) to ensure a fresh run.
4. Deploy the app with Helm, which triggers the migration/seed job.
5. **Wait for the migration/seed job to complete.**
6. **Fail the pipeline if the job fails** (with logs for debugging).
7. Verify the deployment.
- This ensures your database is always migrated and seeded with every deploy, and you'll know immediately if something goes wrong.
- To trigger a production deployment, just push or merge to `main`.