fix install on new host

This commit is contained in:
Yann Autissier
2022-07-06 23:27:41 +02:00
parent e06266489c
commit 07a9729c73
26 changed files with 162 additions and 132 deletions
+4 -4
View File
@@ -81,10 +81,10 @@ exec@%: SERVICE ?= $(DOCKER_SERVICE)
exec@%:
$(call make,ssh-exec,$(MYOS),APP ARGS SERVICE)
# target force-%: Fire targets % and stack-node-%
# target force-%: Fire targets %, stack-user-% and stack-node-%
# on local host
.PHONY: force-%
force-%: % stack-node-%;
force-%: % stack-user-% stack-node-%;
# target install app-install: Install application
# on local host
@@ -169,7 +169,7 @@ ssh@%:
# target stack: Call docker-stack for each STACK
## it updates COMPOSE_FILE with all .yml files of the current stack
.PHONY: stack
stack: docker-network-create
stack:
$(foreach stackz,$(STACK),$(call docker-stack,$(stackz)))
# target stack-%: Call docker-compose-% target on STACK
@@ -202,7 +202,7 @@ tests: app-tests ## Test application
# target up: Create and start application dockers
# on local host
.PHONY: up
up: stack-required docker-compose-up app-start ## Create application dockers
up: docker-compose-up app-start ## Create application dockers
# target update app-update: Update application files
# on local host
+1 -1
View File
@@ -61,7 +61,7 @@ endif
define docker-compose
$(call INFO,docker-compose,$(1))
$(if $(DOCKER_RUN),$(call docker-build,$(MYOS)/docker/compose,docker/compose:$(COMPOSE_VERSION)))
$(if $(COMPOSE_FILE),$(call run,$(DOCKER_COMPOSE) $(patsubst %,-f %,$(COMPOSE_FILE)) -p $(if $(filter node,$(firstword $(subst /, ,$(STACK)))),$(COMPOSE_PROJECT_NAME_NODE),$(COMPOSE_PROJECT_NAME)) $(1)))
$(if $(COMPOSE_FILE),$(call run,$(DOCKER_COMPOSE) $(patsubst %,-f %,$(COMPOSE_FILE)) -p $(if $(filter node,$(firstword $(subst /, ,$(STACK)))),$(COMPOSE_PROJECT_NAME_NODE),$(if $(filter User,$(firstword $(subst /, ,$(STACK)))),$(COMPOSE_PROJECT_NAME_USER),$(COMPOSE_PROJECT_NAME))) $(1)))
endef
# function docker-compose-exec: Run docker-compose-exec with arg 2 in service 1
define docker-compose-exec
+9 -5
View File
@@ -110,7 +110,7 @@ docker-compose-stop:
# target docker-compose-up: Fire docker-image-myos, Call docker-compose up SERVICE
.PHONY: docker-compose-up
docker-compose-up: DOCKER_RUN_OPTIONS += -it
docker-compose-up: docker-images-myos
docker-compose-up: docker-images-myos bootstrap-stack
$(call docker-compose,up $(DOCKER_COMPOSE_UP_OPTIONS) $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-images-myos: Call myos-docker-build-% target for each DOCKER_IMAGES_MYOS
@@ -141,8 +141,10 @@ docker-network-create: docker-network-create-$(DOCKER_NETWORK)
.PHONY: docker-network-create-%
docker-network-create-%:
if [ -z "$(shell docker network ls -q --filter name='^$*$$' 2>/dev/null)" ]; then \
$(RUN) sh -c 'docker network create $* >/dev/null' \
&& $(or $(call INFO,docker network $* created), true); fi \
$(RUN) sh -c 'docker network create $* >/dev/null 2>&1' \
&& $(or $(call INFO,docker network $* created), true) \
||: ; \
fi
# target docker-network-rm: Fire docker-network-rm-% for DOCKER_NETWORK
.PHONY: docker-network-rm
@@ -152,8 +154,10 @@ docker-network-rm: docker-network-rm-$(DOCKER_NETWORK)
.PHONY: docker-network-rm-%
docker-network-rm-%:
if [ -n "$(shell docker network ls -q --filter name='^$*$$' 2>/dev/null)" ]; then \
$(RUN) docker network rm $* >/dev/null \
&& $(or $(call INFO,docker network $* removed), true); fi \
$(RUN) sh -c 'docker network rm $* >/dev/null 2>&1' \
&& $(or $(call INFO,docker network $* removed), true) \
||: ; \
fi
# target docker-plugin-install: Run 'docker plugin install DOCKER_PLUGIN_OPTIONS DOCKER_PLUGIN'
.PHONY: docker-plugin-install
+1 -1
View File
@@ -9,7 +9,7 @@ ifeq ($(or $(filter $(USER),$(subst $(comma), ,$(shell awk -F':' '$$1 == "docker
$(call ansible-user-add-groups,$(USER),docker)
$(call WARNING,user,$(USER),added in group,docker)
endif
ifeq ($(filter 0 $(DOCKER_GID),$(shell id -G)),)
ifeq ($(filter 0 $(DOCKER_GID),$(GIDS)),)
$(call ERROR,YOU MUST LOGOUT NOW AND LOGIN BACK TO GET DOCKER GROUP MEMBERSHIP)
endif
endif