Files
lego-instructions-manager/.env.docker.example
T
jessikitty 89f65e2d74 Add automatic instruction fetcher for official sets
Downloads official instruction PDFs from LEGO, located via the Brickset API, one set per interval (10 minutes by default) so neither API gets hammered. Official sets only; MOCs are excluded throughout.

- New admin page at /admin/instruction-fetch: queue builder, pacing controls, live countdown and per-set job history

- Database-backed queue (instruction_fetch_jobs) and last-run timestamp, so pacing survives restarts

- Background worker thread, plus 'flask instructions queue/run/status' for Task Scheduler or cron

- SHA-256 dedupe (instructions.sha256), PDF header check, size cap and streaming downloads via temp files

- brickset_api: getInstructions2 by set number and getInstructions by setID (the old code sent a set number to the setID method); getSets params now proper JSON; getKeyUsageStats added

- Schema top-ups applied automatically at boot: new table plus instructions.sha256/source

- Docker: fetcher env vars passed through compose, no worker thread in the entrypoint bootstrap
2026-09-26 13:43:17 +10:00

37 lines
1.3 KiB
Bash

# Copy to .env beside docker-compose.yml and fill in.
# cp .env.docker.example .env
# --- required ---------------------------------------------------------------
# Generate with: python -c "import secrets; print(secrets.token_hex(32))"
SECRET_KEY=
# Any long random string; only the db and app containers ever see it.
POSTGRES_PASSWORD=
# --- database ---------------------------------------------------------------
POSTGRES_DB=lim
POSTGRES_USER=lim
# --- app --------------------------------------------------------------------
# Host port the web UI is published on.
LIM_PORT=8000
# Backup archives to retain after a UI-initiated backup (0 = keep all).
BACKUP_KEEP=7
# Max upload size in bytes (default 50MB).
MAX_CONTENT_LENGTH=52428800
SETS_PER_PAGE=20
# --- Brickset (optional) ----------------------------------------------------
BRICKSET_API_KEY=
BRICKSET_USERNAME=
BRICKSET_PASSWORD=
# --- instruction fetcher (optional) -----------------------------------------
# Pacing (interval, delays, on/off) is set in the admin UI, not here.
# Leave the worker on unless you scale the app container past one replica or
# drive the queue yourself with `docker compose exec app flask instructions run`.
INSTRUCTION_FETCH_WORKER=1
INSTRUCTION_FETCH_TICK_SECONDS=20
# Largest instruction PDF to accept, in megabytes.
FETCH_MAX_FILE_MB=150
FETCH_TIMEOUT_SECONDS=60