-
Notifications
You must be signed in to change notification settings - Fork 24
/
docker-compose.yml
56 lines (50 loc) · 2.29 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
version: "3"
services:
psql:
image: timescale/timescaledb:2.8.0-pg13
# This will resolve to the var set in the .env file
container_name: ${POSTGRES_HOST}
command: ["postgres", "-c", "logging_collector=on", "-c", "log_directory=/var/lib/postgresql/logs", "-c", "log_filename=postgresql_%Y-%m-%dT%H:%M:%S.log", "-c", "log_statement=all"]
env_file:
- .env
volumes:
- ./local_data/_postgresql/data:/var/lib/postgresql/data # persist db
- ./scripts/database/init:/docker-entrypoint-initdb.d # init script
- ./logs/postgres:/var/lib/postgresql/logs # logging
ports:
- ${POSTGRES_PORT}:${POSTGRES_PORT}
redis:
image: redis:7.0.5
# This will resolve to the var set in the .env file
container_name: ${REDIS_HOST}
# We use the shell form of command here to run the container using shell
# and thus make use of the password set in the .env file
# - Double dollars, so that the variable is not expanded by Docker Compose,
# but by the shell
# - Surround by quotes, so that the shell does not split the password
# - The ${variable:?message} syntax causes shell to exit with a non-zero
# code and print a message, when the variable is not set or empty
command: /bin/sh -c redis-server --appendonly yes --requirepass "$${REDIS_PASSWORD:?REDIS_PASSWORD variable is not set}"
env_file:
- .env
volumes:
- ./local_data/_redis:/data # persist db
ports:
- ${REDIS_PORT}:${REDIS_PORT}
coin_app:
build: .
container_name: coin-app
tty: true
env_file:
- .env
depends_on:
- psql
- redis
volumes:
- ./logs:/coin-for-rich/logs
ports:
- ${WEB_PORT}:${WEB_PORT} # web
- ${CELERY_PORT}:${CELERY_PORT} # celery flower
# The use of env vars here (double dollars) will resolve to the ones
# that are passed in the container via the env_file instruction above
entrypoint: /bin/sh -c '/coin-for-rich/wait-for $${POSTGRES_HOST}:$${POSTGRES_PORT} -t 60 && /coin-for-rich/wait-for $${REDIS_HOST}:$${REDIS_PORT} -t 60 && /coin-for-rich/scripts/docker/init.sh && bash'