-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
172 lines (162 loc) · 4.74 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
version: "3.8"
networks:
infra:
traefik:
external:
name: traefik
default:
driver: bridge
volumes:
traefik_sample_data_portainer:
traefik_sample_data_mysql:
services:
traefik:
image: traefik:v2.3
container_name: traefik
restart: unless-stopped
networks:
traefik:
ipv4_address: 192.168.90.254
security_opt:
- no-new-privileges:true
ports:
- "80:80"
- "443:443"
- target: 8080
published: 8080
protocol: tcp
mode: ingress
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./traefik/traefik.yml:/traefik.yml
- ./traefik/acme.json:/acme.json
- ./traefik/traefik.log:/traefik.log
- ./traefik/rules:/rules
- ./traefik/shared:/shared
labels:
- "traefik.enable=true"
# router
- "traefik.http.routers.traefik-rtr.entrypoints=websecure"
- "traefik.http.routers.traefik-rtr.rule=Host(`traefik.$HOSTNAME`)"
- "traefik.http.routers.traefik-rtr.tls=true"
- "traefik.http.routers.traefik-rtr.tls.certresolver=le"
# service api
- "traefik.http.routers.traefik-rtr.service=api@internal"
# middlewares
- "traefik.http.routers.traefik-rtr.middlewares=rate-limit@file,myauth@file"
api:
image: webdevops/php-nginx:8.1-alpine
container_name: api
working_dir: /app
restart: always
networks:
- traefik
- infra
volumes:
- ./apps/api:/app:rw
- ./nginx/nginxapi.conf:/etc/nginx/nginx.conf
environment:
- WEB_DOCUMENT_ROOT=/app/public
- VIRTUAL_HOST=api.$HOSTNAME
labels:
- "traefik.enable=true"
# router
- "traefik.http.routers.api-rtr.entrypoints=websecure"
- "traefik.http.routers.api-rtr.rule=Host(`api.$HOSTNAME`)"
- "traefik.http.routers.api-rtr.tls=true"
- "traefik.http.routers.api-rtr.tls.certresolver=le"
web:
image: webdevops/nginx:latest
container_name: web
working_dir: /app
restart: always
networks:
- traefik
- infra
volumes:
- ./apps/web:/app:rw
environment:
- WEB_DOCUMENT_ROOT=/app/build
- WEB_ALIAS_DOMAIN=admin.$HOSTNAME
- WEB_DOCUMENT_INDEX=index.html
labels:
- "traefik.enable=true"
# router
- "traefik.http.routers.intranet-rtr.entrypoints=websecure"
- "traefik.http.routers.intranet-rtr.rule=Host(`intranet.$HOSTNAME`)"
- "traefik.http.routers.intranet-rtr.tls=true"
- "traefik.http.routers.intranet-rtr.tls.certresolver=le"
adminer:
image: adminer:latest
container_name: adminer
restart: always
networks:
- traefik
- infra
volumes:
- ./adminer/plugins-enabled:/var/www/html/plugins-enabled:rw
- ./adminer/robots.txt:/var/www/html/robots.txt
labels:
- "traefik.enable=true"
# router
- "traefik.http.routers.adminer-rtr.entrypoints=websecure"
- "traefik.http.routers.adminer-rtr.rule=Host(`adminer.$HOSTNAME`)"
- "traefik.http.routers.adminer-rtr.tls=true"
- "traefik.http.routers.adminer-rtr.tls.certresolver=le"
# middlewares
- "traefik.http.routers.adminer-rtr.middlewares=rate-limit@file,myauth@file"
mysql:
image: mysql:8.0.25
container_name: mysql
working_dir: /app
restart: on-failure
networks:
- infra
security_opt:
- no-new-privileges:true
ports:
- "3306:3306"
volumes:
- ${PWD}/data:/app:rw
- ${PWD}/mysql/my.cnf:/etc/mysql/conf.d/my-over.cnf
- traefik_sample_data_mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
MYSQL_DATABASE: $MYSQL_DATABASE
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASSWORD
redis:
image: redis:alpine
container_name: redis
restart: unless-stopped
ports:
- "6380:6379"
networks:
- infra
security_opt:
- no-new-privileges:true
portainer:
image: portainer/portainer:latest
container_name: portainer
restart: unless-stopped
command: -H unix:///var/run/docker.sock
networks:
traefik:
ipv4_address: 192.168.90.253
security_opt:
- no-new-privileges:true
volumes:
- itraefik_sample_data_portainer:/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TZ=$TZ
labels:
- "traefik.enable=true"
# router
- "traefik.http.routers.portainer-rtr.entrypoints=websecure"
- "traefik.http.routers.portainer-rtr.rule=Host(`portainer.$HOSTNAME`)"
- "traefik.http.routers.portainer-rtr.tls=true"
- "traefik.http.routers.portainer-rtr.tls.certresolver=le"
# services
- "traefik.http.routers.portainer-rtr.service=portainer-svc"
- "traefik.http.services.portainer-svc.loadbalancer.server.port=9000"