Deployment scripts

This commit is contained in:
2026-04-29 23:53:51 +12:00
parent 5cb95266d8
commit 373f7c47c0
17 changed files with 1092 additions and 13 deletions
+51
View File
@@ -7,8 +7,59 @@ Initial MVP implementation of the costing platform described in `CLAUDE.MD`.
```text
backend/ FastAPI API, SQLAlchemy models, costing engine, seed data, tests
frontend/ SvelteKit UI scaffold for dashboard and core modules
deploy/ nginx config and Docker deployment assets
```
## Docker Alpha Deployment
This repo now includes a production-oriented Docker setup for an alpha release:
- `backend/Dockerfile`
- `frontend/Dockerfile`
- `docker-compose.yml`
- `docker-compose.alpha.yml`
- `deploy/nginx/clients.lean-101.conf`
- `deploy/nginx/clients.lean-101.proxy.conf`
- `.env.alpha.example`
The compose stack runs three services:
- `backend` on internal port `8000`
- `frontend` on internal port `3000`
- `nginx` on host port `8081` by default
`nginx` routes:
- `/api/*`, `/docs`, `/openapi.json`, `/health` to the FastAPI backend
- everything else to the Svelte frontend
### Browser vs server API base URLs
The frontend now supports:
- `PUBLIC_API_BASE_URL` for browser requests
- `INTERNAL_API_BASE_URL` for server-side SvelteKit requests inside Docker
This is important for a same-domain deployment such as `https://clients.lean-101.com`, where the browser should call the public domain while the frontend container should call the backend container directly.
### Example `/srv` deploy
```bash
mkdir -p /srv/lean101-clients
cd /srv/lean101-clients
git clone <this-repo> .
cp .env.alpha.example .env.alpha
docker compose --env-file .env.alpha up -d --build
```
This follows the same external pattern as your website container:
- one compose project under `/srv/lean101-clients`
- one host-facing port, `8081`, for the app
- your existing public reverse proxy forwards `clients.lean-101.com` to `127.0.0.1:8081`
If your server already has a host-level nginx handling domains and TLS, use `deploy/nginx/clients.lean-101.proxy.conf` as the upstream template and point the domain at `http://127.0.0.1:8081`.
## Backend
Create a virtual environment, install dependencies, then run: