From 5c2d7132e352a9f55b64dba20a0103899a8fb2f0 Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Tue, 5 Jul 2022 08:27:23 +0200 Subject: [PATCH] split into modules --- Makefile | 80 ++------------------------------------------------------ 1 file changed, 2 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index b8c21a8..3576da8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ -.PHONY: create_contexts deploy upload pull start stop restart +.PHONY: self-update create-contexts deploy upload pull start stop restart +include make-deploy/docker.mk include config.mk self-update: @@ -16,26 +17,6 @@ pre-deploy: pre-deploy-$(DEPLOY_TYPE) post-deploy: post-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), \ - ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh pre-deploy"; \ - ) - -post-deploy-docker: - @- echo "\n### running post-deploy script" - @- $(foreach host,$(DEPLOY_HOSTS), \ - ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh post-deploy"; \ - ) - upload: @- echo "\n### uploading files" @- $(foreach host,$(DEPLOY_HOSTS), \ @@ -44,69 +25,12 @@ upload: pull: pull-$(DEPLOY_TYPE) -pull-compose: - @- echo "\n### pulling image(s)" - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker context use $(ctx); \ - docker pull $(DOCKER_IMAGE); \ - ) - -pull-swarm: - start: start-$(DEPLOY_TYPE) -start-compose: - @- echo "\n### starting service(s)" - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker context use $(ctx); \ - docker-compose up -d; \ - ) - -start-swarm: - @- echo "\n### starting service(s)" - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker stack deploy -c $(DEPLOY_PATH)/$(DEPLOY_NAME)/stack.yml $(DEPLOY_NAME); \ - ) - stop: stop-$(DEPLOY_TYPE) -stop-compose: - @- echo "\n### stopping service(s)" - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker context use $(ctx); \ - docker-compose down; \ -) - -stop-swarm: - @- echo "\n### stopping service(s)" - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker stack rm $(DEPLOY_NAME); \ - ) - logs: logs-$(DEPLOY_TYPE) -logs-compose: - @- echo "\n### logs" - @- docker context use $(host) - @- docker-compose logs -f $(service) - -logs-swarm: - @- echo "\n### logs" - @- docker context use $(DEPLOY_HOSTS) - @- docker service logs -f $(service) - restart: restart-$(DEPLOY_TYPE) -restart-compose: - @- $(foreach ctx,$(DEPLOY_HOSTS), \ - docker context use $(ctx); \ - docker-compose restart; \ - ) - reload: reload-$(DEPLOY_TYPE) - -reload-compose: - @- $(foreach host,$(DEPLOY_HOSTS), \ - docker context use $(ctx); \ - docker-compose restart; \ - )