Skip to content

Commit 2249efc

Browse files
committed
Refactor ops-traefik - Remove custom docker compose overwrites, add config via env-vars
1 parent 1150be5 commit 2249efc

10 files changed

+70
-356
lines changed

services/traefik/Makefile

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,53 +56,33 @@ ${TEMP_COMPOSE}-local: docker-compose.yml docker-compose.local.yml .env
5656
set +o allexport; \
5757
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.local.yml > $@
5858

59-
.PHONY: ${TEMP_COMPOSE}-letsencrypt-http
60-
${TEMP_COMPOSE}-letsencrypt-http: docker-compose.yml docker-compose.letsencrypt.http.yml .env
61-
@set -o allexport; \
62-
source .env; \
63-
set +o allexport; \
64-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.letsencrypt.http.yml > $@
65-
66-
.PHONY: ${TEMP_COMPOSE}-letsencrypt-dns
67-
${TEMP_COMPOSE}-letsencrypt-dns: docker-compose.yml docker-compose.letsencrypt.dns.yml .env
68-
@set -o allexport; \
69-
source .env; \
70-
set +o allexport; \
71-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.letsencrypt.dns.yml > $@
72-
7359
.PHONY: ${TEMP_COMPOSE}-aws
74-
${TEMP_COMPOSE}-aws: docker-compose.yml docker-compose.aws.yml .env
60+
${TEMP_COMPOSE}-aws: docker-compose.yml .env
7561
@set -o allexport; \
7662
source .env; \
7763
set +o allexport; \
78-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.aws.yml > $@
64+
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
7965

8066
.PHONY: ${TEMP_COMPOSE}-dalco
81-
${TEMP_COMPOSE}-dalco: docker-compose.yml docker-compose.dalco.yml .env
67+
${TEMP_COMPOSE}-dalco: docker-compose.yml .env
8268
@set -o allexport; \
8369
source .env; \
8470
set +o allexport; \
85-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.dalco.yml > $@
71+
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
8672

8773
.PHONY: ${TEMP_COMPOSE}-public
88-
${TEMP_COMPOSE}-public: docker-compose.yml docker-compose.public.yml .env
74+
${TEMP_COMPOSE}-public: docker-compose.yml .env
8975
@set -o allexport; \
9076
source .env; \
9177
set +o allexport; \
92-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.public.yml > $@
78+
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
9379

9480
.PHONY: ${TEMP_COMPOSE}-master
95-
${TEMP_COMPOSE}-master: docker-compose.yml docker-compose.master.yml .env
81+
${TEMP_COMPOSE}-master: docker-compose.yml .env
9682
@set -o allexport; \
9783
source .env; \
9884
set +o allexport; \
99-
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< docker-compose.master.yml > $@
100-
101-
.PHONY: docker-compose.letsencrypt.dns.yml
102-
docker-compose.letsencrypt.dns.yml: .venv .env
103-
@$(call jinja, docker-compose.letsencrypt.dns.yml.j2, .env, docker-compose.letsencrypt.dns.yml.unlinted) && \
104-
$(_yq) docker-compose.letsencrypt.dns.yml.unlinted > docker-compose.letsencrypt.dns.yml; \
105-
rm docker-compose.letsencrypt.dns.yml.unlinted >/dev/null 2>&1;
85+
${REPO_BASE_DIR}/scripts/docker-stack-config.bash -e .env $< > $@
10686

10787
.PHONY: docker-compose.yml
10888
docker-compose.yml: traefik_dynamic_config.yml .venv .env

services/traefik/docker-compose.aws.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

services/traefik/docker-compose.dalco.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

services/traefik/docker-compose.letsencrypt.dns.yml.j2

Lines changed: 0 additions & 19 deletions
This file was deleted.

services/traefik/docker-compose.letsencrypt.http.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

services/traefik/docker-compose.master.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

services/traefik/docker-compose.public.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

services/traefik/docker-compose.yml.j2

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,7 @@ services:
44
traefik:
55
image: "traefik:v3.1.2@sha256:ec1a82940b8e00eaeef33fb4113aa1d1573b2ebb6440e10c023743fe96f08475"
66
init: true
7-
command:
8-
- "--api=true"
9-
- "--api.dashboard=true"
10-
- "--accesslog=true"
11-
- "--accesslog.format=json"
12-
- "--accesslog.fields.defaultmode=keep"
13-
- "--accesslog.fields.names.ClientUsername=keep"
14-
- "--accesslog.fields.headers.defaultmode=keep"
15-
- "--accesslog.fields.headers.names.User-Agent=keep"
16-
- "--accesslog.fields.headers.names.Authorization=drop"
17-
- "--accesslog.fields.headers.names.Content-Type=keep"
18-
- "--log.level=${OPS_TRAEFIK_LOGLEVEL}"
19-
- "--metrics.prometheus=true"
20-
- "--metrics.prometheus.addEntryPointsLabels=true"
21-
- "--metrics.prometheus.addServicesLabels=true"
22-
- "--entryPoints.metrics.address=:8082"
23-
- "--metrics.prometheus.entryPoint=metrics"
24-
- "--entryPoints.http.address=:80"
25-
- "--entryPoints.http.transport.respondingTimeouts.idleTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
26-
- "--entryPoints.http.transport.respondingTimeouts.writeTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
27-
- "--entryPoints.http.transport.respondingTimeouts.readTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
28-
- "--entrypoints.http.http.redirections.entrypoint.to=https"
29-
- "--entrypoints.http.http.redirections.entrypoint.scheme=https"
30-
- "--entrypoints.http.http.redirections.entrypoint.permanent=true"
31-
- '--entryPoints.postgres.address=:5432'
32-
- '--entryPoints.postgres2.address=:5433'
33-
- "--entryPoints.https.address=:443"
34-
- "--entryPoints.https.transport.respondingTimeouts.idleTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
35-
- "--entryPoints.https.transport.respondingTimeouts.writeTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
36-
- "--entryPoints.https.transport.respondingTimeouts.readTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
37-
- "--providers.swarm.endpoint=unix:///var/run/docker.sock"
38-
- "--providers.swarm.exposedByDefault=false"
39-
# so that internal services are not picked up
40-
- "--providers.swarm.constraints=!LabelRegex(`io.simcore.zone`, `${TRAEFIK_SIMCORE_ZONE}`)"
41-
- "--core.defaultRuleSyntax=v2"
42-
- "--tracing=true"
43-
- "--tracing.addinternals"
44-
- "--tracing.otlp=true"
45-
- "--tracing.otlp.http=true"
7+
dns: 8.8.8.8
468
ports:
479
- target: 80
4810
published: 80
@@ -62,6 +24,7 @@ services:
6224
volumes:
6325
# So that Traefik can listen to the Docker events
6426
- /var/run/docker.sock:/var/run/docker.sock
27+
- /etc/traefik_certs:/etc/traefik_certs
6528
deploy:
6629
# mode: global
6730
replicas: ${OPS_TRAEFIK_REPLICAS}
@@ -79,6 +42,7 @@ services:
7942
cpus: '1.000'
8043
placement:
8144
constraints:
45+
- node.labels.traefik==true
8246
- node.role == manager
8347
labels:
8448
- traefik.enable=true
@@ -183,12 +147,15 @@ services:
183147
- traefik.http.routers.{{ from_domain_no_dots }}.tls=true
184148

185149
{% endfor %}
186-
150+
env_file:
151+
- .env
187152
networks:
188153
public: null
189154
monitored: null
190155
whoami:
191156
image: "containous/whoami"
157+
dns: # Add this always for AWS, otherwise we get "No such image: " for docker services
158+
8.8.8.8
192159
deploy:
193160
placement:
194161
constraints:

0 commit comments

Comments
 (0)