2022-12-20 14:27:50 +00:00
|
|
|
MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE TAG
|
2022-12-30 23:09:05 +00:00
|
|
|
|
2022-07-05 06:27:53 +00:00
|
|
|
pull-compose:
|
|
|
|
@- echo "\n### pulling image(s)"
|
2022-11-09 11:39:22 +00:00
|
|
|
@- $(foreach host,$(DEPLOY_HOSTS), \
|
2022-11-07 15:57:58 +00:00
|
|
|
echo "$(host)"; \
|
2022-09-20 11:38:18 +00:00
|
|
|
if test $(DOCKER_LOGIN) -eq 1 ; \
|
|
|
|
then \
|
2023-05-04 11:08:35 +00:00
|
|
|
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
|
2022-11-09 11:39:22 +00:00
|
|
|
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
|
2022-09-20 11:38:18 +00:00
|
|
|
fi; \
|
2022-11-09 11:39:22 +00:00
|
|
|
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
|
2022-07-05 06:27:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
start-compose:
|
|
|
|
@- echo "\n### starting service(s)"
|
2022-11-09 11:39:22 +00:00
|
|
|
@- $(foreach host,$(DEPLOY_HOSTS), \
|
2022-11-07 15:57:58 +00:00
|
|
|
echo "$(host)"; \
|
2022-11-09 11:39:22 +00:00
|
|
|
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \
|
2022-07-05 06:27:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
stop-compose:
|
|
|
|
@- echo "\n### stopping service(s)"
|
2022-11-09 11:39:22 +00:00
|
|
|
@- $(foreach host,$(DEPLOY_HOSTS), \
|
2022-11-07 15:57:58 +00:00
|
|
|
echo "$(host)"; \
|
2022-11-09 11:39:22 +00:00
|
|
|
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose down"; \
|
2022-07-18 14:55:24 +00:00
|
|
|
)
|
|
|
|
|
2022-07-05 06:27:53 +00:00
|
|
|
logs-compose:
|
|
|
|
@- echo "\n### logs"
|
2022-11-09 11:39:22 +00:00
|
|
|
@- ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose logs -f $(service)"
|
2022-07-18 14:55:24 +00:00
|
|
|
|
2022-07-05 06:27:53 +00:00
|
|
|
restart-compose:
|
2022-11-09 11:39:22 +00:00
|
|
|
@- $(foreach host,$(DEPLOY_HOSTS), \
|
2022-11-07 15:57:58 +00:00
|
|
|
echo "$(host)"; \
|
2022-11-09 11:39:22 +00:00
|
|
|
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \
|
2022-07-05 06:27:53 +00:00
|
|
|
)
|