Refactor to async TimescaleDB backend & add Alembic migrations

This commit is contained in:
erik 2025-05-18 19:07:23 +00:00
parent d396942deb
commit c20d54d037
9 changed files with 328 additions and 99 deletions

View file

@ -5,18 +5,37 @@ services:
build: .
ports:
- "127.0.0.1:8765:8765"
depends_on:
- db
volumes:
# Mount local database file for persistence
- "./dereth.db:/app/dereth.db"
- "./main.py:/app/main.py"
- "./db.py:/app/db.py"
- "./db_async.py:/app/db_async.py"
- "./static:/app/static"
- "./alembic:/app/alembic"
- "./alembic.ini:/app/alembic.ini"
environment:
# Override database and application settings as needed
# Database connection URL for TimescaleDB
DATABASE_URL: "postgresql://postgres:password@db:5432/dereth"
# Override application settings as needed
DB_MAX_SIZE_MB: "2048"
DB_RETENTION_DAYS: "7"
DB_MAX_SQL_LENGTH: "1000000000"
DB_MAX_SQL_VARIABLES: "32766"
DB_WAL_AUTOCHECKPOINT_PAGES: "1000"
SHARED_SECRET: "your_shared_secret"
restart: unless-stopped
restart: unless-stopped
db:
image: timescale/timescaledb:latest-pg14
container_name: dereth-db
environment:
POSTGRES_DB: dereth
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- timescale-data:/var/lib/postgresql/data
ports:
- "5432:5432"
volumes:
timescale-data: