-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
166 lines (149 loc) · 3.58 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
version: '3.9'
services:
traefik:
image: traefik:v2.8
restart: always
command: --providers.docker=true --providers.file.filename=/etc/traefik/dynamic_conf/conf.yml --api.insecure=true --entrypoints.web.address=:80 --entrypoints.websecure.address=:443 --accesslog=true
hostname: $DOMAIN
ports:
# Open traefik http [80] and https [443] ports.
- '80:80'
- '443:443'
- '8080:8080'
networks:
- web
- default
volumes:
- ./ssl:/ssl:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./traefik.yml:/etc/traefik/dynamic_conf/conf.yml:ro
ui:
restart: unless-stopped
build:
context: ./ui
dockerfile: Dockerfile
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.terrarun-ui.rule=Host(`$DOMAIN`)"
- "traefik.http.routers.terrarun-ui.entrypoints=websecure"
- "traefik.http.routers.terrarun-ui.tls=true"
- "traefik.http.services.terrarun-ui.loadbalancer.server.port=80"
- "traefik.http.routers.terrarun-ui.service=terrarun-ui"
api:
restart: unless-stopped
build: .
networks:
- web
labels:
- "traefik.enable=true"
- "traefik.http.routers.terrarun-api.rule=Host(`$DOMAIN`) && (PathPrefix(`/.well-known`) || PathPrefix(`/api`)) || PathPrefix(`/auth`)"
- "traefik.http.routers.terrarun-api.entrypoints=websecure"
- "traefik.http.routers.terrarun-api.tls=true"
- "traefik.http.services.terrarun-api.loadbalancer.server.port=5000"
- "traefik.http.routers.terrarun-api.service=terrarun-api"
depends_on:
- db
- minio
links:
- db
- minio
env_file:
- ./.env
entrypoint: ["python", "-u", "terrarun.py"]
worker:
restart: unless-stopped
build: .
networks:
- web
labels:
- "traefik.enable=false"
depends_on:
- db
- minio
links:
- db
- minio
- tfsec-task
env_file:
- ./.env
entrypoint: ["python", "-u", "worker.py"]
cron-tasks:
restart: unless-stopped
build: .
networks:
- web
depends_on:
- db
- minio
links:
- db
- minio
env_file:
- ./.env
entrypoint: ["python", "-u", "./cron_tasks.py"]
db:
image: mariadb
restart: always
networks:
- web
env_file:
- ./.env
labels:
- "traefik.enable=false"
volumes:
- mysqldata:/var/lib/mysql
minio:
image: minio/minio
ports:
- 9000:9000
- 9001:9001
networks:
- web
- default
env_file:
- .env
environment:
MINIO_ACCESS_KEY: $AWS_ACCESS_KEY_ID
MINIO_SECRET_KEY: $AWS_SECRET_ACCESS_KEY
command: server /data --console-address ":9001"
createbucket:
image: minio/mc
depends_on:
- minio
networks:
- web
env_file:
- .env
entrypoint: >
/bin/sh -c "
/usr/bin/mc config host add jmonminio $AWS_ENDPOINT $AWS_ACCESS_KEY_ID $AWS_SECRET_ACCESS_KEY;
/usr/bin/mc mb jmonminio/$AWS_BUCKET_NAME;
exit 0;
"
# Example custom agent
agent:
restart: unless-stopped
image: hashicorp/tfc-agent:1.15.4
networks:
- web
depends_on:
- traefik
- api
env_file:
- ./.env
entrypoint: ["-address", "https://$DOMAIN", "-token", "$AGENT_TOKEN"]
# Example run task application
tfsec-task:
build: https://gitlab.dockstudios.co.uk/pub/terra/tfcloud-tfsec.git
networks:
- web
volumes:
mysqldata:
networks:
web:
name: terrun-web
default:
name: terrarun-default
driver: bridge