Remove hardcoded credentials, harden deployment, optimize OCR

Secrets (S3 keys, PG password, DeerMapper API key) were committed in
config.yaml and .env and remain in git history. This removes them from
the tracked tree and moves all secrets to env injection.

Security:
- config.yaml: drop all credentials, keep only non-secret app tunables
- untrack .env, add .env.example template; .gitignore excludes .env
- main.py: tolerant config lookups + fail-fast validation for missing secrets
- docker-compose: env_file injection, no full-repo bind mount, debug port off
- Dockerfile: bake config into image, run as non-root user

Efficiency:
- OCR: run the second (expensive) tesseract pass only when the first
  is unparsable; identical fallback behavior

Docs:
- README with operation + security notes
- MIGRATION.md runbook: secret rotation, server cutover, decommission,
  git history purge

Note: the leaked secrets are compromised and MUST be rotated; removing
them from the tree is not sufficient. See MIGRATION.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 21:35:04 +02:00
parent 2e9ee3e014
commit 88ef0d6943
9 changed files with 318 additions and 33 deletions

View File

@@ -3,11 +3,18 @@ services:
build: .
container_name: melesicumover
restart: unless-stopped
# Secrets werden aus der lokalen .env in die Container-Umgebung injiziert.
# Die .env liegt NICHT im Image und NICHT im Git (siehe .gitignore).
env_file:
- .env
environment:
CONFIG_YAML: /app/config.yaml
DEBUG: "0"
ports:
- "5678:5678"
volumes:
- ./:/app
- ./config.yaml:/app/config.yaml:ro
# Kein Bind-Mount des Quellcodes mehr (der Code steckt im Image) und
# standardmaessig KEIN offener Debug-Port.
#
# Debugging nur bei Bedarf, lokal:
# 1) DEBUG oben auf "1" setzen
# 2) folgende Zeilen einkommentieren - bindet debugpy NUR an localhost:
# ports:
# - "127.0.0.1:5678:5678"