-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
76 lines (76 loc) · 2.2 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
services:
db:
image: postgres
restart: unless-stopped
container_name: db
environment:
- POSTGRES_USER=${PG_LOGIN}
- POSTGRES_PASSWORD=${PG_PASS}
- POSTGRES_DB=${PG_DB_NAME}
ports:
- '5432:5432'
volumes:
- ./db:/var/lib/postgresql/data
api:
platform: linux/amd64
environment:
- TESTING=${TESTING}
- PROD_API_TOKEN=${PROD_API_TOKEN}
- TEST_API_TOKEN=${TEST_API_TOKEN}
- FERNET_KEY=${FERNET_KEY}
- ADMIN_IDS=${ADMIN_IDS}
- PG_LOGIN=${PG_LOGIN}
- PG_PASS=${PG_PASS}
- PG_DB_NAME=${PG_DB_NAME}
- PG_HOST=${PG_HOST}
- PG_PORT=${PG_PORT}
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_USER=${REDIS_USER}
- REDIS_USER_PASSWORD=${REDIS_USER_PASSWORD}
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
depends_on:
- db
build:
context: ./
dockerfile: ./Dockerfile
redis:
image: redis:latest
container_name: redis_container
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD}
- REDIS_USER=${REDIS_USER}
- REDIS_USER_PASSWORD=${REDIS_USER_PASSWORD}
depends_on:
- api
ports:
- "6379:6379"
volumes:
- ./redisdata:/data
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
command: >
sh -c '
mkdir -p /usr/local/etc/redis &&
echo "bind 0.0.0.0" > /usr/local/etc/redis/redis.conf &&
echo "requirepass $REDIS_PASSWORD" >> /usr/local/etc/redis/redis.conf &&
echo "appendonly yes" >> /usr/local/etc/redis/redis.conf &&
echo "appendfsync everysec" >> /usr/local/etc/redis/redis.conf &&
echo "user default on nopass ~* +@all" > /usr/local/etc/redis/users.acl &&
echo "user $REDIS_USER on >$REDIS_USER_PASSWORD ~* +@all" >> /usr/local/etc/redis/users.acl &&
redis-server /usr/local/etc/redis/redis.conf --aclfile /usr/local/etc/redis/users.acl
'
healthcheck:
test: [ "CMD", "redis-cli", "-a", "$REDIS_PASSWORD", "ping" ]
interval: 30s
timeout: 10s
retries: 5
restart: unless-stopped
tty: true
stdin_open: true