-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
133 lines (126 loc) · 4.12 KB
/
docker-compose.yml
File metadata and controls
133 lines (126 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:14-alpine
container_name: lazy-bird-postgres
restart: unless-stopped
environment:
POSTGRES_DB: lazy_bird
POSTGRES_USER: lazy_bird
POSTGRES_PASSWORD: ${DB_PASSWORD:-lazy_bird_dev_password_change_me}
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=en_US.UTF-8"
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lazy_bird -d lazy_bird"]
interval: 10s
timeout: 5s
retries: 5
networks:
- lazy-bird-network
# Redis (for Celery and caching)
redis:
image: redis:7-alpine
container_name: lazy-bird-redis
restart: unless-stopped
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-redis_dev_password_change_me}
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- lazy-bird-network
# FastAPI Application (v2.0)
api:
build:
context: .
dockerfile: Dockerfile
container_name: lazy-bird-api
restart: unless-stopped
command: uvicorn lazy_bird.api.main:app --host 0.0.0.0 --port 8000 --reload
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://lazy_bird:${DB_PASSWORD:-lazy_bird_dev_password_change_me}@postgres:5432/lazy_bird
- REDIS_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_BROKER_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_RESULT_BACKEND=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/1
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production}
- ENVIRONMENT=development
- DEBUG=true
volumes:
- .:/app
- git_repos:/var/lib/lazy_bird/repos
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- lazy-bird-network
# Celery Worker
worker:
build:
context: .
dockerfile: Dockerfile
container_name: lazy-bird-worker
restart: unless-stopped
command: celery -A lazy_bird.tasks worker --loglevel=info --concurrency=4
environment:
- DATABASE_URL=postgresql://lazy_bird:${DB_PASSWORD:-lazy_bird_dev_password_change_me}@postgres:5432/lazy_bird
- REDIS_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_BROKER_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_RESULT_BACKEND=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/1
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production}
volumes:
- .:/app
- git_repos:/var/lib/lazy_bird/repos
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- lazy-bird-network
# Celery Beat (Scheduler)
beat:
build:
context: .
dockerfile: Dockerfile
container_name: lazy-bird-beat
restart: unless-stopped
command: celery -A lazy_bird.tasks beat --loglevel=info
environment:
- DATABASE_URL=postgresql://lazy_bird:${DB_PASSWORD:-lazy_bird_dev_password_change_me}@postgres:5432/lazy_bird
- REDIS_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_BROKER_URL=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/0
- CELERY_RESULT_BACKEND=redis://:${REDIS_PASSWORD:-redis_dev_password_change_me}@redis:6379/1
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-change-in-production}
volumes:
- .:/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- lazy-bird-network
networks:
lazy-bird-network:
driver: bridge
volumes:
postgres_data:
driver: local
redis_data:
driver: local
git_repos:
driver: local