fe32c32726
Co-authored-by: Copilot <copilot@github.com>
76 lines
4.1 KiB
Markdown
76 lines
4.1 KiB
Markdown
# 7. Deployment View
|
|
|
|
Describes:
|
|
|
|
1. Technical infrastructure used to execute your system, with infrastructure elements like geographical locations, environments, computers, processors, channels and net topologies.
|
|
2. Mapping of (software) building blocks to that infrastructure elements.
|
|
|
|
## Infrastructure Level 1
|
|
|
|
```text
|
|
┌────────────────────────────────────────────┐
|
|
│ Host / VM │
|
|
│ ┌─────────────┐ ┌────────────────────┐ │
|
|
│ │ frontend │ │ backend │ │
|
|
│ │ (Flask) │ │ (FastAPI) │ │
|
|
│ │ :12016 │ │ :12015 │ │
|
|
│ └──────┬──────┘ └─────────┬──────────┘ │
|
|
│ │ │ │
|
|
│ └────────┬──────────┘ │
|
|
│ │ │
|
|
│ ┌───────▼────────┐ │
|
|
│ │ db (DuckDB) │ │
|
|
│ │ data/app.db │ │
|
|
│ └────────────────┘ │
|
|
└────────────────────────────────────────────┘
|
|
```
|
|
|
|
**Motivation:** All three components run on a single VM (or as Docker containers) for simplicity and low operational overhead.
|
|
|
|
**Quality and/or Performance Features:** The frontend and backend are stateless; DuckDB persists data on the host filesystem.
|
|
|
|
**Mapping of Building Blocks to Infrastructure:**
|
|
|
|
| Building Block | Container / Process | Port |
|
|
| --------------- | ---------------------------- | ----- |
|
|
| Flask frontend | `frontend` | 12016 |
|
|
| FastAPI backend | `backend` | 12015 |
|
|
| DuckDB | File on host (`data/app.db`) | — |
|
|
|
|
## Infrastructure Level 2
|
|
|
|
### Coolify with Nixpacks (Production)
|
|
|
|
Both services are deployed as separate Nixpacks resources in Coolify:
|
|
|
|
```text
|
|
┌──────────────────────────────────────────────────────────┐
|
|
│ Coolify Server │
|
|
│ ┌────────────────────────────┐ │
|
|
│ │ Backend Service (FastAPI) │ │
|
|
│ │ - Base Dir: /backend │ │
|
|
│ │ - Port: 12015 │ │
|
|
│ │ - Volume: /app/data │ │
|
|
│ ├────────────────────────────┤ │
|
|
│ │ Frontend Service (Flask) │ │
|
|
│ │ - Base Dir: /frontend │ │
|
|
│ │ - Port: 12016 (public) │ │
|
|
│ │ - BACKEND_URL: :12015 │ │
|
|
│ └────────────────────────────┘ │
|
|
│ ▲ │
|
|
│ Coolify reverse proxy (TLS termination) │
|
|
└──────────────────────────────────────────────────────────┘
|
|
│
|
|
Users / Internet
|
|
```
|
|
|
|
**Deployment Steps:**
|
|
|
|
1. Create backend Nixpacks service in Coolify with Base Directory `/backend`
|
|
2. Create frontend Nixpacks service with Base Directory `/frontend`
|
|
3. Set environment variables per service
|
|
4. Attach domain to frontend on port `12016`
|
|
5. Enable Auto HTTPS in Coolify
|
|
|
|
**See**: [Coolify Deployment Guide](./deployment/coolify.md) for detailed instructions.
|