From 73321501163b758db12ad8a37fc4b8b463ffcd47 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Mon, 4 Jul 2022 09:47:18 +0200 Subject: [PATCH] more switches between compose and swarm, preparations for k8s --- Makefile | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 28205d7..b25510e 100644 --- a/Makefile +++ b/Makefile @@ -2,21 +2,33 @@ include config.mk -create_contexts: +create-contexts: @- $(foreach host,$(DEPLOY_HOSTS), \ docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \ ) deploy: upload pre-deploy pull start post-deploy -pre-deploy: +pre-deploy: pre-deploy-$(DEPLOY_TYPE) + +post-deploy: pst-deploy-$(DEPLOY_TYPE) + +pre-deploy-compose: pre-deploy-docker + +post-deploy-compose: post-deploy-docker + +pre-deploy-swarm: pre-deploy-docker + +post-deploy-swarm: post-deploy-docker + +pre-deploy-docker: @- echo "\n### running pre-deploy script" @- $(foreach host,$(DEPLOY_HOSTS), \ cd $(DEPLOY_PATH)/$(DEPLOY_NAME); \ sh pre-deploy.sh; \ ) -post-deploy: +post-deploy-docker: @- echo "\n### running post-deploy script" @- $(foreach host,$(DEPLOY_HOSTS), \ cd $(DEPLOY_PATH)/$(DEPLOY_NAME); \ @@ -38,10 +50,6 @@ pull: start: start-$(DEPLOY_TYPE) -stop: stop-$(DEPLOY_TYPE) - -logs: logs-$(DEPLOY_TYPE) - start-compose: @- echo "\n### starting service(s)" @- $(foreach ctx,$(DEPLOY_HOSTS), \ @@ -49,31 +57,40 @@ start-compose: docker-compose up -d; \ ) +start-swarm: + +stop: stop-$(DEPLOY_TYPE) + stop-compose: @- echo "\n### stopping service(s)" @- $(foreach ctx,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose down; \ - ) +) + +stop-swarm: + +logs: logs-$(DEPLOY_TYPE) logs-compose: @- echo "\n### logs" @- docker context use $(host) @- docker-compose logs -f $(service) -start-swarm: - -stop-swarm: logs-swarm: -restart: +restart: restart-$(DEPLOY_TYPE) + +restart-compose: @- $(foreach ctx,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose restart; \ ) -reload: +reload: reload-$(DEPLOY_TYPE) + +reload-compose: @- $(foreach host,$(DEPLOY_HOSTS), \ docker context use $(ctx); \ docker-compose restart; \