|
| 1 | +# Deploy Prompt Template |
| 2 | + |
| 3 | +A reusable Claude Code session prompt for spinning up a new Towlion application deployment. Copy this prompt, replace the placeholders, and paste it into a Claude Code session. |
| 4 | + |
| 5 | +## Placeholders |
| 6 | + |
| 7 | +| Placeholder | Description | Example | |
| 8 | +|---|---|---| |
| 9 | +| `<app-name>` | Repository name for the new app | `todo-app` | |
| 10 | +| `<your-domain.com>` | Domain or subdomain for the app | `todo.example.com` | |
| 11 | +| `<server-ip>` | IP address of the target server | `203.0.113.42` | |
| 12 | + |
| 13 | +## Prompt |
| 14 | + |
| 15 | +``` |
| 16 | +I want to deploy a new Towlion app called <app-name> to <your-domain.com> on server <server-ip>. |
| 17 | +
|
| 18 | +Walk me through these 5 phases: |
| 19 | +
|
| 20 | +### Phase 1: Create repository |
| 21 | +- Create a new repo from the towlion/app-template GitHub template |
| 22 | +- Clone it locally |
| 23 | +- Run setup-repo.sh to configure governance (branch protection, labels) |
| 24 | +
|
| 25 | +### Phase 2: Build the app |
| 26 | +- Implement the application logic in app/main.py |
| 27 | +- Add any new dependencies to requirements.txt (at repo root) |
| 28 | +- Ensure the /health endpoint returns {"status": "ok"} |
| 29 | +- Commit with conventional commit messages (feat:, fix:, etc.) |
| 30 | +
|
| 31 | +### Phase 3: Provision server |
| 32 | +- SSH into the server and install Docker |
| 33 | +- Create /data/{postgres,redis,minio,caddy} directories |
| 34 | +- Set up DNS A record: <your-domain.com> -> <server-ip> |
| 35 | +- Generate a deploy SSH key pair |
| 36 | +
|
| 37 | +### Phase 4: Deploy |
| 38 | +- Configure GitHub Actions secrets (SERVER_HOST, SERVER_USER, SERVER_SSH_KEY, APP_DOMAIN, DATABASE_PASSWORD, MINIO_ROOT_USER, MINIO_ROOT_PASSWORD) |
| 39 | +- Push to main to trigger the deploy workflow |
| 40 | +- The workflow will: build containers, start services with docker-compose.standalone.yml, run migrations inside the container, then health check |
| 41 | +- Verify with: curl https://<your-domain.com>/health |
| 42 | +
|
| 43 | +### Phase 5: Configure CI/CD |
| 44 | +- Confirm the deploy.yml workflow runs on push to main |
| 45 | +- Confirm the validate.yml workflow runs on PRs |
| 46 | +- Test by pushing a small change and watching the Actions tab |
| 47 | +
|
| 48 | +Important notes: |
| 49 | +- The app-template already includes all deployment fixes (correct migration ordering, __init__.py, PYTHONPATH, alembic -c flag) |
| 50 | +- Standalone mode uses docker-compose.standalone.yml which includes postgres, redis, minio, and caddy |
| 51 | +- Migrations run AFTER containers start: docker compose exec app alembic -c app/alembic.ini upgrade head |
| 52 | +- requirements.txt must be at repo root (not app/) for the Dockerfile build context |
| 53 | +``` |
| 54 | + |
| 55 | +## See also |
| 56 | + |
| 57 | +- [Tutorial](tutorial.md) — step-by-step walkthrough with detailed commands |
| 58 | +- [Deployment](deployment.md) — pipeline internals and zero-downtime strategy |
| 59 | +- [Self-Hosting](self-hosting.md) — fork model and infrastructure overview |
0 commit comments