-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
170 lines (159 loc) · 4.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
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
version: "3.8"
name: datastore
services:
db:
# image: timescale/timescaledb-ha:pg15-latest
image: kartoza/postgis:15 # Use this instead of the official image as it has an arm64 image
ports:
- "5433:5432"
volumes:
# - ts-data:/home/postgres/pgdata/data # for timescale image
- ts-data:/var/lib/postgresql # for postgres image
- ./datastore/database/healthcheck_postgis_uptime.sh:/healthcheck_postgis_uptime.sh # for the healthcheck
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=mysecretpassword
- POSTGRES_DB=data
shm_size: 312m
restart: on-failure
healthcheck:
# HACK Due to the installation of Postgis extension the database is restarted, the healthcheck checks if the database is up for longer than specified time.
test:
[
"CMD-SHELL",
"/healthcheck_postgis_uptime.sh postgresql://postgres:mysecretpassword@localhost/data 10 second",
]
interval: 5s
timeout: 1s
retries: 3
start_period: 30s # Failures in 30 seconds do not mark container as unhealthy
migrate:
image: migrate/migrate:4
volumes:
- ./datastore/migrate/data/migrations:/data/migrations
command:
[
"-path",
"/data/migrations",
"-database",
"postgres://postgres:mysecretpassword@db:5432/data?sslmode=disable",
"up",
]
depends_on:
db:
condition: service_healthy
store:
build:
context: datastore/datastore
ports:
- "50050:50050"
- "6060:6060" # for flame graphing
environment:
- PGHOST=db
- PGPORT=5432
- DYNAMICTIME=$DYNAMICTIME
- LOTIME=$LOTIME
- HITIME=$HITIME
- CLEANUPINTERVAL=$CLEANUPINTERVAL
- PUTOBSLIMIT=$PUTOBSLIMIT
restart: on-failure
healthcheck:
test:
["CMD-SHELL", "exit $(/bin/grpc_health_probe -addr=localhost:50050)"]
interval: 5s
timeout: 1s
retries: 15
start_period: 60s
depends_on:
migrate:
condition: service_completed_successfully
api:
build:
context: api
ports:
- "8008:8000"
environment:
- DSHOST=store
- DSPORT=50050
- FORWARDED_ALLOW_IPS=${FORWARDED_ALLOW_IPS:-127.0.0.1}
- GUNICORN_CMD_ARGS=--bind 0.0.0.0:8000 --workers=4 --access-logfile -
depends_on:
store:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl --fail http://localhost:8000/health || exit 1"]
interval: 5s
timeout: 1s
retries: 3
start_period: 30s # Failures in 30 seconds do not mark container as unhealthy
api-unit:
profiles: ["test"]
build:
context: api
dockerfile: unit.Dockerfile
volumes:
- ./api/test/output:/app/output
ingest:
build:
context: ingest
ports:
- "8009:8001"
network_mode: ""
environment:
- DSHOST=${DSHOST:-store}
- DSPORT=${DSPORT:-50050}
- MQTT_HOST=${MQTT_HOST}
- MQTT_USERNAME=${MQTT_USERNAME}
- MQTT_PASSWORD=${MQTT_PASSWORD}
- MQTT_TLS=True
- INGEST_LOGLEVEL
- GUNICORN_CMD_ARGS=--bind 0.0.0.0:8001 --workers=4 --access-logfile -
depends_on:
store:
condition: service_healthy
client:
profiles: ["test"]
build:
context: datastore/examples/clients/python
environment:
- DSHOST=store
- DSPORT=50050
depends_on:
store:
condition: service_healthy
loader:
profiles: ["test"]
build:
context: datastore/data-loader
environment:
- DSHOST=store
- DSPORT=50050
- BASE_URL=http://api:8000
depends_on:
store:
condition: service_healthy
integration:
profiles: ["test"]
build:
context: datastore/integration-test
environment:
- DSHOST=store
- DSPORT=50050
- BASE_URL=http://api:8000
depends_on:
api:
condition: service_healthy
performance:
profiles: ["test"]
build:
context: datastore/load-test
environment:
- DSHOST=store
- DSPORT=50050
volumes:
- ./datastore/load-test/output:/load-test/output
depends_on:
store:
condition: service_healthy
volumes:
ts-data: