This commit is contained in:
2025-10-12 20:14:46 -05:00
parent 5488537df6
commit 27980ca0a1
2 changed files with 55 additions and 77 deletions

View File

@@ -1,79 +1,40 @@
version: '3.8'
services:
# Worker für andreasknuth.de
worker-andreasknuth:
build: .
container_name: worker-andreasknuth-de
worker:
image: python:3.11-slim
container_name: email-worker-${WORKER_DOMAIN}
restart: unless-stopped
network_mode: host # Zugriff auf lokales Netzwerk für Postfix
# Worker-Code mounten
volumes:
- ./worker.py:/app/worker.py:ro
working_dir: /app
# Python Dependencies installieren und Worker starten
command: >
sh -c "pip install --no-cache-dir boto3 &&
python -u worker.py"
environment:
# ⚠️ WICHTIG: WORKER_DOMAIN muss von außen gesetzt werden!
- WORKER_DOMAIN=${WORKER_DOMAIN}
# AWS Credentials
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_REGION=eu-central-1
# Worker Identity
- WORKER_NAME=worker-andreasknuth
- WORKER_DOMAIN=andreasknuth.de
# SQS Queue (domain-spezifisch!)
- SQS_QUEUE_URL=https://sqs.eu-central-1.amazonaws.com/123456789/andreasknuth-de-queue
# Worker Settings
- POLL_INTERVAL=20
- MAX_MESSAGES=10
- VISIBILITY_TIMEOUT=300
- POLL_INTERVAL=${POLL_INTERVAL:-20}
- MAX_MESSAGES=${MAX_MESSAGES:-10}
- VISIBILITY_TIMEOUT=${VISIBILITY_TIMEOUT:-300}
# SMTP Configuration
- SMTP_HOST=192.168.1.10
- SMTP_PORT=25
- SMTP_USE_TLS=false
# Optional: SMTP Auth
# - SMTP_USER=username
# - SMTP_PASS=password
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "5"
healthcheck:
test: ["CMD", "pgrep", "-f", "worker.py"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Worker für bizmatch.net (auf demselben Server!)
worker-bizmatch:
build: .
container_name: worker-bizmatch-net
restart: unless-stopped
network_mode: host
environment:
# AWS Credentials (gleich wie oben)
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- AWS_REGION=eu-central-1
# Worker Identity (unterschiedlich!)
- WORKER_NAME=worker-bizmatch
- WORKER_DOMAIN=bizmatch.net
# SQS Queue (unterschiedlich!)
- SQS_QUEUE_URL=https://sqs.eu-central-1.amazonaws.com/123456789/bizmatch-net-queue
# Worker Settings
- POLL_INTERVAL=20
- MAX_MESSAGES=10
- VISIBILITY_TIMEOUT=300
# SMTP Configuration (gleicher Server!)
- SMTP_HOST=192.168.1.10
- SMTP_PORT=25
- SMTP_USE_TLS=false
- SMTP_HOST=${SMTP_HOST:-localhost}
- SMTP_PORT=${SMTP_PORT:-25}
- SMTP_USE_TLS=${SMTP_USE_TLS:-false}
- SMTP_USER=${SMTP_USER:-}
- SMTP_PASS=${SMTP_PASS:-}
logging:
driver: "json-file"