-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-compose.yml
203 lines (196 loc) · 6.48 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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
services:
test:
build:
context: ./
dockerfile: Dockerfile
entrypoint: ["poetry", "run", "pytest","-vv", "-o", "log_cli=true", "--cov-report", "term:skip-covered", "--cov=quotaclimat", "--cov=postgres", "test/"]
#entrypoint: ["sleep", "12000"] # use to debug the container if needed
environment:
ENV: docker
# CHANNEL: "fr3-idf"
LOGLEVEL: INFO
PYTHONPATH: /app
POSTGRES_USER: user
POSTGRES_DB: barometre
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres_db
POSTGRES_PORT: 5432
MODIN_ENGINE: ray
COMPARE_DURATION: "true"
tty: true # colorize terminal
volumes:
- ./quotaclimat/:/app/quotaclimat/
- ./postgres/:/app/postgres/
- ./test/:/app/test/
- ./poetry.lock:/app/poetry.lock
- ./pyproject.toml:/app/pyproject.toml
- ./alembic:/app/alembic
- ./alembic.ini:/app/alembic.ini
depends_on:
nginxtest:
condition: service_healthy
postgres_db:
condition: service_healthy
testconsole:
build:
context: ./
dockerfile: Dockerfile
entrypoint: ["sleep", "12000"] # use to debug the container if needed
environment:
ENV: docker
# CHANNEL: "fr3-idf"
LOGLEVEL: DEBUG
PYTHONPATH: /app
POSTGRES_USER: user
POSTGRES_DB: barometre
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres_db
POSTGRES_PORT: 5432
COMPARE_DURATION: "true"
MODIN_ENGINE: ray
MODIN_CPUS: 4 # "https://modin.readthedocs.io/en/0.11.0/using_modin.html#reducing-or-limiting-the-resources-modin-can-use"
tty: true # colorize terminal
volumes:
- ./quotaclimat/:/app/quotaclimat/
- ./postgres/:/app/postgres/
- ./test/:/app/test/
- ./poetry.lock:/app/poetry.lock
- ./pyproject.toml:/app/pyproject.toml
- ./alembic:/app/alembic
- ./alembic.ini:/app/alembic.ini
depends_on:
nginxtest:
condition: service_healthy
postgres_db:
condition: service_healthy
nginxtest: # to test locally webpages
container_name: nginxtest
image: nginx:latest
healthcheck:
test: ["CMD", "service", "nginx", "status"]
interval: 5s
timeout: 5s
retries: 5
ports:
- 8000:80
volumes:
- './mockwebsite:/usr/share/nginx/html'
ingest_to_db:
container_name: ingest_to_db
ports:
- 5000:5000
build:
context: ./
dockerfile: Dockerfile_ingest
#entrypoint: ["sleep", "1200"] # use to debug the container if needed
entrypoint: ["python", "quotaclimat/data_ingestion/ingest_db/ingest_sitemap_in_db.py"]
environment:
ENV: docker # change me to prod for real cases
LOGLEVEL: INFO # Change me to info (debug, info, warning, error) to have less log
PYTHONPATH: /app
POSTGRES_USER: user
POSTGRES_DB: barometre
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres_db
POSTGRES_PORT: 5432
PORT: 5000
HEALTHCHECK_SERVER: "0.0.0.0"
volumes:
- ./quotaclimat/:/app/quotaclimat/
- ./postgres/:/app/postgres/
depends_on:
nginxtest:
condition: service_healthy
postgres_db:
condition: service_healthy
postgres_db:
image: postgres:15
ports:
- 5432:5432
volumes:
- './pgdata:/var/lib/postgresql/data' # persist data https://stackoverflow.com/a/41650891/3535853
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
environment:
POSTGRES_USER: user
POSTGRES_DB: barometre
POSTGRES_PASSWORD: password
logging: # no logs for postgres container
driver: none
mediatree:
ports:
- 5050:5050
- 8265:8265
build:
context: ./
dockerfile: Dockerfile_api_import
#entrypoint: ["sleep", "1200"] # use to debug the container if needed
#entrypoint: ["python", "quotaclimat/data_processing/mediatree/api_import.py"]
environment:
ENV: docker # change me to prod for real cases
LOGLEVEL: DEBUG # Change me to info (debug, info, warning, error) to have less log
PYTHONPATH: /app
POSTGRES_USER: user
POSTGRES_DB: barometre
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres_db
POSTGRES_PORT: 5432
PORT_HS: 5050 # healthcheck
HEALTHCHECK_SERVER: "0.0.0.0"
# SENTRY_DSN: prod_only
# COMPARE_DURATION: "true"
#UPDATE: "true" # to batch update PG
#UPDATE_PROGRAM_ONLY: "true" # to batch update PG but only channel with program
#START_DATE_UPDATE: "2024-02-01" # to batch update PG from a date
#END_DATE: "2024-02-29" # optional - otherwise end of the month
BATCH_SIZE: 100 # number of records to update in one batch
# START_DATE: 1727610071 # to test batch import
CHANNEL : fr3-idf # to reimport only one channel
MEDIATREE_USER : /run/secrets/username_api
MEDIATREE_PASSWORD: /run/secrets/pwd_api
MEDIATREE_AUTH_URL: https://keywords.mediatree.fr/api/auth/token/
KEYWORDS_URL: https://keywords.mediatree.fr/api/subtitle/ # https://keywords.mediatree.fr/docs/#api-Subtitle-SubtitleList
MODIN_ENGINE: ray
MODIN_CPUS: 4 # "https://modin.readthedocs.io/en/0.11.0/using_modin.html#reducing-or-limiting-the-resources-modin-can-use"
MODIN_MEMORY: 1000000000 # 1Gb
RAY_memory_usage_threshold: 1
mem_limit: "1G"
volumes:
- ./quotaclimat/:/app/quotaclimat/
- ./postgres/:/app/postgres/
- ./test/:/app/test/
secrets:
- pwd_api
- username_api
depends_on:
nginxtest:
condition: service_healthy
postgres_db:
condition: service_healthy
metabase:
container_name: metabase_barometre
image: metabase/metabase:latest
volumes:
- './mb-data:/metabase-data' # Volumes where Metabase data will be persisted
ports:
- 3000:3000
environment:
MB_DB_TYPE: postgres
MB_DB_DBNAME: barometre
MB_DB_PORT: 5432
MB_DB_USER: user
MB_DB_PASS: password
MB_DB_HOST: postgres_db
MB_DB_FILE: "/metabase-data/metabase.db" # https://www.metabase.com/docs/latest/operations-guide/running-metabase-on-docker.html#mounting-a-mapped-file-storage-volume
JAVA_TIMEZONE: Europe/Paris
depends_on:
postgres_db:
condition: service_healthy
secrets: # https://docs.docker.com/compose/use-secrets/
pwd_api:
file: secrets/pwd_api.txt
username_api:
file: secrets/username_api.txt