k8s-deployment #1
@ -67,6 +67,10 @@ jobs:
|
||||
CANVAS_API_KEY: "${{ secrets.CANVAS_API_KEY }}"
|
||||
EOF
|
||||
|
||||
- name: Delete old migration/seed job
|
||||
run: |
|
||||
kubectl delete job fusero-backend-db-init -n fusero-prod || true
|
||||
|
||||
- name: Deploy to Kubernetes
|
||||
run: |
|
||||
helm upgrade --install fusero ./chart \
|
||||
@ -77,6 +81,16 @@ jobs:
|
||||
--set backend.image.repository=registry.liquidrinu.com/fusero-backend \
|
||||
--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
|
||||
run: |
|
||||
kubectl rollout status deployment/fusero-backend -n fusero-prod
|
||||
|
16
README.md
16
README.md
@ -81,6 +81,7 @@ A full-stack application boilerplate with a React frontend and Node.js backend
|
||||
- [CI/CD \& Automated Testing](#cicd--automated-testing)
|
||||
- [Troubleshooting Production](#troubleshooting-production)
|
||||
- [🆕 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`.
|
||||
|
Loading…
Reference in New Issue
Block a user