Files
esg/ci-cd/TASK.md
T
s.alikhani 9ee9081b11 ci(deployment): automate esg development deployment
Deploy latest remote main from a clean app checkout, build the development Compose app, wait for readiness after TypeORM migrations, and notify Rocket.Chat using short commit links.
2026-10-17 16:42:01 +03:30

2.7 KiB

ESG development CI

Workflow: .woodpecker.yml in Shared/esg. Pushes to main and manual runs on main fetch and deploy latest remote main. The selected revision is saved in the per-run workspace; notifications use seven-character commit links and may differ from the triggering commit.

Enable once

  1. Update /data/infra-deploy/shared-esg/app to include this workflow. The checkout must be on main and clean. Resolve local changes explicitly; CI does not discard or stash them and refuses locally advanced/divergent main.
  2. Enable Shared/esg in Woodpecker with .woodpecker.yml as the workflow path. An administrator must enable Trusted volumes for host mounts/socket.
  3. Use the Deploy-Develop agent with WOODPECKER_MAX_WORKFLOWS=1 and repository concurrency 1. With multiple agents, configure labels to select this host. Let active deployments finish instead of automatically canceling on new pushes.
  4. Configure rocketchat_webhook with the complete incoming webhook URL for the existing deployment channel. No quotes, Markdown, or whitespace.
  5. Ensure /home/talieh/.ssh can fetch Shared/esg and known_hosts trusts git.ittalie.com. CI mounts SSH read-only with strict host checking.
  6. Run a manual workflow on main and inspect pull, deploy and notification logs.

Runtime

Glue: /data/infra-deploy/shared-esg, Compose project: shared-esg. Required files: compose.dev.yaml, populated .env, and app/Dockerfile. Secrets stay in the parent glue .env, outside the app checkout. The Dockerfile's production target is used by the development Compose stack; it is a build-stage name, not a customer production deployment.

Only app is built and deployed. TypeORM runs PostgreSQL migrations at startup. Compose waits up to 300 seconds for /health/ready, which checks database connectivity, heap usage and disk space. This is not a provider smoke test. No separate Laravel scheduler or schedule:list step exists for this Nest app. No database service, UI, production deployment or BNP publishing is included.

The full selected revision and timing live in the per-run CI workspace, not in the host checkout. Notification delivery errors fail visibly and do not roll back a successful deployment. Code rollback does not undo database migrations. Opsctl stays independent; no shared lock prevents manual operations racing CI. Glue updates remain a separate Infra/deploy operation.

Troubleshooting

cd /data/infra-deploy/shared-esg
docker compose -f compose.dev.yaml ps app
docker compose -f compose.dev.yaml logs --tail=100 app

Check that DATABASE_URL is configured without exposing its value in logs. Do not share full webhook URLs or credentials in issue reports.