@@ -15,42 +15,38 @@ include ${REPO_BASE_DIR}/scripts/common.Makefile
1515.PHONY : up # # Deploys portainer stack
1616up : .init .env secrets ${TEMP_COMPOSE}
1717 @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} ${STACK_NAME}
18+ @$(MAKE ) --noprint configure-portainer-registry
1819
1920.PHONY : up-local # # Deploys portainer stack for local deployment
2021up-local : .init .env secrets ${TEMP_COMPOSE} ${TEMP_COMPOSE}-local
2122 @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} -local ${STACK_NAME}
23+ @$(MAKE ) --noprint configure-portainer-registry
2224
2325.PHONY : up-dalco # # Deploys portainer stack for Dalco Cluster
2426up-dalco : .init .env secrets ${TEMP_COMPOSE}-dalco
2527 @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} -dalco ${STACK_NAME}
28+ @$(MAKE ) --noprint configure-portainer-registry
2629
2730.PHONY : up-aws # # Deploys portainer stack for AWS
2831up-aws : .init .env secrets ${TEMP_COMPOSE}-aws
2932 @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} -aws ${STACK_NAME}
33+ @$(MAKE ) --noprint configure-portainer-registry
3034
3135.PHONY : up-public # # Deploys portainer stack for public access Cluster
3236up-public : up-dalco
3337
3438.PHONY : up-master # # Deploys portainer stack for master Cluster
3539up-master : .init .env secrets ${TEMP_COMPOSE}-master
3640 @docker stack deploy --with-registry-auth --prune --compose-file ${TEMP_COMPOSE} -master ${STACK_NAME}
41+ @$(MAKE ) --noprint configure-portainer-registry
3742
3843
39- .PHONY : configure-registry
40- configure-registry : # # Add if necessary dockerhub registry configuration to portainer.
41- @set -o allexport; \
42- source $(REPO_CONFIG_LOCATION ) ; \
43- set +o allexport; \
44- while [ " $$ (curl -s -o /dev/null -I -w " %{http_code}" --max-time 10 -H " Accept: application/json" -H " Content-Type: application/json" -X GET https://" $$ MONITORING_DOMAIN" /portainer/#/auth)" != 200 ]; do\
45- echo " waiting for portainer to run..." ; \
46- sleep 5s; \
47- done ; \
48- echo " Updating docker-hub config" ; \
49- authentificationToken=$$(curl -o /dev/null -X POST "https://"$$MONITORING_DOMAIN"/portainer/api/auth" -H "Content-Type: application/json" -d "{ \"Username\": \"$${PORTAINER_ADMIN_LOGIN}\", \"Password\": \"$${PORTAINER_ADMIN_PWD}\"}" ) ; \
50- authentificationToken=$$(echo "$$authentificationToken" | jq --raw-output '.jwt' ) ; \
51- update_hub=$$(curl -o /dev/null -X PUT "https://"$$MONITORING_DOMAIN"/portainer/api/dockerhub" -H "accept: application/json" -H \
52- " Authorization: Bearer $$ {authentificationToken}" -H " Content-Type: application/json" \
53- -d " { \" Authentication\" : true, \" Username\" : \" $$ DOCKER_HUB_LOGIN\" , \" Password\" : \" $$ DOCKER_HUB_PASSWORD\" }" ); \
44+ .PHONY : configure-portainer-registry
45+ configure-portainer-registry : venv $(VENV_BIN ) /python $(WAIT_FOR_IT ) # # Add if necessary dockerhub registry configuration to portainer.
46+ @$(MAKE ) --no-print install REQUIREMENTS_FILE=./scripts/requirements.txt
47+ @set -o allexport; source $(REPO_CONFIG_LOCATION ) ; set +o allexport; \
48+ $(WAIT_FOR_IT ) http $$ PORTAINER_URL --timeout=120s --interval=5s --expect-status-code 200 && \
49+ $(VENV_BIN ) /python ./scripts/configure_portainer_registry.py
5450
5551
5652# Helpers -------------------------------------------------
0 commit comments