This repository has been archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
220 lines (220 loc) · 4.85 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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
---
version: '2.2'
services:
local-azure:
image: mcr.microsoft.com/azure-storage/azurite
azcli:
image: mcr.microsoft.com/azure-cli
entrypoint: az
environment:
- AZURE_CORE_OUTPUT=json
volumes:
- $HOME/.azure:/root/.azure
gpg-infra:
image: vladgh/gpg
volumes:
- $PWD/infra:/workdir
working_dir: /workdir
python:
build:
context: .
volumes:
- $PWD/hello_azure:/app
- $PWD/VERSION:/VERSION
packer:
extends: ansible-with-systemd
volumes:
- $PWD/infra:/workdir:ro,cached
- $PWD/scripts:/scripts:ro,cached
- $PWD/secrets:/secrets:cached
working_dir: /workdir
env_file: infra/.env
entrypoint: sh /scripts/build_image_from_packer_template.sh
prom_database:
image: postgres:alpine
env_file: ./monitoring/prometheus/.env.test
ports:
- 5432
prometheus:
depends_on:
- prom_database
image: prom/prometheus
volumes:
- $PWD/monitoring/prometheus:/etc/prometheus
ports:
- 9090:9090
prom_persistence_check:
image: alpine
entrypoint: sh
command:
- -c
- "nc -z prom_database 5432"
prom_monitoring_check:
image: alpine
entrypoint: sh
command:
- -c
- "nc -z prometheus 9090"
grafana:
depends_on:
- graf_database
- graf_cache
env_file: ./monitoring/grafana/.env.test
image: grafana/grafana
volumes:
- $PWD/monitoring/grafana/grafana.ini:/etc/grafana/grafana.ini
- $PWD/monitoring/certs:/certs
- $PWD/monitoring/grafana/provisioning:/etc/grafana/provisioning
ports:
- 3000:3000
graf_cache:
image: redis:alpine
volumes:
- $PWD/redis:/data
ports:
- 6379
graf_database:
image: postgres:alpine
env_file: ./monitoring/grafana/.env.test
ports:
- 5432
graf_persistence_check:
image: alpine
entrypoint: sh
command:
- -c
- "nc -z graf_database 5432 && nc -z graf_cache 6379"
graf_monitoring_check:
image: alpine
entrypoint: sh
command:
- -c
- "nc -z grafana 3000"
ansible-with-systemd:
tty: true # colores!
privileged: true
build:
dockerfile: ansible.Dockerfile
context: .
environment:
ANSIBLE_RETRY_FILES_ENABLED: 0
ANSIBLE_STDOUT_CALLBACK: debug
ANSIBLE_HOST_KEY_CHECKING: "false"
volumes:
- $PWD:/app:ro,cached # Needed so that we don't have to copy the app into the container every time.
- $PWD/infra:/workdir:ro,cached
- /sys/fs/cgroup:/sys/fs/cgroup:ro
working_dir: /workdir
terraform:
build:
dockerfile: terraform.Dockerfile
context: .
volumes:
- $PWD/infra:/infra:cached
- $PWD/scripts:/scripts:ro,cached
- $PWD/secrets:/secrets:cached
working_dir: /infra
env_file: infra/.env
environment:
- TF_CLI_ARGS_apply="-auto-approve"
- TF_CLI_ARGS_destroy="-force"
entrypoint:
- sh
- /scripts/execute_terraform.sh
blobstore:
extends: local-azure
entrypoint: azurite-blob
ports:
- 10000:10000
command:
- azurite-blob
- -d
- debug.log
- --blobHost
- 0.0.0.0
- --blobPort
- "10000"
database:
image: postgres:alpine
env_file: .env.test
volumes:
- $PWD/scripts/db_init:/docker-entrypoint-initdb.d
ports:
- 5432
app_persistence_check:
image: alpine
entrypoint: sh
command:
- -c
- "nc -z blobstore 10000 && nc -z database 5432"
hello-azure:
tty: true # colores!
depends_on:
- database
- blobstore
- prometheus
- grafana
extends: python
env_file: .env.test
ports:
- 80:5000
entrypoint: python
command: hello_azure.py
init-database:
depends_on:
- database
extends: database
entrypoint: sh
env_file: .env.test
volumes:
- $PWD:/app:ro,cached
working_dir: /app
command:
- -c
- scripts/load_database.sh
init-blobstore:
depends_on:
- blobstore
extends: azcli
entrypoint: sh
env_file: .env.test
volumes:
- $PWD:/app:ro,cached
working_dir: /app
command:
- -c
- scripts/load_blobstore.sh
encrypt-infra-env:
extends: gpg-infra
command:
- --batch
- --yes
- --passphrase=$ENV_PASSWORD
- --output=env.gpg
- --symmetric
- .env
decrypt-infra-env:
extends: gpg-infra
command:
- --decrypt
- --batch
- --yes
- --passphrase=$ENV_PASSWORD
- --output=.env
- env.gpg
ansible-test-webservers:
depends_on:
- database
- blobstore
extends: ansible-with-systemd
env_file: .env.test
ansible-test-databases:
extends: ansible-with-systemd
env_file: .env.test
lint:
extends: python
entrypoint: pylint
volumes:
- "$PWD:/app:cached"
command:
- -E