Deployment fixes, add HPP logo

This commit is contained in:
2026-05-04 22:21:07 +12:00
parent 2799946091
commit ebee72d4df
24 changed files with 768 additions and 45 deletions
+34
View File
@@ -60,6 +60,40 @@ This follows the same external pattern as your website container:
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`.
## Production deployment (Postgres + Digital Ocean)
`docker-compose.production.yml` provisions a managed-style stack with a containerised Postgres 16 service replacing the SQLite file used in alpha. The PowerShell script `deploy/Deploy.ps1` drives both first-time bootstrap and incremental updates from a Windows workstation against a Digital Ocean droplet.
1. **One-time droplet prep**: install Docker Engine + the compose plugin (`apt install docker.io docker-compose-plugin` or the official Docker repo). Open inbound 80/443 on your reverse proxy and forward to `127.0.0.1:${CLIENTS_APP_PORT}` (default 8081).
2. **Local secrets**: copy the example env and fill in real secrets — strong `POSTGRES_PASSWORD`, `AUTH_SECRET`, `CLIENT_PASSWORD`, `ADMIN_PASSWORD`. The compose file refuses to start without them.
```powershell
Copy-Item .env.production.example .env.production
notepad .env.production
```
3. **First deploy** (clones the repo on the droplet, uploads the env file, brings the stack up):
```powershell
./deploy/Deploy.ps1 `
-RemoteHost 203.0.113.10 `
-Bootstrap `
-RepoUrl git@github.com:ponzischeme89/data-entry-app.git `
-Seed
```
4. **Subsequent updates** (the same script — pulls latest `main`, rebuilds, and rolls containers without touching the Postgres volume):
```powershell
./deploy/Deploy.ps1 -RemoteHost 203.0.113.10
```
Useful flags: `-Branch <name>` to deploy a feature branch, `-SkipBuild` for env-only changes, `-Seed` to re-run reference data seeding, `-Logs` to tail logs after the deploy, `-SshKey` to point at a specific private key.
5. **Database**: the backend reads `DATABASE_URL`. The production compose file synthesises it as `postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}` so you only need to set the three `POSTGRES_*` vars. Override `DATABASE_URL` directly if you point at a managed Postgres (e.g. DigitalOcean managed databases).
The schema is auto-managed — `app/db/migrations.py` runs at backend startup and is idempotent across SQLite and Postgres. To migrate alpha SQLite data into the new Postgres instance, dump tables to CSV from the alpha container and import via `\copy` in `psql`; there is no automatic SQLite → Postgres path.
## Backend
Create a virtual environment, install dependencies, then run: