3.0 KiB
2026-04-22 Memory
Gitea Actions CI/CD Pipeline - Successfully Debugged & Deployed
Final Status: ✅ Working (Run 13 succeeded)
What was accomplished: Fully automated CI/CD pipeline for app01 repo via Gitea Actions — push to main triggers build + deploy + health check.
Key Fixes Applied (in order)
-
post-receive hook interference: Custom post-receive hook at
/data/git/repositories/gch3n/app01.git/hooks/post-receivewas interfering with Gitea's internal Actions event trigger. Removed it (renamed to.disabled), which allowed Gitea's built-in mechanism to fire Actions on push. -
Runner execution mode: Container-based runner (
act-runner-app01) couldn't run Docker inside Alpine Linux container (docker: not found). Switched to host-mode runner running directly on the server at/home/nplx/act_runner_host/. -
Checkout without Node.js:
actions/checkoutrequires Node.js which wasn't available in the runner environment. Replaced withgit archivecommand to export code to a temp directory for building. -
Missing frontend copy in Dockerfile: Dockerfile only had
COPY backend ./backendbut noCOPY frontend ./frontend, causing runtime crash (Directory '/app/frontend' does not exist). Added the missing COPY directive.
Infrastructure Details
- Server:
49.235.172.252:11022(usernplx) - Runner:
tencent-app01-host, host-mode, working dir/home/nplx/act_runner_host/ - Runner config:
/home/nplx/act_runner_host/config.yaml(fetch_interval: 2s, capacity: 1) - Runner labels:
self-hosted:host - Workflow file:
.gitea/workflows/deploy.ymlin repogch3n/app01 - App endpoint:
https://app.gch3n.online/health→{"status":"ok"} - Actions page:
https://git.gch3n.online/gch3n/app01/actions - Container:
app01-blueon port127.0.0.1:8001, proxied by Caddy toapp.gch3n.online
Workflow Design (deploy.yml)
on: push
runs-on: self-hosted
steps:
1. git archive → /tmp/app01-build/
2. docker build -t app01:latest /tmp/app01-build/
3. Stop old container, remove it
4. docker run -d --name app01-blue -p 127.0.0.1:8001:8001 app01:latest
5. Health check curl loop (up to 30s)
6. Cleanup /tmp/app01-build/
Known Remaining Issues
- Gitea Actions runs 1-12 are failed/cancelled (historical, cosmetic only)
- Previous cron-based deploy (
/home/nplx/ci/check-and-deploy-app01.sh) still exists but is now redundant — the Gitea Actions workflow replaces it - Previous container runner
act-runner-app01was stopped but may still exist
Lessons Learned
- Gitea Actions event trigger depends on Gitea's internal post-receive processing; custom hooks in the same repo can interfere
- Container-based runners can't run Docker unless Docker-in-Docker is properly set up (socket mount + compatible OS)
actions/checkoutis a JavaScript action requiring Node.js — not available in bare Alpine/host environments- Always verify Dockerfile COPY directives match actual project structure