Skip to content

Commit 77752db

Browse files
committed
include maintenance
1 parent 0ccf48e commit 77752db

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

scripts/common.Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,19 @@ clean-default: .check_clean ## Cleans all outputs
246246
@.venv/bin/pip3 install jinja2 j2cli[yaml]
247247
248248
249-
# if j2cli_customization.py exists, include it
250249
# https://github.com/kolypto/j2cli?tab=readme-ov-file#customization
251250
ifeq ($(shell test -f j2cli_customization.py && echo -n yes),yes)
251+
252252
define jinja
253253
.venv/bin/j2 --format=env $(1) .env -o $(2) --customize j2cli_customization.py
254254
endef
255+
255256
else
257+
256258
define jinja
257259
.venv/bin/j2 --format=env $(1) .env -o $(2)
258260
endef
261+
259262
endif
260263
261264
# Gracefully use defaults and potentially overwrite them, via https://stackoverflow.com/a/49804748

services/maintenance-page/docker-compose.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
- traefik.enable=true
2929
- traefik.docker.network=${PUBLIC_NETWORK}
3030
- traefik.http.routers.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.priority={{MAINTENANCE_PAGES_TRAEFIK_PRIORITY}}
31-
- traefik.http.routers.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.rule=Host(`manual.{{j2item}}`) || (Host(`{{j2item}}`) && PathPrefix(`/`)) || (HostRegexp(`services.{{j2item}}`,`{subhost:[a-zA-Z0-9-]+}.services.{{j2item}}`) && PathPrefix(`/`))
31+
- traefik.http.routers.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.rule=Host(`{{VENDOR_MANUAL_SUBDOMAIN_PREFIX}}.{{j2item}}`) || (Host(`{{j2item}}`) && PathPrefix(`/`)) || (HostRegexp(`services.{{j2item}}`,`{subhost:[a-zA-Z0-9-]+}.services.{{j2item}}`) && PathPrefix(`/`))
3232
- traefik.http.routers.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.tls=true
3333
- traefik.http.services.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.loadbalancer.server.port=80
3434
- traefik.http.routers.{{"maintenance_" + j2item.replace('@','').replace(' ','').replace('.','').replace('-','').replace('\'','') + "_html"}}.entrypoints=https

services/maintenance-page/template.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ PUBLIC_NETWORK=${PUBLIC_NETWORK}
88
MONITORED_NETWORK=${MONITORED_NETWORK}
99
REPO_CONFIG_LOCATION=${REPO_CONFIG_LOCATION}
1010
MAINTENANCE_PAGES_TRAEFIK_PRIORITY=${MAINTENANCE_PAGES_TRAEFIK_PRIORITY}
11+
VENDOR_MANUAL_SUBDOMAIN_PREFIX=${VENDOR_MANUAL_SUBDOMAIN_PREFIX}

services/vendors/docker-compose.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
- traefik.http.services.vendor_manual.loadbalancer.server.port=${VENDOR_MANUAL_PORT}
3131
- traefik.http.routers.vendor_manual.entrypoints=https
3232
- traefik.http.routers.vendor_manual.tls=true
33-
- traefik.http.routers.vendor_manual.rule={{ generate_vendors_manual_traefik_rule(VENDOR_MANUAL_DOMAINS) }}
33+
- traefik.http.routers.vendor_manual.rule={{ generate_vendors_manual_traefik_rule(VENDOR_MANUAL_PRODUCTS, VENDOR_MANUAL_SUBDOMAIN_PREFIX) }}
3434
- traefik.http.routers.vendor_manual.middlewares=ops_gzip@swarm, authenticated_platform_user@swarm
3535
networks:
3636
- public
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
def _vendors_manual_traefik_rule(domains):
2-
return " || ".join(
3-
f"Host(`{domain.strip()}`)" for domain in domains.strip().strip(",").split(",")
4-
)
1+
def _generate_vendors_manual_traefik_rule(domains: str, subdomain_prefix: str) -> str:
2+
domain_list = domains.strip().strip(",").split(",")
3+
domains = [f"{subdomain_prefix}.{domain}" for domain in domain_list]
4+
return " || ".join(domains)
55

66

77
def j2_environment(env):
88
env.globals.update(
9-
generate_vendors_manual_traefik_rule=_vendors_manual_traefik_rule
9+
generate_vendors_manual_traefik_rule=_generate_vendors_manual_traefik_rule
1010
)
1111
return env

services/vendors/template.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
VENDOR_MANUAL_IMAGE=${VENDOR_MANUAL_IMAGE}
22
VENDOR_MANUAL_REPLICAS=${VENDOR_MANUAL_REPLICAS}
3-
VENDOR_MANUAL_DOMAINS=${VENDOR_MANUAL_DOMAINS}
3+
VENDOR_MANUAL_SUBDOMAIN_PREFIX=${VENDOR_MANUAL_SUBDOMAIN_PREFIX}
4+
VENDOR_MANUAL_PRODUCTS=${VENDOR_MANUAL_PRODUCTS}
45
VENDOR_MANUAL_PORT=${VENDOR_MANUAL_PORT}
56
PUBLIC_NETWORK=${PUBLIC_NETWORK}

0 commit comments

Comments
 (0)