-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
docker-compose.yml
111 lines (102 loc) · 2.76 KB
/
docker-compose.yml
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
x-api-common: &api-common
image: ghcr.io/openfoodfacts/open-prices/api:${TAG:-dev}
restart: $RESTART_POLICY
environment:
- ENVIRONMENT
- POSTGRES_DB
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_HOST
- POSTGRES_PORT
- SECRET_KEY
- DEBUG
- ALLOWED_HOSTS
- CSRF_TRUSTED_ORIGINS
- OAUTH2_SERVER_URL
- SENTRY_DSN
- LOG_LEVEL
- GOOGLE_CLOUD_VISION_API_KEY
- GOOGLE_GEMINI_API_KEY
- TRITON_URI
- ENABLE_ML_PREDICTIONS
- ENABLE_REDIS_UPDATES
- REDIS_HOST
- REDIS_PORT
- REDIS_STREAM_NAME
- REDIS_LATEST_ID_KEY
networks:
- default
- common_net
services:
api:
<<: *api-common
volumes:
- images:/opt/open-prices/img
- data-dump:/opt/open-prices/data
- home_cache:/home/off/.cache
depends_on:
- postgres
command: ["gunicorn", "config.wsgi", "--bind", "0.0.0.0:8000", "--workers", "${GUNICORN_WORKERS:-4}"]
scheduler:
<<: *api-common
command: ["python", "manage.py", "qcluster"]
volumes:
- images:/opt/open-prices/img
- data-dump:/opt/open-prices/data
- home_cache:/home/off/.cache
depends_on:
- postgres
update-listener:
<<: *api-common
command: ["python", "manage.py", "run_update_listener"]
depends_on:
- postgres
postgres:
restart: $RESTART_POLICY
image: postgres:16.1-alpine
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
volumes:
- postgres-data:/var/lib/postgresql/data
command: postgres -c shared_buffers=1024MB -c work_mem=64MB
mem_limit: 4g
shm_size: 1g
ports:
- "${POSTGRES_EXPOSE:-127.0.0.1:5432}:5432"
nginx:
restart: $RESTART_POLICY
image: nginx:1.25-alpine
volumes:
# Mount the nginx configuration file
- ./nginx.conf:/etc/nginx/nginx.conf
# Mount the static files (robots.txt and vue.js app)
- ./www:/var/www
# Mount the images
- images:/var/img
# And the dir where the daily data dump is stored
- data-dump:/var/data-dump
ports:
- ${API_PORT}:80
volumes:
postgres-data:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_postgres-data
# Store all user-uploaded images in a volume
images:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_images
# Store the daily data dump in a volume
data-dump:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_data-dump
# store ~/.cache in a volume
home_cache:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_home_cache
static:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_static
networks:
default:
name: ${COMPOSE_PROJECT_NAME:-open_prices}_default
# this is the network shared with product opener, it's only used in staging (and locally)
common_net:
name: ${COMMON_NET_NAME}
external: true