introduced DEPLOY_PROJECT_DIR to specify project workdir under project path
This commit is contained in:
parent
ea3f38010c
commit
27f15d441a
3
Makefile
3
Makefile
|
@ -1,4 +1,5 @@
|
|||
DEPLOY_START_DELAY = 0
|
||||
DEPLOY_PROJECT_DIR =
|
||||
|
||||
MANDATORY = DEPLOY_NAME DEPLOY_HOSTS DEPLOY_PATH SSH_USER
|
||||
|
||||
|
@ -11,6 +12,8 @@ ifeq ($(DEPLOY_TYPE), copy)
|
|||
DEPLOY_TYPE = simple
|
||||
endif
|
||||
|
||||
project_dir = $(DEPLOY_PATH)/$(DEPLOY_NAME)$(DEPLOY_PROJECT_DIR)
|
||||
|
||||
include make-deploy/$(DEPLOY_TYPE).mk
|
||||
|
||||
.PHONY: self-update mandatory cleanup prerequisites prepare build test deploy pre-deploy post-deploy pre-local post-local upload pull start stop restart reload notify
|
||||
|
|
19
compose.mk
19
compose.mk
|
@ -23,14 +23,10 @@ pull-compose:
|
|||
|
||||
start-compose:
|
||||
@echo "\n### starting service(s)"
|
||||
final_path = "$(DEPLOY_PATH)/$(DEPLOY_NAME)$(DEPLOY_PROJECT_DIR)"
|
||||
$(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
if test -n "$(DEPLOY_SUBPATH)" ; \
|
||||
then \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME)/$(DEPLOY_SUBPATH); docker-compose up -d"; \
|
||||
else \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \
|
||||
fi; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose up -d"; \
|
||||
sleep $(DEPLOY_START_DELAY); \
|
||||
)
|
||||
|
||||
|
@ -38,18 +34,13 @@ logs-compose:
|
|||
@echo "\n### logs"
|
||||
$(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose logs -f $(service)"; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose logs -f $(service)"; \
|
||||
)
|
||||
|
||||
restart-compose:
|
||||
@echo "\n### restarting service(s)"
|
||||
$(foreach host,$(DEPLOY_HOSTS), \
|
||||
echo "$(host)"; \
|
||||
if test -n "$(DEPLOY_SUBPATH)" ; \
|
||||
then \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME)/$(DEPLOY_SUBPATH); docker-compose restart"; \
|
||||
else \
|
||||
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \
|
||||
fi; \
|
||||
ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose restart"; \
|
||||
sleep $(DEPLOY_START_DELAY); \
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue