-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
123 lines (117 loc) · 3.36 KB
/
Copy pathdocker-compose.yml
File metadata and controls
123 lines (117 loc) · 3.36 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
services:
redis:
image: redis:7-alpine
container_name: video_analytics_redis
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis_data:/data
networks:
- app-network
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: unless-stopped
postgres:
image: postgres:16-alpine
container_name: video_analytics_db
environment:
POSTGRES_USER: ${POSTGRES_ADMIN_USER:-admin}
POSTGRES_PASSWORD: ${POSTGRES_ADMIN_PASSWORD:-admin_password}
POSTGRES_DB: ${POSTGRES_DB:-video_analytics}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_ADMIN_USER:-admin} -d ${POSTGRES_DB:-video_analytics}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- app-network
migrations:
build: .
container_name: migrations
environment:
POSTGRES_ADMIN_USER: ${POSTGRES_ADMIN_USER:-admin}
POSTGRES_ADMIN_PASSWORD: ${POSTGRES_ADMIN_PASSWORD:-admin_password}
POSTGRES_DB: ${POSTGRES_DB:-video_analytics}
POSTGRES_HOST: postgres
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
depends_on:
postgres:
condition: service_healthy
volumes:
- ./data:/app/data
networks:
- app-network
command: >
sh -c "
echo 'Running migrations...' &&
alembic upgrade head &&
echo 'Migrations completed!'
"
restart: "no"
data-loader:
build: .
container_name: data_loader
environment:
POSTGRES_ADMIN_USER: ${POSTGRES_ADMIN_USER:-admin}
POSTGRES_ADMIN_PASSWORD: ${POSTGRES_ADMIN_PASSWORD:-admin_password}
POSTGRES_DB: ${POSTGRES_DB:-video_analytics}
POSTGRES_HOST: postgres
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
depends_on:
postgres:
condition: service_healthy
migrations:
condition: service_completed_successfully
volumes:
- ./data:/app/data
networks:
- app-network
command: >
sh -c "
if [ -f /app/data/videos.json ]; then
echo 'Loading data from videos.json...' &&
python -m scripts.load_data &&
echo 'Data loaded successfully!';
else
echo 'WARNING: /app/data/videos.json not found. Skipping data load.';
fi
"
restart: "no"
bot:
build: .
container_name: video_analytics_bot
environment:
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
POSTGRES_READONLY_USER: ${POSTGRES_READONLY_USER:-readonly_user}
POSTGRES_READONLY_PASSWORD: ${POSTGRES_READONLY_PASSWORD:-readonly_password}
POSTGRES_DB: ${POSTGRES_DB:-video_analytics}
POSTGRES_HOST: postgres
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
OLLAMA_BASE_URL: https://ollama.com
OLLAMA_MODEL: ${OLLAMA_MODEL:-qwen3-coder:480b-cloud}
OLLAMA_API_KEY: ${OLLAMA_API_KEY}
depends_on:
postgres:
condition: service_healthy
migrations:
condition: service_completed_successfully
data-loader:
condition: service_completed_successfully
networks:
- app-network
restart: unless-stopped
volumes:
postgres_data:
redis_data:
networks:
app-network:
driver: bridge