Skip to content

Commit 901f0f8

Browse files
baijumclaude
andcommitted
docs: fix tutorial deploy ordering and add deploy prompt template
- Fix tutorial.md pipeline diagram: migrations now run after containers start (inside container), matching deployment.md and deploy.yml - Fix troubleshooting: add concrete alembic retry command for failed migrations - Add deploy-prompt.md: reusable Claude Code session prompt for spinning up new app deployments with 5 phases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 36afbe2 commit 901f0f8

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

docs/deploy-prompt.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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

docs/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ GitHub Actions
185185
+-- SSH into server
186186
+-- Pull latest code
187187
+-- Build containers
188-
+-- Run database migrations
189188
+-- Start services
189+
+-- Run database migrations (inside container)
190190
+-- Health check
191191
```
192192

@@ -285,7 +285,7 @@ docker compose logs app --tail 50
285285

286286
Common causes:
287287

288-
- Database migration failed — check `docker compose logs app` for migration errors
288+
- Database migration failed — run `docker compose exec app alembic -c app/alembic.ini upgrade head` to retry migrations, and check `docker compose logs app` for errors
289289
- Missing environment variable — verify all secrets are set in GitHub
290290
- Port conflict — ensure no other service is using ports 80 or 443
291291

0 commit comments

Comments
 (0)