update
This commit is contained in:
225
docker-compose.local.yml
Normal file
225
docker-compose.local.yml
Normal file
@@ -0,0 +1,225 @@
|
||||
services:
|
||||
# Ollama AI Service (Exposed for local testing)
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
container_name: munich-news-local-ollama
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "11434:11434" # Exposed for local testing
|
||||
volumes:
|
||||
- ollama_data_local:/root/.ollama
|
||||
networks:
|
||||
- munich-news-network
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 1.1.1.1
|
||||
# GPU support (uncomment if you have NVIDIA GPU)
|
||||
# deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - driver: nvidia
|
||||
# count: all
|
||||
# capabilities: [gpu]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "ollama list || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
# Ollama Model Loader - Pulls phi3:latest (smaller model for local dev)
|
||||
ollama-setup:
|
||||
image: curlimages/curl:latest
|
||||
container_name: munich-news-local-ollama-setup
|
||||
depends_on:
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- munich-news-network
|
||||
env_file:
|
||||
- backend/.env.local
|
||||
volumes:
|
||||
- ./scripts/setup-ollama-model.sh:/setup-ollama-model.sh:ro
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 1.1.1.1
|
||||
command: sh /setup-ollama-model.sh
|
||||
restart: on-failure
|
||||
|
||||
# Redis - Message queue for async tasks (Internal only - not exposed to host)
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: munich-news-local-redis
|
||||
restart: unless-stopped
|
||||
# No ports exposed - only accessible within Docker network
|
||||
networks:
|
||||
- munich-news-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# MongoDB Database (Exposed for local debugging)
|
||||
mongodb:
|
||||
image: mongo:latest
|
||||
container_name: munich-news-local-mongodb
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "27017:27017" # Exposed for local debugging
|
||||
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_local:/data/db
|
||||
- mongodb_config_local:/data/configdb
|
||||
networks:
|
||||
- munich-news-network
|
||||
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-local-crawler
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- mongodb
|
||||
- ollama
|
||||
- redis
|
||||
environment:
|
||||
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- TZ=Europe/Berlin
|
||||
volumes:
|
||||
- ./backend/.env.local:/app/.env: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-local-backend
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- mongodb
|
||||
- redis
|
||||
ports:
|
||||
- "5001:5001"
|
||||
environment:
|
||||
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- FLASK_PORT=5001
|
||||
- TZ=Europe/Berlin
|
||||
volumes:
|
||||
- ./backend/.env.local:/app/.env:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock: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
|
||||
|
||||
# Transport Crawler - API service for MVG disruptions (Internal only - not exposed to host)
|
||||
transport-crawler:
|
||||
build:
|
||||
context: ./transport_crawler
|
||||
dockerfile: Dockerfile
|
||||
container_name: munich-news-local-transport-crawler
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- mongodb
|
||||
- redis
|
||||
# No ports exposed - only accessible within Docker network
|
||||
environment:
|
||||
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- TZ=Europe/Berlin
|
||||
volumes:
|
||||
- ./backend/.env.local:/app/.env:ro
|
||||
networks:
|
||||
- munich-news-network
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5002/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-local-sender
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- mongodb
|
||||
- backend
|
||||
- crawler
|
||||
- transport-crawler
|
||||
environment:
|
||||
- MONGODB_URI=mongodb://${MONGO_USERNAME:-admin}:${MONGO_PASSWORD:-changeme}@mongodb:27017/
|
||||
- TZ=Europe/Berlin
|
||||
volumes:
|
||||
- ./backend/.env.local:/app/.env:ro
|
||||
networks:
|
||||
- munich-news-network
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c", "import sys; sys.exit(0)"]
|
||||
interval: 1m
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Frontend Web Interface
|
||||
frontend:
|
||||
build: ./frontend
|
||||
container_name: munich-news-local-frontend
|
||||
restart: unless-stopped
|
||||
# ports:
|
||||
# - "3000:3000"
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- API_URL=http://backend:5001
|
||||
- PORT=3000
|
||||
depends_on:
|
||||
- backend
|
||||
networks:
|
||||
- munich-news-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
volumes:
|
||||
mongodb_data_local:
|
||||
driver: local
|
||||
mongodb_config_local:
|
||||
driver: local
|
||||
ollama_data_local:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
munich-news-network:
|
||||
internal: false
|
||||
Reference in New Issue
Block a user