Skip to content

Commit c37a5a6

Browse files
authored
πŸ› Fix: Make osparc.local functional again - various minor fixes (#894)
* wip * Add csi-s3 and have portainer use it * Change request @Hrytsuk 1GB max portainer volume size * Fix wrong filename * Fix registry local deploy * Traefik local deployment fixes * Fix local deployment graylog provisioning * Fix j2, double venv * Add python version * Idempotency for admin-panels * Remove faulty command * Local deploy fixes * Clean Up Local Minio * Remove unused code * Update Minio --------- Co-authored-by: Dustin Kaiser <[email protected]>
1 parent 76c3ba4 commit c37a5a6

25 files changed

+114
-263
lines changed

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ yq
142142
**/.env-devel
143143
**/.stack.*.yml
144144
**/.stack.*.yaml
145-
./docker-compose.yml
145+
docker-compose.yml
146146
stack.yml
147147
stack_with_prefix.yml
148148
docker-compose.simcore.yml

β€Ž.pylintrcβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ignore-paths=^.*\\generated_models\\.*$|^.*/generated_models/.*$
5858
# Files or directories matching the regex patterns are skipped. The regex
5959
# matches against base names, not paths. The default value ignores Emacs file
6060
# locks
61-
ignore-patterns=venv,.venv
61+
ignore-patterns=venv,.venv,jupyter_server_config.py
6262

6363
# List of module names for which member attributes should not be checked
6464
# (useful for modules/projects where namespaces are manipulated during runtime

β€ŽMakefileβ€Ž

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ certificates/domain.key:
2626
# Done: Creating docker secrets
2727

2828
.PHONY: up-local
29-
up-local: .install-fqdn certificates/domain.crt certificates/domain.key .create-secrets ## deploy osparc ops stacks and simcore, use minio_disabled=1 if minio s3 should not be started (if you have custom S3 set up)
29+
up-local: .init .venv .install-fqdn certificates/domain.crt certificates/domain.key .create-secrets ## deploy osparc ops stacks and simcore, use minio_disabled=1 if minio s3 should not be started (if you have custom S3 set up)
3030
@bash scripts/deployments/deploy_everything_locally.bash --stack_target=local --minio_enabled=0 --vcs_check=1
3131
@$(MAKE) info-local
3232

@@ -71,15 +71,6 @@ down-maintenance: ## Stop the maintenance mode
7171
fi \
7272
,)
7373

74-
75-
.PHONY: venv
76-
venv: .venv ## Creates a python virtual environment with dev tools (pip, pylint, ...)
77-
.venv:
78-
@python3 -m venv .venv
79-
@.venv/bin/pip3 install --upgrade pip wheel setuptools
80-
@.venv/bin/pip3 install typer
81-
@echo "To activate the venv, execute 'source .venv/bin/activate'"
82-
8374
# Misc: info & clean
8475
.PHONY: info info-vars info-local
8576
info: ## Displays some important info

β€Žscripts/common.Makefileβ€Ž

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ VERSION := $(shell uname -a)
77

88
# Checks for handling various operating systems
99
ifeq ($(filter Windows_NT,$(OS)),)
10-
IS_WSL := $(if $(findstring microsoft,$(shell uname -a | tr '[:upper:]' '[:lower:]')),WSL,)
1110
IS_WSL2 := $(if $(findstring -microsoft-,$(shell uname -a)),WSL2,)
1211
IS_OSX := $(filter Darwin,$(shell uname -a))
1312
IS_LINUX:= $(if $(or $(IS_WSL),$(IS_OSX)),,$(filter Linux,$(shell uname -a)))
1413
endif
1514
IS_WIN := $(strip $(if $(or $(IS_LINUX),$(IS_OSX),$(IS_WSL)),,$(OS)))
1615

17-
$(if $(IS_WIN),$(error Windows is not supported in all recipes. Use WSL2 instead. Follow instructions in README.md),)
1816
$(if $(IS_WSL2),,$(if $(IS_WSL),$(error WSL1 is not supported in all recipes. Use WSL2 instead. Follow instructions in README.md),))
1917

2018
# Check that a valid location to a config file is set.
@@ -37,13 +35,13 @@ endif
3735
export DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL:=$(shell set -o allexport; \
3836
source $(REPO_CONFIG_LOCATION); \
3937
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
40-
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$MACHINE_FQDN\`))|| (Host(\`storage.$$MACHINE_FQDN\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
38+
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$MACHINE_FQDN\`))|| (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
4139
else \
4240
IFS=', ' read -r -a hosts <<< "$${DEPLOYMENT_FQDNS}"; \
43-
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$MACHINE_FQDN\`))|| (Host(\`storage.$$MACHINE_FQDN\`)) || (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
41+
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="(Host(\`$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$MACHINE_FQDN\`))|| (HostRegexp(\`services.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$MACHINE_FQDN\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$MACHINE_FQDN\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$MACHINE_FQDN\`) && PathPrefix(\`/\`))"; \
4442
for element in "$${hosts[@]}"; \
4543
do \
46-
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL || (Host(\`$$element\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$element\`)) || (Host(\`storage.$$element\`)) || (HostRegexp(\`services.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$element\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$element\`) && PathPrefix(\`/\`))";\
44+
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL || (Host(\`$$element\`) && PathPrefix(\`/\`)) || (Host(\`invitations.$$element\`)) || (HostRegexp(\`services.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.$$element\`) && PathPrefix(\`/\`)) || (HostRegexp(\`services.testing.$$element\`,\`{subhost:[a-zA-Z0-9-]+}.services.testing.$$element\`) && PathPrefix(\`/\`))";\
4745
done; \
4846
DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL="$$DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_CATCHALL"; \
4947
fi; \
@@ -66,21 +64,6 @@ export DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS:=$(shell set -o allexport; \
6664
echo $$DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS; \
6765
set +o allexport; )
6866
69-
export DEPLOYMENT_FQDNS_CAPTURE_STORAGE:=$(shell set -o allexport; \
70-
source $(REPO_CONFIG_LOCATION); \
71-
if [ -z "$${DEPLOYMENT_FQDNS}" ]; then \
72-
DEPLOYMENT_FQDNS_CAPTURE_STORAGE="(Host(\`storage.$$MACHINE_FQDN\`))"; \
73-
else \
74-
IFS=', ' read -r -a hosts <<< "$${DEPLOYMENT_FQDNS}"; \
75-
DEPLOYMENT_FQDNS_CAPTURE_STORAGE="(Host(\`storage.$$MACHINE_FQDN\`))"; \
76-
for element in "$${hosts[@]}"; \
77-
do \
78-
DEPLOYMENT_FQDNS_CAPTURE_STORAGE="$$DEPLOYMENT_FQDNS_CAPTURE_STORAGE || (Host(\`storage.$$element\`))";\
79-
done; \
80-
DEPLOYMENT_FQDNS_CAPTURE_STORAGE="$$DEPLOYMENT_FQDNS_CAPTURE_STORAGE"; \
81-
fi; \
82-
echo $$DEPLOYMENT_FQDNS_CAPTURE_STORAGE; \
83-
set +o allexport; )
8467
8568
export DEPLOYMENT_FQDNS_CAPTURE_TRAEFIK_RULE_MAINTENANCE_PAGE:=$(shell set -o allexport; \
8669
source $(REPO_CONFIG_LOCATION); \
@@ -207,7 +190,6 @@ clean-default: .check_clean ## Cleans all outputs
207190
export DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_FQDNS_TESTING_CAPTURE_TRAEFIK_RULE}'; \
208191
export DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE='${DEPLOYMENT_API_DOMAIN_TESTING_CAPTURE_TRAEFIK_RULE}'; \
209192
export DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS='${DEPLOYMENT_FQDNS_CAPTURE_INVITATIONS}'; \
210-
export DEPLOYMENT_FQDNS_CAPTURE_STORAGE='${DEPLOYMENT_FQDNS_CAPTURE_STORAGE}'; \
211193
export DOLLAR='$$'; \
212194
set +o allexport; \
213195
envsubst < $< > .env
@@ -243,20 +225,21 @@ clean-default: .check_clean ## Cleans all outputs
243225
# creating virtual environment with tooling (jinja, etc)
244226
@python3 -m venv .venv
245227
@.venv/bin/pip3 install --upgrade pip wheel setuptools
246-
@.venv/bin/pip3 install jinja2 j2cli[yaml]
228+
@.venv/bin/pip3 install jinja2 j2cli[yaml] typer
229+
@echo "To activate the venv, execute 'source .venv/bin/activate'"
247230
248231
249232
# https://github.com/kolypto/j2cli?tab=readme-ov-file#customization
250233
ifeq ($(shell test -f j2cli_customization.py && echo -n yes),yes)
251234
252235
define jinja
253-
.venv/bin/j2 --format=env $(1) .env -o $(2) --customize j2cli_customization.py
236+
$(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) .env -o $(2) --customize j2cli_customization.py
254237
endef
255238
256239
else
257240
258241
define jinja
259-
.venv/bin/j2 --format=env $(1) .env -o $(2)
242+
$(REPO_BASE_DIR)/.venv/bin/j2 --format=env $(1) .env -o $(2)
260243
endef
261244
262245
endif

β€Žscripts/create-s3-bucket.bashβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ IFS=$'\n\t'
1111
docker run \
1212
-v /etc/ssl/certs:/etc/ssl/certs:ro \
1313
--network host \
14-
--env MC_HOST_local="https://${S3_ACCESS_KEY}:${S3_SECRET_KEY}@${S3_ENDPOINT}" \
15-
minio/mc:RELEASE.2023-06-19T19-31-19Z mb --ignore-existing local/"$1"
14+
--env MC_HOST_local="https://${S3_ACCESS_KEY}:${S3_SECRET_KEY}@${STORAGE_DOMAIN}" \
15+
minio/mc:RELEASE.2023-06-19T19-31-19Z mb --insecure --ignore-existing local/"$1"

β€Žscripts/deployments/deploy_everything_locally.shβ€Ž renamed to β€Žscripts/deployments/deploy_everything_locally.bashβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ if [ "$start_opsstack" -eq 0 ]; then
235235
# -------------------------------- ADMIN-PANELS -------------------------------
236236

237237
log_info "starting admin-panels..."
238+
# Check if the stack 'admin-panels' exists and delete it if it does
239+
# shellcheck disable=2015
240+
docker stack ls | grep -q admin-panels && docker stack rm admin-panels >/dev/null 2>&1 || true
238241
# Pushd because a call with call_make trigger a strange behavior
239242
pushd "${repo_basedir}"/services/admin-panels;
240243
call_make "." up-"$stack_target";

β€Žscripts/deployments/start_simcore_locally.bashβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ if [[ "$devel_repo_path" = "0" ]] ; then
7171
#
7272
# IF GETREPO DOESNT EXIST
7373
if [ ! -d osparc-simcore ]; then
74+
export GIT_SIMCORE_REPO_URL="https://github.com/ITISFoundation/osparc-simcore.git"
7475
git clone "$GIT_SIMCORE_REPO_URL"
7576
fi
7677
# FI
@@ -130,8 +131,12 @@ scripts/deployments/compose_stack_yml.bash
130131
log_info "Adding prefix $PREFIX_STACK_NAME to all services..."
131132
./yq "with(.services; with_entries(.key |= \"${PREFIX_STACK_NAME}_\" + .))" stack.yml > stack_with_prefix.yml
132133
log_info "Deleting the $SIMCORE_STACK_NAME docker stack if present"
133-
docker stack rm "$SIMCORE_STACK_NAME" || true
134-
sleep 3 # Wait for stack to be deleted, the networks often take a while, not waiting might lead to docker network creation issues
134+
# Wait for stack to be deleted, the networks often take a while, not waiting might lead to docker network creation issues
135+
# shellcheck disable=2015
136+
docker stack rm "$SIMCORE_STACK_NAME" && sleep 3 || true
137+
log_info "Copying dask-certificates into place"
138+
mkdir -p "$repo_basedir"/services/simcore/dask-sidecar/.dask-certificates
139+
cp -r "$(dirname "${repo_config}")"/assets/dask-certificates/*.pem "$repo_basedir"/services/simcore/dask-sidecar/.dask-certificates
135140
log_info "Deploying: Running docker stack deploy for stack $SIMCORE_STACK_NAME..."
136141

137142
# Retry logic via https://unix.stackexchange.com/a/82610
@@ -141,4 +146,5 @@ for i in {1..5}; do docker stack deploy -c stack_with_prefix.yml "$SIMCORE_STACK
141146

142147
############
143148
# CLEANUP
149+
# shellcheck disable=1073
144150
rm -r "${repo_basedir:?}"/"${tempdirname:?}" 2>/dev/null || true

β€Žscripts/s3-previous-versions/README.mdβ€Ž

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

β€Žscripts/s3-previous-versions/launch.bashβ€Ž

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

β€Žscripts/s3-previous-versions/template.envβ€Ž

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

0 commit comments

Comments
Β (0)