- db: cleanup_old_messages(days) purges messages older than N days in batches; recipients/reads/deliveries/reactions follow via ON DELETE CASCADE. Returns attachment file_ids no longer referenced by any surviving message (forwarded copies keep their files) and removes their image_uploads rows - server: MESSAGE_RETENTION_DAYS env var (default 0 = keep forever); hourly cleanup deletes expired messages and securely removes orphaned attachment blobs from the upload dir - schema: email_visible now defaults to 0 — previously any logged-in user who knew a UUID could read another user's email via get_profile - migrations: SQL script to apply the new default and reset the flag on existing databases (run manually, see file header) - docker-compose: document MESSAGE_RETENTION_DAYS Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
74 lines
1.8 KiB
YAML
74 lines
1.8 KiB
YAML
version: "3.9"
|
|
|
|
# Local development stack: encrypted-chat server + MySQL
|
|
# Usage:
|
|
# docker compose up — start server + db
|
|
# docker compose up --build — rebuild server image first
|
|
# docker compose down -v — stop and remove volumes (wipes DB data)
|
|
|
|
services:
|
|
db:
|
|
image: mysql:8.0
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: devpassword
|
|
MYSQL_DATABASE: encrypted_chat
|
|
MYSQL_USER: chat
|
|
MYSQL_PASSWORD: chatpassword
|
|
volumes:
|
|
# Persist DB data between restarts
|
|
- db_data:/var/lib/mysql
|
|
# Auto-import schema on first start
|
|
- ./schema.sql:/docker-entrypoint-initdb.d/01_schema.sql:ro
|
|
ports:
|
|
- "3306:3306"
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pdevpassword"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 30s
|
|
|
|
server:
|
|
build: .
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
ports:
|
|
- "5000:5000"
|
|
volumes:
|
|
- uploads:/app/uploads
|
|
environment:
|
|
# MySQL connection
|
|
MYSQL_HOST: db
|
|
MYSQL_PORT: 3306
|
|
MYSQL_USER: chat
|
|
MYSQL_PASSWORD: chatpassword
|
|
MYSQL_DATABASE: encrypted_chat
|
|
DB_POOL_SIZE: 10
|
|
|
|
# Server config
|
|
SERVER_HOST: 0.0.0.0
|
|
SERVER_PORT: 5000
|
|
UPLOAD_DIR: /app/uploads
|
|
|
|
# Dev mode: registration codes returned in response (no SMTP needed)
|
|
ENVIRONMENT: dev
|
|
|
|
# TLS: disabled by default for local dev (set TLS_ENABLED=true for prod)
|
|
TLS_ENABLED: "false"
|
|
|
|
# Logging
|
|
LOG_LEVEL: INFO
|
|
|
|
# Metadata retention (days)
|
|
METADATA_RETENTION_DAYS: 90
|
|
|
|
# Message retention (days); 0 = keep messages forever
|
|
MESSAGE_RETENTION_DAYS: 0
|
|
|
|
volumes:
|
|
db_data:
|
|
uploads:
|