-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
74 lines (70 loc) · 2.16 KB
/
Copy pathdocker-compose.yml
File metadata and controls
74 lines (70 loc) · 2.16 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
services:
postgres:
container_name: topicstreams-postgres
image: postgres:18-alpine
env_file:
- .env
volumes:
- postgres_data:/var/lib/postgresql
- ./postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:?Missing .env: copy .env.example to .env before starting} -d ${POSTGRES_DB:?Missing .env: copy .env.example to .env before starting}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- topicstreams-network
api:
container_name: topicstreams-api
build:
context: .
target: api
env_file:
- .env
ports:
- "${HOST_PORT:-80}:${API_PORT:?Missing .env: copy .env.example to .env before starting}"
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
# /status exercises the API and the DB, so a 200 means both are healthy.
# python (no curl in the slim image) raises on non-2xx -> unhealthy.
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:${API_PORT}/api/v1/status', timeout=5)"]
interval: 30s
timeout: 8s
retries: 3
start_period: 20s
networks:
- topicstreams-network
# No platform pin: the scraper must run on the host's native architecture.
# Under amd64 emulation (Rosetta 2 on Apple Silicon) Google's bot detection
# CAPTCHAs every /search request (verified 2026-06-11).
scraper:
container_name: topicstreams-scraper
build:
context: .
target: scraper
env_file:
- .env
volumes:
- browser_profiles:/app/.browser_profiles
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
# Cap the scraper so a Chromium memory leak gets cgroup-OOM-killed (and
# restarted) instead of taking down the whole host (postmortem 2026-06-13).
mem_limit: 1500m
memswap_limit: 1500m
networks:
- topicstreams-network
volumes:
postgres_data:
driver: local
browser_profiles:
driver: local
networks:
topicstreams-network:
driver: bridge