feature DEPLOY_START_DELAY, adds a delay when (re)starting targets after deployment

This commit is contained in:
Andreas Neue 2023-05-08 11:47:06 +02:00
parent 6ab5e15f8a
commit 0c93338e86
6 changed files with 8 additions and 3 deletions

View File

@ -98,14 +98,12 @@ endif
pull: pull-$(DEPLOY_TYPE) pull: pull-$(DEPLOY_TYPE)
start: start-$(DEPLOY_TYPE) start: start-$(DEPLOY_TYPE)
sleep $(DEPLOY_START_DELAY)
stop: stop-$(DEPLOY_TYPE) stop: stop-$(DEPLOY_TYPE)
logs: logs-$(DEPLOY_TYPE) logs: logs-$(DEPLOY_TYPE)
restart: restart-$(DEPLOY_TYPE) restart: restart-$(DEPLOY_TYPE)
sleep $(DEPLOY_START_DELAY)
reload: reload:
ifneq (,$(wildcard reload.sh)) ifneq (,$(wildcard reload.sh))

1
apt.mk
View File

@ -8,4 +8,5 @@ start-apt:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "apt install -y $APT_PACKAGES; sh start.sh"; \ ssh $(SSH_USER)@$(host) "apt install -y $APT_PACKAGES; sh start.sh"; \
sleep $(DEPLOY_START_DELAY); \
) )

View File

@ -17,6 +17,7 @@ start-compose-file:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) up -d"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) up -d"; \
sleep $(DEPLOY_START_DELAY); \
) )
stop-compose-file: stop-compose-file:
@ -34,4 +35,5 @@ restart-compose-file:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) restart"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) restart"; \
sleep $(DEPLOY_START_DELAY); \
) )

View File

@ -17,6 +17,7 @@ start-compose:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \
sleep $(DEPLOY_START_DELAY); \
) )
stop-compose: stop-compose:
@ -34,4 +35,5 @@ restart-compose:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \
sleep $(DEPLOY_START_DELAY); \
) )

View File

@ -12,4 +12,5 @@ start-copy:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh start.sh"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh start.sh"; \
sleep $(DEPLOY_START_DELAY); \
) )

View File

@ -5,6 +5,7 @@ start-cron:
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "crontab -l | sed \"/^#make-deploy-cron:$(DEPLOY_NAME)/,+1 d\" | { cat; echo \"#make-deploy-cron:$(DEPLOY_NAME)\"; cat \"$(DEPLOY_PATH)/$(DEPLOY_NAME)/crontab\"; } | crontab -"; \ ssh $(SSH_USER)@$(host) "crontab -l | sed \"/^#make-deploy-cron:$(DEPLOY_NAME)/,+1 d\" | { cat; echo \"#make-deploy-cron:$(DEPLOY_NAME)\"; cat \"$(DEPLOY_PATH)/$(DEPLOY_NAME)/crontab\"; } | crontab -"; \
sleep $(DEPLOY_START_DELAY); \
) )
stop-cron: stop-cron: