-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
126 lines (118 loc) · 3.09 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
126 lines (118 loc) · 3.09 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
# schedule-vvsu production
# ===========================
# Стек:
# - Postgres – БД
# - Selenium-Firefox – headless браузер для парсинга
# - schedule-sync – планировщик/парсер
# - schedule-api – FastAPI + SPA
# - schedule-bot – Telegram-бот
# - Caddy – HTTPS-reverse-proxy
#
# Все образы собираются из production-Dockerfile (`Dockerfile`).
# Настройки передаются через корневой `.env`.
services:
# Postgres
postgres:
image: postgres:16-alpine
container_name: vvsu-postgres
env_file: .env
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
networks: [selenium_net]
ports:
- "127.0.0.1:5432:5432"
# Selenium
selenium:
image: selenium/standalone-firefox:137.0.1
container_name: vvsu-selenium
shm_size: 2gb
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
networks: [selenium_net]
# Планировщик / синхронизация
schedule-sync:
build:
context: .
dockerfile: Dockerfile
image: vvsu-schedule-sync:1.0.0
container_name: vvsu-schedule-sync
env_file: .env
depends_on:
postgres:
condition: service_healthy
selenium:
condition: service_healthy
command: >
poetry run alembic upgrade head &&
poetry run python -m schedule_vvsu.scheduler
volumes:
- logs:/app/src/schedule_vvsu/logs
networks: [selenium_net]
# Backend API
schedule-api:
build:
context: .
dockerfile: Dockerfile
image: vvsu-schedule-api:1.0.0
container_name: vvsu-schedule-api
env_file: .env
depends_on:
postgres:
condition: service_healthy
selenium:
condition: service_healthy
command: >
poetry run uvicorn schedule_vvsu.api:app
--host 0.0.0.0 --port 8000
expose: ["8000"]
volumes:
- logs:/app/src/schedule_vvsu/logs
networks: [selenium_net]
# Telegram-бот
schedule-bot:
build:
context: .
dockerfile: src/tg_bot/Dockerfile
image: vvsu-schedule-bot:1.0.0
container_name: vvsu-schedule-bot
env_file: .env
depends_on:
- schedule-api
command: poetry run python -m app.bot
networks: [selenium_net]
# Reverse-proxy
caddy:
image: caddy:2
container_name: vvsu-caddy
depends_on:
- schedule-api
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
networks: [selenium_net]
# volumes & networks
volumes:
pgdata:
logs:
caddy_data:
caddy_config:
networks:
selenium_net:
driver: bridge