ci: re-add backend staging deploy workflow
Some checks failed
Deploy Backend to Staging / Deploy backend to staging (push) Failing after 1s
Some checks failed
Deploy Backend to Staging / Deploy backend to staging (push) Failing after 1s
This commit is contained in:
45
.gitea/workflows/deploy.yml
Normal file
45
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Deploy Backend to Staging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
concurrency:
|
||||
group: deploy-backend
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy backend to staging
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Pull latest code
|
||||
run: |
|
||||
cd /opt/encoach/encoach_backend_new_v2
|
||||
git fetch origin
|
||||
git reset --hard origin/main
|
||||
echo "Deployed: $(git log -1 --oneline)"
|
||||
|
||||
- name: Rebuild and restart containers
|
||||
run: |
|
||||
cd /opt/encoach/encoach_backend_new_v2
|
||||
docker compose \
|
||||
-f docker-compose.yml \
|
||||
-f /opt/encoach/overrides/encoach.override.yml \
|
||||
up -d --build --remove-orphans
|
||||
|
||||
- name: Smoke test
|
||||
run: |
|
||||
echo "Waiting 60s for Odoo to become healthy..."
|
||||
sleep 60
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 30 http://localhost:8069/api/health)
|
||||
if [ "$STATUS" != "200" ]; then
|
||||
echo "ERROR: /api/health returned $STATUS"
|
||||
exit 1
|
||||
fi
|
||||
FE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 http://localhost:3000/)
|
||||
if [ "$FE" != "200" ]; then
|
||||
echo "ERROR: Frontend returned $FE"
|
||||
exit 1
|
||||
fi
|
||||
echo "All OK — Odoo=$STATUS Frontend=$FE"
|
||||
Reference in New Issue
Block a user