141 lines
3.1 KiB
YAML
141 lines
3.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
db:
|
|
image: timescale/timescaledb:latest-pg14
|
|
environment:
|
|
POSTGRES_DB: data_analysis
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: Admin@123
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
backend:
|
|
build: .
|
|
command: >
|
|
sh -c "python manage.py migrate &&
|
|
python manage.py import_csv_data --data-dir sample\ data &&
|
|
python manage.py runserver 0.0.0.0:8000"
|
|
volumes:
|
|
- .:/app
|
|
- media_volume:/app/media
|
|
- logs_volume:/app/logs
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- DEBUG=1
|
|
- DB_NAME=data_analysis
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=Admin@123
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_BROKER_URL=redis://redis:6379/1
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/api/health/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
celery:
|
|
build: .
|
|
command: celery -A dubai_analytics worker --loglevel=info
|
|
volumes:
|
|
- .:/app
|
|
- media_volume:/app/media
|
|
- logs_volume:/app/logs
|
|
environment:
|
|
- DEBUG=1
|
|
- DB_NAME=data_analysis
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=Admin@123
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_BROKER_URL=redis://redis:6379/1
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
celery-beat:
|
|
build: .
|
|
command: celery -A dubai_analytics beat --loglevel=info
|
|
volumes:
|
|
- .:/app
|
|
- media_volume:/app/media
|
|
- logs_volume:/app/logs
|
|
environment:
|
|
- DEBUG=1
|
|
- DB_NAME=data_analysis
|
|
- DB_USER=postgres
|
|
- DB_PASSWORD=Admin@123
|
|
- DB_HOST=db
|
|
- DB_PORT=5432
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_BROKER_URL=redis://redis:6379/1
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
|
|
frontend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.frontend
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
environment:
|
|
- VITE_API_BASE_URL=http://localhost:8000/api/v1
|
|
depends_on:
|
|
- backend
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf
|
|
- ./ssl:/etc/nginx/ssl
|
|
depends_on:
|
|
- backend
|
|
- frontend
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
media_volume:
|
|
logs_volume:
|
|
|