-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-prod.yaml
127 lines (122 loc) · 3.89 KB
/
docker-compose-prod.yaml
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
version: "3.0"
networks:
crypto-investments-network:
driver: bridge
services:
# ------------------------------------------------------------------
# ------------------------------------------------------------------
crypto-investments-api:
build:
context: .
dockerfile: api/Dockerfile
image: crypto-investments-api:latest
platform: linux/x86_64
restart: unless-stopped
container_name: ${COMPOSE_PROJECT_NAME}-api
links:
- database
- redis
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
networks:
- crypto-investments-network
ports:
- "${API_PORT}:8080"
tty: true
environment:
MANAGEMENT_SERVER_PORT: ${API_MANAGEMENT_PORT}
DB_PORT: ${DB_PORT}
DB_NAME: ${DB_NAME}
DB_HOST: ${DB_HOST}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_MAX_CONNECTIONS: ${DB_MAX_CONNECTIONS}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
SWAGGER_URL: ${SWAGGER_URL}
OPENAPI_URL: ${OPENAPI_URL}
MAX_REQUESTS_PER_MINUTE: ${API_MAX_REQUESTS_PER_MINUTE}
healthcheck:
test: ["CMD-SHELL", "sh -c 'wget -q --output-document - http://localhost:${API_MANAGEMENT_PORT}/actuator/health'"]
interval: 10s
timeout: 60s
retries: 10
# ------------------------------------------------------------------
# ------------------------------------------------------------------
crypto-investments-importer:
build:
context: .
dockerfile: importer/Dockerfile
image: crypto-investments-importer:latest
platform: linux/x86_64
restart: unless-stopped
container_name: ${COMPOSE_PROJECT_NAME}-importer
links:
- database
depends_on:
crypto-investments-api:
condition: service_healthy
networks:
- crypto-investments-network
ports:
- "${IMPORTER_PORT}:8080"
tty: true
volumes:
- ${IMPORT_DATA_HOST_DIRECTORY}:${IMPORT_DATA_CONTAINER_DIRECTORY}:rw
environment:
MANAGEMENT_SERVER_PORT: ${IMPORTER_MANAGEMENT_PORT}
DB_PORT: ${DB_PORT}
DB_NAME: ${DB_NAME}
DB_HOST: ${DB_HOST}
DB_USERNAME: ${DB_USERNAME}
DB_PASSWORD: ${DB_PASSWORD}
DB_MAX_CONNECTIONS: ${DB_MAX_CONNECTIONS}
IMPORT_DATA_DIR: ${IMPORT_DATA_CONTAINER_DIRECTORY}
healthcheck:
test: [ "CMD-SHELL", "sh -c 'wget -q --output-document - http://localhost:${IMPORTER_MANAGEMENT_PORT}/actuator/health'" ]
interval: 10s
timeout: 60s
retries: 10
# ------------------------------------------------------------------
# ------------------------------------------------------------------
database:
image: timescale/timescaledb-ha:pg15-latest
restart: unless-stopped
container_name: ${COMPOSE_PROJECT_NAME}-database
tty: true
networks:
- crypto-investments-network
ports:
- "${DB_PORT}:5432"
volumes:
- ~/.volumes/database/postgresql:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
PGTZ: ${TIMEZONE}
TZ: ${TIMEZONE}
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${DB_USERNAME} -d ${DB_NAME}'"]
interval: 10s
timeout: 60s
retries: 10
# ------------------------------------------------------------------
# ------------------------------------------------------------------
redis:
image: redis:7-alpine
restart: unless-stopped
container_name: ${COMPOSE_PROJECT_NAME}-redis
tty: true
networks:
- crypto-investments-network
ports:
- "${REDIS_PORT}:6379"
healthcheck:
test: ["CMD", "redis-cli","ping"]
interval: 10s
timeout: 60s
retries: 10