# Queensway Europe Telco Portal - Docker The Docker stack contains two services: - `telcoportal` - the Flask web application - `db` - PostgreSQL 16, stored in a persistent Docker volume ## First start and SQLite import 1. Put the existing SQLite database at `data/telco.db` next to `docker-compose.yml`. 2. Optionally set a database password in a `.env` file: ```env TELCO_DB_PASSWORD=replace-with-a-long-random-password ``` 3. Build and start the stack: ```powershell docker compose up -d --build ``` 4. Open . Before the web server starts, `migrate_sqlite.py` creates the PostgreSQL schema and copies all rows from `users`, `phones`, and `internet_connections`. IDs, password hashes, dates, comments, and timestamps are retained. The import runs only while PostgreSQL has no application rows; all later starts skip it without changing existing data. If `data/telco.db` is missing on the first start, the app exits instead of creating an empty production database. Check the reason with `docker compose logs telcoportal`. After a successful import, the SQLite file is no longer used by the application. Keep an offline backup until the migrated data has been checked. ## Persistent data and backups PostgreSQL stores its files in the Docker named volume `telco-db-data`. Rebuilding or replacing the containers does not delete this volume. The generated Flask session key is kept separately in `telco-app-data`. Create a portable SQL backup: ```powershell docker compose exec -T db pg_dump -U telco -d telco -Fc > telco-backup.dump ``` `docker compose down` keeps both volumes. Do **not** use `docker compose down -v` unless you intend to delete the PostgreSQL database and application state. ## Common commands ```powershell docker compose ps docker compose logs -f telcoportal docker compose logs -f db docker compose down docker compose up -d docker compose up -d --build ``` To use another web port, change `"8092:8000"` in `docker-compose.yml` and recreate the stack.