Add persistent PostgreSQL stack and SQLite migration

This commit is contained in:
2026-09-23 10:17:18 +02:00
parent 919df2220e
commit 52bd2a0607
8 changed files with 214 additions and 70 deletions
+9 -9
View File
@@ -6,9 +6,8 @@ Management web portal for:
eligibility, current owner, venue)
- Internet connectivity at each restaurant venue
Same deployment approach as TostaSklad/TostaPortal: a Docker container you run locally on this
PC with Docker Desktop, with all data kept in a bind-mounted folder outside the container. See
`README-Docker.md` for how to start/stop it.
The production Docker stack runs the app with PostgreSQL and retains its database in a named
Docker volume. See `README-Docker.md` for the initial SQLite import, startup, and backup steps.
## Folder layout
@@ -18,8 +17,8 @@ QWE Telco/
README-Docker.md <- Docker instructions (start here)
TelcoPortal-README.md <- this file
TelcoPortal-source/ <- Flask app source (rebuilt into the Docker image)
TelcoPortal-data/
telco.db <- the SQLite database (both tables live in this one file)
data/
telco.db <- legacy SQLite file, used for the first import only
```
## Data model
@@ -31,13 +30,13 @@ Replacement, Current Owner, Venue.
Expiration, Notes. This table starts empty - the source Excel file only had mobile phone data -
add rows with the "+ Add Connection" button on the Internet Connectivity page as you go.
There is no login. Anyone who can reach the URL (`http://localhost:8092/` by default) can view
and edit both tables.
The portal is available at `http://localhost:8092/` by default and requires a configured user
login.
## How the mobile phone data was loaded
The one-off migration script `TelcoPortal-source/import_excel.py` reads the source Excel file
(`Mobilne telefony 20260901.xlsx`) and loads it into `TelcoPortal-data/telco.db`. This has
(`Mobilne telefony 20260901.xlsx`) and loads it into the legacy SQLite database. This has
**already been run once** to populate the database - the Excel file is not needed by the running
app and can be archived/deleted.
@@ -77,4 +76,5 @@ the Edit button in the portal itself.
## Backups
Copy or zip `TelcoPortal-data/telco.db` any time - that single file is the entire database.
The production database is PostgreSQL. Use the `pg_dump` command documented in
`README-Docker.md` to create a portable backup.