137 lines
3.4 KiB
YAML
137 lines
3.4 KiB
YAML
# INOWYA Location History Analyzer - Docker Compose
|
|
# Complete self-hosted deployment for location data analysis
|
|
|
|
version: '3.8'
|
|
|
|
services:
|
|
# Database: PostgreSQL with PostGIS extension
|
|
postgres:
|
|
image: postgis/postgis:15-3.4
|
|
container_name: inowya_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: inowya
|
|
POSTGRES_USER: inowya
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-inowya123}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./database:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- '5432:5432'
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U inowya -d inowya']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Cache & Session store: Redis
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: inowya_redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- '6379:6379'
|
|
healthcheck:
|
|
test: ['CMD', 'redis-cli', 'ping']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Map Tile Server: OpenMapTiles (self-hosted vector tiles)
|
|
tileserver:
|
|
image: overv/openmaptiles-server:latest
|
|
container_name: inowya_tileserver
|
|
restart: unless-stopped
|
|
ports:
|
|
- '8080:80'
|
|
volumes:
|
|
- ./maptiles:/data # Mount your downloaded tiles here
|
|
environment:
|
|
- MBTILES=/data/openmaptiles.mbtiles # Example
|
|
healthcheck:
|
|
test: ['CMD', 'curl', '-f', 'http://localhost/health']
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Backend API: FastAPI server
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: inowya_backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
environment:
|
|
- DATABASE_URL=postgresql://inowya:${DB_PASSWORD:-inowya123}@postgres:5432/inowya
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_BROKER_URL=redis://redis:6379/0
|
|
- SECRET_KEY=${SECRET_KEY:-your-secret-key-here}
|
|
volumes:
|
|
- ./backend:/app
|
|
ports:
|
|
- '8000:8000'
|
|
healthcheck:
|
|
test: ['CMD', 'curl', '-f', 'http://localhost:8000/health']
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
# Worker processes: Celery for async tasks (ingestion, ML, etc.)
|
|
worker:
|
|
build:
|
|
context: ./workers
|
|
dockerfile: Dockerfile
|
|
container_name: inowya_worker
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- backend
|
|
- postgres
|
|
- redis
|
|
environment:
|
|
- DATABASE_URL=postgresql://inowya:${DB_PASSWORD:-inowya123}@postgres:5432/inowya
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_BROKER_URL=redis://redis:6379/0
|
|
volumes:
|
|
- ./workers:/app
|
|
- ./uploads:/app/uploads # For file processing
|
|
command: celery -A celery_app worker --loglevel=info --concurrency=4
|
|
|
|
# Frontend: React PWA
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: inowya_frontend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- backend
|
|
environment:
|
|
- REACT_APP_API_URL=http://localhost:8000
|
|
- REACT_APP_TILE_URL=http://localhost:8080
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
ports:
|
|
- '3000:3000' # Development
|
|
- '8080:80' # Production (nginx)
|
|
|
|
# Reverse proxy (optional for HTTPS)
|
|
# nginx:
|
|
# image: nginx:alpine
|
|
# ...
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
default:
|
|
driver: bridge |