tweaks
This commit is contained in:
@@ -90,10 +90,17 @@ If your server already has a host-level nginx handling domains and TLS, use `dep
|
||||
|
||||
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.
|
||||
|
||||
If a release adds or changes database-backed workbook formula structures, deploy with `-Seed` so the server refreshes seeded reference/formula data after the backend starts. For the product-formula change, this is required so Postgres receives the new `product_ingredients` rows sourced from `input_data/1.xlsx`.
|
||||
|
||||
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.
|
||||
|
||||
For this repo’s current schema, new tables such as `product_ingredients` are created automatically on backend startup in both SQLite and Postgres. Existing data refreshes still depend on seeding, so schema deployment and data deployment are separate concerns:
|
||||
|
||||
- backend startup creates missing tables/columns
|
||||
- `-Seed` repopulates workbook-driven rows inside those tables
|
||||
|
||||
## Backend
|
||||
|
||||
Create a virtual environment, install dependencies, then run:
|
||||
@@ -116,6 +123,20 @@ pytest
|
||||
The backend defaults to SQLite for the prototype and can be switched with the
|
||||
`DATABASE_URL` environment variable.
|
||||
|
||||
For local non-Docker runs, the default SQLite database is
|
||||
`backend/data_entry_app.db` regardless of which directory you launch the
|
||||
backend from. This avoids accidentally creating multiple local SQLite files
|
||||
with different login data.
|
||||
|
||||
The internal login screen at `/` uses the seeded Hunter Stock Feeds users:
|
||||
|
||||
- `admin@hunterstockfeeds.com`
|
||||
- `ops@hunterstockfeeds.com`
|
||||
- `craig@hunterstockfeeds.com`
|
||||
|
||||
Unless you override `ADMIN_PASSWORD` before the first seed, those local
|
||||
internal users are seeded with the default password `lean101-admin`.
|
||||
|
||||
### Backend logging
|
||||
|
||||
The backend now uses a shared console logger with a styled startup banner, concise request logs, and clean shutdown summaries.
|
||||
|
||||
Reference in New Issue
Block a user