Skip to content

Commit 1d022f6

Browse files
baijumclaude
andcommitted
Add platform docs with MkDocs and GitHub Pages
Set up mkdocs-material site with consolidated documentation: architecture, app spec, deployment, self-hosting, preview environments, ecosystem, and roadmap. Includes GitHub Actions workflow for automatic deployment to GitHub Pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 parents  commit 1d022f6

12 files changed

Lines changed: 1153 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.12"
23+
24+
- run: pip install mkdocs-material
25+
26+
- run: mkdocs gh-deploy --force

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
site/

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Towlion Platform
2+
3+
**Self-hosted GitHub-native micro-PaaS for deploying small web applications.**
4+
5+
Deploy full web applications to your own server directly from GitHub. No custom dashboards, no complex control planes — just GitHub repositories, Actions, and a single server.
6+
7+
## Documentation
8+
9+
Full documentation is available at **[towlion.github.io/platform](https://towlion.github.io/platform)**.
10+
11+
- [Architecture](https://towlion.github.io/platform/architecture/) — platform design, tech stack, diagrams
12+
- [App Specification](https://towlion.github.io/platform/spec/) — application contract (ports, endpoints, env vars)
13+
- [Deployment](https://towlion.github.io/platform/deployment/) — CI/CD pipeline, zero-downtime deploys, migrations
14+
- [Self-Hosting](https://towlion.github.io/platform/self-hosting/) — fork model, server requirements, bootstrap
15+
- [Preview Environments](https://towlion.github.io/platform/preview-environments/) — PR previews, DNS, cleanup
16+
- [Ecosystem](https://towlion.github.io/platform/ecosystem/) — org structure, app template, multi-app hosting
17+
- [Roadmap](https://towlion.github.io/platform/roadmap/) — phased development plan
18+
19+
## Project Status
20+
21+
Early development. The platform is evolving toward a fully automated GitHub-driven deployment ecosystem.
22+
23+
## License
24+
25+
MIT License

docs/architecture.md

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# Architecture
2+
3+
## Overview
4+
5+
The Towlion platform runs on a single Debian server. Applications run as Docker containers and share a set of core infrastructure services.
6+
7+
```
8+
Internet
9+
10+
11+
DNS
12+
13+
14+
Reverse Proxy
15+
(Caddy)
16+
/ | \
17+
▼ ▼ ▼
18+
App 1 App 2 App 3
19+
20+
21+
Shared Services
22+
23+
┌────────┼─────────┬─────────┐
24+
▼ ▼ ▼ ▼
25+
PostgreSQL Redis MinIO Workers
26+
```
27+
28+
## Technology Stack
29+
30+
### Infrastructure
31+
32+
- **Debian 12** — host operating system
33+
- **Docker** — container runtime
34+
- **Docker Compose** — service orchestration
35+
36+
### Networking
37+
38+
- **Caddy** — reverse proxy with automatic TLS via Let's Encrypt
39+
40+
### Application
41+
42+
- **FastAPI** — Python backend framework
43+
- **SQLAlchemy** — ORM
44+
- **Pydantic** — data validation
45+
- **Alembic** — database migrations
46+
47+
### Frontend
48+
49+
- **Next.js** — React framework
50+
- **TypeScript** — type-safe frontend code
51+
52+
### Data
53+
54+
- **PostgreSQL** — primary database
55+
- **Redis** — caching and job queues
56+
- **MinIO** — S3-compatible object storage
57+
58+
### Background Jobs
59+
60+
- **Celery** — async task processing (backed by Redis)
61+
62+
### CI/CD
63+
64+
- **GitHub Actions** — automated builds and deployments
65+
66+
### Optional Observability
67+
68+
- **Grafana** — dashboards
69+
- **Loki** — log aggregation
70+
71+
## GitHub as the Control Plane
72+
73+
Traditional PaaS platforms use a dedicated control plane:
74+
75+
```
76+
CLI → Control plane → Kubernetes → containers
77+
```
78+
79+
Towlion replaces this with GitHub:
80+
81+
```
82+
GitHub repo → GitHub Actions → SSH deployment → Docker runtime
83+
```
84+
85+
GitHub provides:
86+
87+
- CI/CD (Actions)
88+
- Configuration storage (Secrets)
89+
- Access control (repository permissions)
90+
- Workflow orchestration (Actions workflows)
91+
92+
This eliminates the need for custom deployment dashboards or orchestration systems.
93+
94+
## Multi-Application Hosting
95+
96+
A single server hosts multiple applications. Each application runs in its own container, sharing the core infrastructure services.
97+
98+
```
99+
server
100+
├── caddy
101+
├── postgres
102+
├── redis
103+
├── minio
104+
├── uku-app
105+
├── timer-app
106+
└── lyrics-app
107+
```
108+
109+
## Domain Routing
110+
111+
Each application gets its own subdomain. Caddy routes traffic to the correct container.
112+
113+
```
114+
uku.towlion.com → uku-app container
115+
timer.towlion.com → timer-app container
116+
lyrics.towlion.com → lyrics-app container
117+
```
118+
119+
Example Caddy configuration:
120+
121+
```
122+
uku.towlion.com {
123+
reverse_proxy uku-app:8000
124+
}
125+
126+
timer.towlion.com {
127+
reverse_proxy timer-app:8000
128+
}
129+
130+
storage.towlion.com {
131+
reverse_proxy minio:9000
132+
}
133+
```
134+
135+
Caddy automatically provisions TLS certificates and redirects HTTP to HTTPS.
136+
137+
## Database Strategy
138+
139+
A single PostgreSQL instance runs on the server. Each application uses a dedicated database for logical isolation:
140+
141+
```
142+
uku_db
143+
timer_db
144+
lyrics_db
145+
```
146+
147+
## Persistent Storage
148+
149+
All persistent data is stored under `/data` on the host, ensuring data survives container redeployments.
150+
151+
```
152+
/data
153+
├── database # PostgreSQL data
154+
├── minio # Object storage
155+
├── uploads # File uploads
156+
├── logs # Application logs
157+
├── backups # Database backups
158+
└── secrets # Runtime secrets
159+
```
160+
161+
Docker containers mount these directories as volumes.
162+
163+
## Object Storage
164+
165+
MinIO provides S3-compatible object storage. Applications interact with it using the standard S3 API.
166+
167+
```
168+
S3_ENDPOINT=https://storage.example.com
169+
S3_BUCKET=uploads
170+
S3_ACCESS_KEY=app_user
171+
S3_SECRET_KEY=secret
172+
```
173+
174+
Storage data lives at `/data/minio`.
175+
176+
## Background Jobs
177+
178+
Asynchronous tasks are processed by Celery workers backed by Redis.
179+
180+
```
181+
Application → Redis queue → Celery Worker
182+
```
183+
184+
Typical use cases:
185+
186+
- Sending transactional email
187+
- Processing file uploads
188+
- Scheduled background tasks
189+
190+
Workers run as separate containers.
191+
192+
## Transactional Email
193+
194+
Email is sent via external providers (e.g., Postmark, Amazon SES). The application sends email through provider APIs, with delivery handled by Celery workers.
195+
196+
```
197+
EMAIL_PROVIDER=postmark
198+
EMAIL_API_KEY=your-api-key
199+
EMAIL_FROM=noreply@example.com
200+
```
201+
202+
## Logging and Backups
203+
204+
**Logging:** Applications write to stdout. Container logs are captured by the Docker runtime. Optionally, logs can be aggregated with Promtail, Loki, and Grafana.
205+
206+
**Backups:** Daily database backups via cron:
207+
208+
```bash
209+
pg_dump → /data/backups
210+
```
211+
212+
Backups can be synced to remote storage using `rclone`.
213+
214+
## Docker Compose Services
215+
216+
A typical deployment defines these services:
217+
218+
```yaml
219+
services:
220+
caddy:
221+
image: caddy:2
222+
app:
223+
build: ./app
224+
env_file: .env
225+
frontend:
226+
build: ./frontend
227+
postgres:
228+
image: postgres:16
229+
volumes:
230+
- /data/database:/var/lib/postgresql/data
231+
redis:
232+
image: redis
233+
celery-worker:
234+
build: ./app
235+
command: celery -A app.tasks worker
236+
minio:
237+
image: minio/minio
238+
volumes:
239+
- /data/minio:/data
240+
```

0 commit comments

Comments
 (0)