From 0c93338e8648ac5d940727188054efa25c78ee49 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Mon, 8 May 2023 11:47:06 +0200 Subject: [PATCH] feature DEPLOY_START_DELAY, adds a delay when (re)starting targets after deployment --- Makefile | 4 +--- apt.mk | 1 + compose-file.mk | 2 ++ compose.mk | 2 ++ copy.mk | 1 + cron.mk | 1 + 6 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2f0fafc..508bf0b 100644 --- a/Makefile +++ b/Makefile @@ -98,14 +98,12 @@ endif pull: pull-$(DEPLOY_TYPE) start: start-$(DEPLOY_TYPE) - sleep $(DEPLOY_START_DELAY) - + stop: stop-$(DEPLOY_TYPE) logs: logs-$(DEPLOY_TYPE) restart: restart-$(DEPLOY_TYPE) - sleep $(DEPLOY_START_DELAY) reload: ifneq (,$(wildcard reload.sh)) diff --git a/apt.mk b/apt.mk index f41372a..0486ec5 100644 --- a/apt.mk +++ b/apt.mk @@ -8,4 +8,5 @@ start-apt: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ ssh $(SSH_USER)@$(host) "apt install -y $APT_PACKAGES; sh start.sh"; \ + sleep $(DEPLOY_START_DELAY); \ ) diff --git a/compose-file.mk b/compose-file.mk index eb88fe7..0d1c7c9 100644 --- a/compose-file.mk +++ b/compose-file.mk @@ -17,6 +17,7 @@ start-compose-file: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ 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: @@ -34,4 +35,5 @@ restart-compose-file: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose -f $(DEPLOY_COMPOSE_FILE) -p $(DEPLOY_COMPOSE_PROJECT) restart"; \ + sleep $(DEPLOY_START_DELAY); \ ) diff --git a/compose.mk b/compose.mk index 86a940f..c9779bf 100644 --- a/compose.mk +++ b/compose.mk @@ -17,6 +17,7 @@ start-compose: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \ + sleep $(DEPLOY_START_DELAY); \ ) stop-compose: @@ -34,4 +35,5 @@ restart-compose: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \ + sleep $(DEPLOY_START_DELAY); \ ) diff --git a/copy.mk b/copy.mk index 8dddc70..cfce804 100644 --- a/copy.mk +++ b/copy.mk @@ -12,4 +12,5 @@ start-copy: @- $(foreach host,$(DEPLOY_HOSTS), \ echo "$(host)"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh start.sh"; \ + sleep $(DEPLOY_START_DELAY); \ ) diff --git a/cron.mk b/cron.mk index 93047d5..4b2d3a7 100644 --- a/cron.mk +++ b/cron.mk @@ -5,6 +5,7 @@ start-cron: @- $(foreach host,$(DEPLOY_HOSTS), \ 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 -"; \ + sleep $(DEPLOY_START_DELAY); \ ) stop-cron: