This commit is contained in:
2025-11-11 14:09:21 +01:00
parent bcd0a10576
commit 1075a91eac
57 changed files with 5598 additions and 1366 deletions

View File

@@ -1,24 +1,106 @@
version: '3.8'
services:
# MongoDB Database
mongodb:
image: mongo:7.0
image: mongo:latest
container_name: munich-news-mongodb
restart: unless-stopped
ports:
- "27017:27017"
# For development: MongoDB runs without authentication
# For production: Uncomment the environment variables below and update MONGODB_URI
# environment:
# MONGO_INITDB_ROOT_USERNAME: admin
# MONGO_INITDB_ROOT_PASSWORD: password
# MONGO_INITDB_DATABASE: munich_news
environment:
# For production, set MONGO_PASSWORD environment variable
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME:-admin}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD:-changeme}
MONGO_INITDB_DATABASE: munich_news
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
networks:
- munich-news-network
command: mongod --bind_ip_all
command: mongod --bind_ip_all ${MONGO_AUTH:---auth}
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
timeout: 10s
retries: 3
# News Crawler - Runs at 6 AM Berlin time
crawler:
build:
context: .
dockerfile: news_crawler/Dockerfile
container_name: munich-news-crawler
restart: unless-stopped
depends_on:
- mongodb
environment:
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
- TZ=Europe/Berlin
volumes:
- ./backend/.env:/app/.env:ro
- ./backend/config.py:/app/config.py:ro
- ./backend/ollama_client.py:/app/ollama_client.py:ro
- ./news_crawler:/app:ro
networks:
- munich-news-network
healthcheck:
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
interval: 1m
timeout: 10s
retries: 3
# Backend API - Tracking and analytics
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: munich-news-backend
restart: unless-stopped
depends_on:
- mongodb
ports:
- "5001:5001"
environment:
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
- FLASK_PORT=5001
- TZ=Europe/Berlin
volumes:
- ./backend/.env:/app/.env:ro
networks:
- munich-news-network
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5001/health')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Newsletter Sender - Runs at 7 AM Berlin time
sender:
build:
context: .
dockerfile: news_sender/Dockerfile
container_name: munich-news-sender
restart: unless-stopped
depends_on:
- mongodb
- backend
- crawler
environment:
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
- TZ=Europe/Berlin
volumes:
- ./backend/.env:/app/.env:ro
- ./backend/services:/app/backend/services:ro
- ./news_sender:/app:ro
networks:
- munich-news-network
healthcheck:
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
interval: 1m
timeout: 10s
retries: 3
volumes:
mongodb_data:
@@ -29,4 +111,3 @@ volumes:
networks:
munich-news-network:
driver: bridge