-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.override.yml
185 lines (178 loc) · 9.09 KB
/
docker-compose.override.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
# ===========================================
# Overwrites the docker-compose.yml file (Dev Mode).
#
# @author Björn Hempel <[email protected]>
# @version 0.1.0 (2023-01-01)
# @since 0.1.0 (2023-01-01) First version.
# ===========================================
# ===========================================
# Start app:
# ----------
# ❯ docker-compose up -d
#
# Show containers:
# ----------------
# ❯ docker container ls
#
# Build images:
# -------------
# ❯ docker-compose build
#
# Show logs:
# ----------------
# ❯ docker-compose logs -f
#
# Login into containers:
# ----------------------
# ❯ docker-compose exec nginx bash
# ❯ docker-compose exec php bash
#
# Open app (local - localhost):
# -----------------
#
# With Traefik proxy:
# - https://www.api-version.localhost/
# - https://www.api-version.localhost/api/v1/docs.html
#
# Without Traefik proxy:
# - https://localhost:44443/
# - https://localhost:44443/api/v1/docs.html
#
# Restart containers:
# -------------------
# ❯ docker-compose restart
#
# Shutdown containers:
# --------------------
# ❯ docker-compose down
#
# Installation:
# -------------
# ❯ docker-compose up -d
# ❯ docker-compose exec php composer install
#
# ===========================================
# Configures the services
services:
# PHP FPM 8.2.1 and apache to serve the app
php:
ports:
- "${PORT_HTTPS_APP_EXPOSE}:${PORT_HTTPS}"
- "${PORT_SUPERVISORD_EXPOSE}:${PORT_SUPERVISORD_INTERNAL}"
volumes:
# Server content (development mode)
- .:/var/www/web:delegated
# Exclude folder vendor
- php-data-vendor:/var/www/web/vendor
# Exclude folder var/cache
- php-data-var:/var/www/web/var
# Include cron tasks
- ./docker/php/cron.d/symfony.development:/etc/cron.d/symfony
networks:
- network-internal
- network-traefik
labels:
# enable traefik
- "traefik.enable=true"
# middleware
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.redirectscheme.scheme=https"
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_frame.headers.customFrameOptionsValue=sameorigin"
# services (load balancer)
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https_lb.loadbalancer.server.port=${PORT_HTTPS}"
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https_lb.loadbalancer.server.scheme=https"
# http layer -> redirect https
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_http.entrypoints=web"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_http.rule=Host(`www.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_http.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_https"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_http.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_https_lb"
# https layer
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.entrypoints=websecure"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.rule=Host(`www.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_frame"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_https_lb"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_https.tls=true"
# middleware
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.redirectscheme.scheme=https"
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_frame.headers.customFrameOptionsValue=sameorigin"
# services (load balancer)
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http_lb.loadbalancer.server.port=${PORT_SUPERVISORD_INTERNAL}"
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http_lb.loadbalancer.server.scheme=http"
# http layer -> redirect https
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http.entrypoints=web"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http.rule=Host(`supervisord.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http_lb"
# https layer
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.entrypoints=websecure"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.rule=Host(`supervisord.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_frame"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_http_lb"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_supervisord_https.tls=true"
# network
- "traefik.docker.network=${NETWORK_NAME_TRAEFIK_PUBLIC_LOCAL}"
# PostgreSQL 14.7
postgresql:
ports:
- ${PORT_POSTGRESQL_EXPOSE}:${PORT_POSTGRESQL_INTERNAL}
# Adminer DB Client
adminer:
ports:
- "${PORT_HTTP_ADMINER_EXPOSE}:${PORT_HTTP_ADMINER_INTERNAL}"
networks:
- network-internal
- network-traefik
labels:
# enable traefik
- "traefik.enable=true"
# middleware
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.redirectscheme.scheme=https"
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_frame.headers.customFrameOptionsValue=sameorigin"
# services (load balancer)
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http_lb.loadbalancer.server.port=${PORT_HTTP_ADMINER_INTERNAL}"
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http_lb.loadbalancer.server.scheme=http"
# http layer -> redirect https
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http.entrypoints=web"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http.rule=Host(`adminer.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https"
# https layer
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.entrypoints=websecure"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.rule=Host(`adminer.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_frame"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_http_lb"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_adminer_https.tls=true"
# network
- "traefik.docker.network=${NETWORK_NAME_TRAEFIK_PUBLIC_LOCAL}"
# Maildev (amd64 and arm64 version)
maildev:
ports:
- "${PORT_HTTP_MAILDEV_EXPOSE}:${PORT_HTTP_MAILDEV_INTERNAL}"
- "${PORT_SMTP_MAILDEV_EXPOSE}:${PORT_SMTP_MAILDEV_INTERNAL}"
networks:
- network-internal
- network-traefik
labels:
# enable traefik
- "traefik.enable=true"
# middleware
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.redirectscheme.scheme=https"
- "traefik.http.middlewares.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_frame.headers.customFrameOptionsValue=sameorigin"
# services (load balancer)
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http_lb.loadbalancer.server.port=${PORT_HTTP_MAILDEV_INTERNAL}"
- "traefik.http.services.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http_lb.loadbalancer.server.scheme=http"
# http layer -> redirect https
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http.entrypoints=web"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http.rule=Host(`maildev.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https"
# https layer
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.entrypoints=websecure"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.rule=Host(`maildev.${URL_LOCAL}`)"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.middlewares=${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_frame"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.service=${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_http_lb"
- "traefik.http.routers.${NAMESPACE_UNDERLINE_DEVELOPMENT}_maildev_https.tls=true"
# network
- "traefik.docker.network=${NETWORK_NAME_TRAEFIK_PUBLIC_LOCAL}"
# configure networks
networks:
network-traefik:
external: true
name: "${NETWORK_NAME_TRAEFIK_PUBLIC_LOCAL}"