Skip to content

Commit 5396bda

Browse files
authored
🐛Traefik v3: adapt Go regexp (2nd trial) (#6273)
1 parent 7336ce5 commit 5396bda

File tree

2 files changed

+5
-40
lines changed

2 files changed

+5
-40
lines changed

services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/docker_service_specs/proxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_dynamic_proxy_spec(
9191
f"traefik.http.services.{scheduler_data.proxy_service_name}.loadbalancer.server.port": "80",
9292
f"traefik.http.routers.{scheduler_data.proxy_service_name}.entrypoints": "http",
9393
f"traefik.http.routers.{scheduler_data.proxy_service_name}.priority": "10",
94-
f"traefik.http.routers.{scheduler_data.proxy_service_name}.rule": rf"HostRegexp(`{scheduler_data.node_uuid}.services.{{host:.+}}`)",
94+
f"traefik.http.routers.{scheduler_data.proxy_service_name}.rule": rf"HostRegexp(`{scheduler_data.node_uuid}\.services\.(?P<host>.+)`)",
9595
f"traefik.http.routers.{scheduler_data.proxy_service_name}.middlewares": f"{dynamic_services_scheduler_settings.SWARM_STACK_NAME}_gzip@swarm, {scheduler_data.proxy_service_name}-security-headers",
9696
"dynamic_type": "dynamic-sidecar", # tagged as dynamic service
9797
}

services/docker-compose.yml

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ services:
541541
- traefik.http.routers.${SWARM_STACK_NAME}_modern_services_catchall.priority=3
542542
- traefik.http.routers.${SWARM_STACK_NAME}_modern_services_catchall.entrypoints=http
543543
# in theory the pattern should be uuid.services.OSPARC_DOMAIN, but anything could go through.. so let's catch everything
544-
- traefik.http.routers.${SWARM_STACK_NAME}_modern_services_catchall.rule=HostRegexp(`{node_uuid:(?i)[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}}.services.{host:.+}`)
544+
- traefik.http.routers.${SWARM_STACK_NAME}_modern_services_catchall.rule=HostRegexp(`(?P<node_uuid>(?i)[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})\\.services\\.(?P<host>.+)`)
545545
# this tricks traefik into a 502 (bad gateway) since the service does not exist on this port
546546
- traefik.http.services.${SWARM_STACK_NAME}_modern_services_catchall.loadbalancer.server.port=0
547547
# this tricks traefik into returning a 503 (service unavailable) since the healthcheck will always return false
@@ -606,7 +606,6 @@ services:
606606
DIRECTOR_V2_HOST: ${DIRECTOR_V2_HOST}
607607
DIRECTOR_V2_PORT: ${DIRECTOR_V2_PORT}
608608

609-
610609
# WEBSERVER_EMAIL
611610
WEBSERVER_EMAIL: ${WEBSERVER_EMAIL}
612611
SMTP_HOST: ${SMTP_HOST}
@@ -1092,15 +1091,7 @@ services:
10921091
- default
10931092
- interactive_services_subnet
10941093
healthcheck:
1095-
test:
1096-
[
1097-
"CMD",
1098-
"pg_isready",
1099-
"--username",
1100-
"${POSTGRES_USER}",
1101-
"--dbname",
1102-
"${POSTGRES_DB}"
1103-
]
1094+
test: [ "CMD", "pg_isready", "--username", "${POSTGRES_USER}", "--dbname", "${POSTGRES_DB}" ]
11041095
interval: 5s
11051096
retries: 5
11061097
# NOTES: this is not yet compatible with portainer deployment but could work also for other containers
@@ -1113,20 +1104,7 @@ services:
11131104
# - net.ipv4.tcp_keepalive_intvl=600
11141105
# - net.ipv4.tcp_keepalive_probes=9
11151106
# - net.ipv4.tcp_keepalive_time=600
1116-
command:
1117-
[
1118-
"postgres",
1119-
"-c",
1120-
"tcp_keepalives_idle=600",
1121-
"-c",
1122-
"tcp_keepalives_interval=600",
1123-
"-c",
1124-
"tcp_keepalives_count=5",
1125-
"-c",
1126-
"max_connections=413",
1127-
"-c",
1128-
"shared_buffers=256MB"
1129-
]
1107+
command: [ "postgres", "-c", "tcp_keepalives_idle=600", "-c", "tcp_keepalives_interval=600", "-c", "tcp_keepalives_count=5", "-c", "max_connections=413", "-c", "shared_buffers=256MB" ]
11301108

11311109
redis:
11321110
image: "redis:6.2.6@sha256:4bed291aa5efb9f0d77b76ff7d4ab71eee410962965d052552db1fb80576431d"
@@ -1137,19 +1115,7 @@ services:
11371115
# also aof (append only) is also enabled such that we get full durability at the expense
11381116
# of backup size. The backup is written into /data.
11391117
# https://redis.io/topics/persistence
1140-
[
1141-
"redis-server",
1142-
"--save",
1143-
"60 1",
1144-
"--loglevel",
1145-
"verbose",
1146-
"--databases",
1147-
"8",
1148-
"--appendonly",
1149-
"yes",
1150-
"--requirepass",
1151-
"${REDIS_PASSWORD}"
1152-
]
1118+
[ "redis-server", "--save", "60 1", "--loglevel", "verbose", "--databases", "8", "--appendonly", "yes", "--requirepass", "${REDIS_PASSWORD}" ]
11531119
networks:
11541120
- default
11551121
- autoscaling_subnet
@@ -1221,7 +1187,6 @@ services:
12211187
- default
12221188
- interactive_services_subnet # for legacy dynamic services
12231189

1224-
12251190
volumes:
12261191
postgres_data:
12271192
name: ${SWARM_STACK_NAME}_postgres_data

0 commit comments

Comments
 (0)