-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
162 lines (154 loc) · 4.19 KB
/
docker-compose.yml
File metadata and controls
162 lines (154 loc) · 4.19 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
services:
postgres:
image: postgres:15
environment:
POSTGRES_DB: linkedin_autopost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
environment:
- OLLAMA_SERVE_HOST=0.0.0.0
healthcheck:
# override healthcheck to ignore VRAM warning
test: ["CMD-SHELL", "curl -s http://localhost:11434/api/tags || exit 1"]
interval: 45s
timeout: 15s
retries: 5
start_period: 30s
restart: unless-stopped
app:
build:
context: .
dockerfile: Dockerfile
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
volumes:
- .:/app
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ollama:
condition: service_started # ✅ changed (don’t wait for “healthy”)
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:password@postgres:5432/linkedin_autopost
- REDIS_URL=redis://redis:6379/0
- OLLAMA_URL=http://ollama:11434
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
worker:
build:
context: .
dockerfile: Dockerfile
command: celery -A app.tasks.celery_tasks worker --loglevel=info --concurrency=2
volumes:
- .:/app
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ollama:
condition: service_started # ✅ changed
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:password@postgres:5432/linkedin_autopost
- REDIS_URL=redis://redis:6379/0
- OLLAMA_URL=http://ollama:11434
restart: unless-stopped
beat:
build:
context: .
dockerfile: Dockerfile
command: celery -A app.tasks.celery_tasks beat --loglevel=info --scheduler=celery.beat:PersistentScheduler
volumes:
- .:/app
- celerybeat_data:/app/celerybeat-schedule
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:password@postgres:5432/linkedin_autopost
- REDIS_URL=redis://redis:6379/0
- OLLAMA_URL=http://ollama:11434
restart: unless-stopped
dashboard:
build:
context: .
dockerfile: Dockerfile
command: streamlit run dashboard/streamlit_app.py --server.port 8501 --server.address 0.0.0.0 --server.headless true
volumes:
- .:/app
ports:
- "8501:8501"
depends_on:
app:
condition: service_started
env_file:
- .env
environment:
- DATABASE_URL=postgresql://postgres:password@postgres:5432/linkedin_autopost
- OLLAMA_URL=http://ollama:11434
- PYTHONPATH=/app
restart: unless-stopped
model-init:
image: ollama/ollama:latest
volumes:
- ollama_data:/root/.ollama
command: >
sh -c "
echo 'Waiting for Ollama service...' &&
until curl -s http://ollama:11434/api/tags; do
echo 'Ollama not ready, retrying in 5s...'
sleep 5
done &&
ollama pull qwen3:4b &&
echo 'Model downloaded successfully!'
"
depends_on:
ollama:
condition: service_started # ✅ changed
restart: "no"
volumes:
postgres_data:
redis_data:
ollama_data:
celerybeat_data: