- GitHub Actions deploy workflow fails
- App is not accessible after a deploy
- Containers are crashing after deploy
Go to the repository's Actions tab and open the failed workflow run. Check both jobs:
- test — build and test failures (Dockerfile issues, missing dependencies, test failures)
- deploy — SSH or server-side failures
Look for the first red step. The error message usually points directly to the cause.
ssh deploy@YOUR_SERVER_IPdocker compose -p <app-name> -f /opt/apps/<app-name>/deploy/docker-compose.yml psLook for containers in Restarting, Exited, or Created (not Up) states.
docker compose -p <app-name> -f /opt/apps/<app-name>/deploy/docker-compose.yml logs --tail 100 appCommon error patterns:
ModuleNotFoundError— missing Python dependency inrequirements.txtConnection refusedto postgres — database not reachable or wrong credentialsAddress already in use— port conflict with another containerPermissionError— file ownership issue in mounted volumes
df -h /
free -h
docker system dfIf disk is above 90%, clean up:
docker system prune -fdocker network inspect towlionConfirm the app container and platform services (postgres, redis, caddy) are all on the towlion network.
cat /opt/apps/<app-name>/deploy/.envCheck that DATABASE_URL, SECRET_KEY, and other required variables are set. Compare against deploy/env.template for any missing values.
cat /opt/platform/caddy-apps/<app-name>.caddyVerify:
- The domain matches
APP_DOMAIN - The upstream container name is correct (e.g.,
<app-name>-app-1:8000) - The
security_headerssnippet is imported
Reload Caddy if you made changes:
docker compose -f /opt/platform/docker-compose.yml exec -T caddy caddy reload --config /etc/caddy/Caddyfile| Symptom | Likely Cause | Fix |
|---|---|---|
| SSH connection refused | Wrong SERVER_HOST or SSH key |
Verify GitHub secret matches server IP and key |
| Docker build fails | Missing dependency or syntax error | Fix Dockerfile or requirements.txt |
| Container exits immediately | Missing env var or import error | Check deploy/.env and container logs |
| 502 Bad Gateway | App container not running or wrong upstream | Check docker ps and Caddyfile |
| Alembic migration fails | Schema conflict or missing migration | SSH in and run alembic upgrade head manually to see the error |
| "Network not found" | towlion network missing |
Run docker network create towlion |
| Disk full | Old images/containers accumulating | docker system prune -f |
| Permission denied | File ownership mismatch | Check that deploy user owns /opt/apps/<app-name> |
- Re-run the deploy workflow from the GitHub Actions tab (click "Re-run all jobs")
- Or trigger a new deploy by pushing a commit
- Verify the health endpoint:
curl -s https://<app-domain>/health