Skip to content

Commit c682845

Browse files
committed
Merge remote-tracking branch 'upstream/main' into 2024/add/tempo
2 parents 3c2ff2b + 382f7cf commit c682845

File tree

9 files changed

+71
-42
lines changed

9 files changed

+71
-42
lines changed

scripts/common.Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ export DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE:=$(shell set -o allexport;
9797
echo $$DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE; \
9898
set +o allexport; )
9999
100+
export DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE:=$(shell set -o allexport; \
101+
source $(REPO_CONFIG_LOCATION); \
102+
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
103+
DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE="(Host(\`www.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
104+
else \
105+
IFS=', ' read -r -a hosts <<< "$${DEPLOYMENT_FQDNS}"; \
106+
DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE="(Host(\`www.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
107+
for element in "$${hosts[@]}"; \
108+
do \
109+
DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE="$$DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE || (Host(\`www.$$element\`) && PathPrefix(\`/\`))";\
110+
done; \
111+
DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE="$$DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE"; \
112+
fi; \
113+
echo $$DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE; \
114+
set +o allexport; )
115+
100116
export DEPLOYMENT_FQDNS_APPMOTION_CAPTURE_TRAEFIK_RULE:=$(shell set -o allexport; \
101117
source $(REPO_CONFIG_LOCATION); \
102118
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
@@ -221,13 +237,17 @@ clean-default: .check_clean ## Cleans all outputs
221237
fi
222238
223239
# Helpers -------------------------------------------------
224-
.venv:
240+
# Replace the existing .venv target with the following
241+
$(REPO_BASE_DIR)/.venv/bin/activate:
225242
# creating virtual environment with tooling (jinja, etc)
226-
@python3 -m venv .venv
227-
@.venv/bin/pip3 install --upgrade pip wheel setuptools
228-
@.venv/bin/pip3 install jinja2 j2cli[yaml] typer
229-
@echo "To activate the venv, execute 'source .venv/bin/activate'"
230-
243+
python3 -m venv $(REPO_BASE_DIR)/.venv
244+
$(REPO_BASE_DIR)/.venv/bin/pip3 install --upgrade pip wheel setuptools
245+
$(REPO_BASE_DIR)/.venv/bin/pip3 install jinja2 j2cli[yaml] typer
246+
@echo "To activate the venv, execute 'source $(REPO_BASE_DIR)/.venv/bin/activate'"
247+
PHONY: .venv
248+
.venv: $(REPO_BASE_DIR)/.venv/bin/activate ## Creates a python virtual environment with dev tools (pip, pylint, ...)
249+
.PHONY: venv
250+
venv: $(REPO_BASE_DIR)/.venv/bin/activate ## Creates a python virtual environment with dev tools (pip, pylint, ...)
231251
232252
# https://github.com/kolypto/j2cli?tab=readme-ov-file#customization
233253
ifeq ($(shell test -f j2cli_customization.py && echo -n yes),yes)

services/admin-panels/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include ${REPO_BASE_DIR}/scripts/common.Makefile
1313

1414
# Helpers --------------------------------------------------
1515
define custom-jinja
16-
@.venv/bin/j2 --format=json $(1) $(2) -o $(3)
16+
@${REPO_BASE_DIR}/.venv/bin/j2 --format=json $(1) $(2) -o $(3)
1717
endef
1818

1919
.PHONY: .data.json

services/admin-panels/jupyter_server_config.py.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: skip-file
12
c.ServerApp.ip = '0.0.0.0'
23
c.ServerApp.port = 8888
34
c.ServerApp.open_browser = False

services/graylog/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,9 @@ ${TEMP_COMPOSE}-aws: docker-compose.yml docker-compose.aws.yml
9292

9393

9494
.PHONY: configure
95-
configure: .env ## Test is Graylog is online and configure Graylog inputs
95+
configure: .env .venv ## Test is Graylog is online and configure Graylog inputs
9696
@cd scripts;\
97-
if [ ! -d ".venv" ]; \
98-
then\
99-
python3 -m venv .venv;\
100-
fi;\
101-
source .venv/bin/activate;\
97+
source ${REPO_BASE_DIR}/.venv/bin/activate;\
10298
pip install -r requirements.txt > /dev/null 2>&1;\
10399
set -o allexport; \
104100
source ../$<;\

services/monitoring/Makefile

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,16 @@ update.grafana.pwd: .env ## Change grafana pwd
8686

8787

8888
.PHONY: grafana-export
89-
grafana-export: ## Export the remote grafana dashboards and datasources TO YOUR LOCAL MACHINE
89+
grafana-export: .venv## Export the remote grafana dashboards and datasources TO YOUR LOCAL MACHINE
9090
@cd grafana/scripts;\
91-
if [ ! -d ".venv" ]; \
92-
then\
93-
python3 -m venv .venv;\
94-
fi;\
95-
source .venv/bin/activate;\
91+
source ${REPO_BASE_DIR}/.venv/bin/activate;\
9692
pip install -r requirements.txt > /dev/null 2>&1;\
9793
python3 export.py;
9894

9995
.PHONY: grafana-import
100-
grafana-import: grafana/assets ## Imports AND OVERWRITES the remote grafana dashboards and datasources FROM YOUR LOCAL MACHINE
96+
grafana-import: grafana/assets .venv ## Imports AND OVERWRITES the remote grafana dashboards and datasources FROM YOUR LOCAL MACHINE
10197
@cd grafana/scripts;\
102-
if [ ! -d ".venv" ]; \
103-
then\
104-
python3 -m venv .venv;\
105-
fi;\
106-
source .venv/bin/activate;\
98+
source ${REPO_BASE_DIR}/.venv/bin/activate;\
10799
pip install -r requirements.txt > /dev/null 2>&1;\
108100
python3 import.py
109101

services/simcore/docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ services:
869869

870870
dynamic-schdlr:
871871
networks:
872+
- public
872873
- monitored
873874
deploy:
874875
replicas: 2
@@ -882,6 +883,16 @@ services:
882883
reservations:
883884
memory: 50M
884885
cpus: '0.1'
886+
labels:
887+
- traefik.enable=true
888+
- traefik.docker.network=${PUBLIC_NETWORK}
889+
- traefik.http.services.${PREFIX_STACK_NAME}_dynamic_scheduler.loadbalancer.server.port=8000
890+
- traefik.http.routers.${PREFIX_STACK_NAME}_dynamic_scheduler.rule=Host(`${MONITORING_DOMAIN}`) && PathPrefix(`/dynamic-scheduler`)
891+
- traefik.http.routers.${PREFIX_STACK_NAME}_dynamic_scheduler.entrypoints=https
892+
- traefik.http.routers.${PREFIX_STACK_NAME}_dynamic_scheduler.tls=true
893+
- traefik.http.middlewares.${PREFIX_STACK_NAME}_dynamic_scheduler_replace_regex.replacepathregex.regex=^/dynamic-scheduler/(.*)$$
894+
- traefik.http.middlewares.${PREFIX_STACK_NAME}_dynamic_scheduler_replace_regex.replacepathregex.replacement=/$${1}
895+
- traefik.http.routers.${PREFIX_STACK_NAME}_dynamic_scheduler.middlewares=${PREFIX_STACK_NAME}_dynamic_scheduler_replace_regex@swarm, ops_gzip@swarm, ops_auth@swarm
885896

886897
volumes:
887898
rabbit_data:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
traefik:
44
deploy:
55
labels:
6-
- traefik.http.routers.wwwsecure-catchall.tls.certresolver=myresolver
6+
- traefik.http.routers.www-catchall.tls.certresolver=myresolver
77
- traefik.http.routers.api.tls.certresolver=myresolver
88
- traefik.http.middlewares.ops_whitelist_ips.ipallowlist.sourcerange=${TRAEFIK_IPWHITELIST_SOURCERANGE}
99
# What follows is a tested workaround to ensure letsencrypt certificates for products' domains are generated

services/traefik/docker-compose.yml.j2

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ services:
77
command:
88
- "--api=true"
99
- "--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"
1018
- "--log.level=${OPS_TRAEFIK_LOGLEVEL}"
11-
- "--accesslog=false"
1219
- "--metrics.prometheus=true"
1320
- "--metrics.prometheus.addEntryPointsLabels=true"
1421
- "--metrics.prometheus.addServicesLabels=true"
@@ -18,9 +25,9 @@ services:
1825
- "--entryPoints.http.transport.respondingTimeouts.idleTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
1926
- "--entryPoints.http.transport.respondingTimeouts.writeTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
2027
- "--entryPoints.http.transport.respondingTimeouts.readTimeout=21600s" #6h, for https://github.com/traefik/traefik/issues/10805
21-
- --entrypoints.http.http.redirections.entrypoint.to=https
22-
- --entrypoints.http.http.redirections.entrypoint.scheme=https
23-
- --entrypoints.http.http.redirections.entrypoint.permanent=true
28+
- "--entrypoints.http.http.redirections.entrypoint.to=https"
29+
- "--entrypoints.http.http.redirections.entrypoint.scheme=https"
30+
- "--entrypoints.http.http.redirections.entrypoint.permanent=true"
2431
- '--entryPoints.postgres.address=:5432'
2532
- '--entryPoints.postgres2.address=:5433'
2633
- "--entryPoints.https.address=:443"
@@ -90,16 +97,12 @@ services:
9097
# via https://community.traefik.io/t/v2-2-8-global-redirect-www-to-non-www-with-http-to-https/7428
9198
# see also: https://community.traefik.io/t/get-a-valid-ssl-certificate-for-www-domains-via-traefik-and-lets-encrypt/2023
9299
# Global redirection: https (www.) to https
93-
- traefik.http.routers.wwwsecure-catchall.rule=HostRegexp(`(?P<host>(www\.).+)`)
94-
- traefik.http.routers.wwwsecure-catchall.entrypoints=https
95-
- traefik.http.routers.wwwsecure-catchall.tls=true
96-
- traefik.http.routers.wwwsecure-catchall.middlewares=wwwtohttps
97-
# middleware: http(s)://(www.) to https://
98-
- traefik.http.middlewares.wwwtohttps.redirectregex.regex=^https?://(?:www\.)?(.+)
99-
- traefik.http.middlewares.wwwtohttps.redirectregex.replacement=https://$${1}
100-
- traefik.http.middlewares.wwwtohttps.redirectregex.permanent=true
101-
# Explicit www domain certificate
102-
- traefik.http.routers.wwwsecure-catchall.tls.domains[0].main=www.${MACHINE_FQDN}
100+
- traefik.http.routers.www-catchall.rule={{ DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE.strip("\"") }}
101+
- traefik.http.routers.www-catchall.priority=100000
102+
- traefik.http.routers.www-catchall.entrypoints=https,http
103+
- traefik.http.routers.www-catchall.tls=true
104+
- traefik.http.routers.www-catchall.middlewares=strip-www
105+
103106
###########################
104107
# basic authentication
105108
# Note: all dollar signs in the hash need to be doubled for escaping.
@@ -137,6 +140,12 @@ services:
137140
- traefik.http.middlewares.authenticated_platform_user.forwardauth.address=http://${WEBSERVER_HOST}:${WEBSERVER_PORT}/v0/auth:check
138141
- traefik.http.middlewares.authenticated_platform_user.forwardauth.trustForwardHeader=true
139142
- traefik.http.middlewares.authenticated_platform_user.forwardauth.authResponseHeaders=Set-Cookie,osparc-sc2
143+
#
144+
# middleware: http(s)://(www.) to https://
145+
- traefik.http.middlewares.strip-www.redirectregex.regex=^(https?)://www\.(.+)
146+
- traefik.http.middlewares.strip-www.redirectregex.replacement=$${1}://$${2}
147+
- traefik.http.middlewares.strip-www.redirectregex.permanent=true
148+
140149
networks:
141150
public: null
142151
monitored: null
@@ -145,7 +154,7 @@ services:
145154
deploy:
146155
placement:
147156
constraints:
148-
- node.labels.ops==true
157+
- node.labels.traefik==true
149158
labels:
150159
- traefik.enable=true
151160
- traefik.docker.network=${PUBLIC_NETWORK}

services/traefik/template.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CERTIFICATE_GENERATION_FQDNS='${CERTIFICATE_GENERATION_FQDNS}'
3131
CERTIFICATE_RESOLVE_DNS_CHALLANGE_IP=${CERTIFICATE_RESOLVE_DNS_CHALLANGE_IP}
3232
OPS_TRAEFIK_LETSENCRYPT_ACME_CA_SERVER=${OPS_TRAEFIK_LETSENCRYPT_ACME_CA_SERVER}
3333
OPS_TRAEFIK_LOGLEVEL=${OPS_TRAEFIK_LOGLEVEL}
34-
34+
DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE="${DEPLOYMENT_FQDNS_WWW_CAPTURE_TRAEFIK_RULE}"
3535
PUBLIC_NETWORK=${PUBLIC_NETWORK}
3636
MONITORED_NETWORK=${MONITORED_NETWORK}
3737

0 commit comments

Comments
 (0)