make-deploy/Makefile

54 lines
1.3 KiB
Makefile

.PHONY: self-update create-contexts deploy upload pull start stop restart
include make-deploy/copy.mk
include make-deploy/docker.mk
include make-deploy/k8s.mk
include make-deploy/cron.mk
include config.mk
include secrets.mk
self-update:
@- git submodule update --remote
deploy: upload pre-deploy pre-local pull start post-local post-deploy
pre-deploy:
@- echo "\n### running pre-deploy script(s)"
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh pre-deploy.sh; sh pre-deploy_$(host).sh"; \
)
post-deploy:
@- echo "\n### running post-deploy script(s)"
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh post-deploy.sh; sh post-deploy_$(host).sh"; \
)
pre-local:
@- echo "\n### running pre-local script"
@- sh ./pre-local.sh
post-local:
@- echo "\n### running post-local script"
@- sh ./post-local.sh
upload:
@- echo "\n### uploading files"
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "mkdir -p $(DEPLOY_PATH)/$(DEPLOY_NAME)"; \
rsync -rav --exclude '*~' --exclude '.git*' . $(SSH_USER)@$(host):$(DEPLOY_PATH)/$(DEPLOY_NAME); \
)
pull: pull-$(DEPLOY_TYPE)
start: start-$(DEPLOY_TYPE)
stop: stop-$(DEPLOY_TYPE)
logs: logs-$(DEPLOY_TYPE)
restart: restart-$(DEPLOY_TYPE)
reload: reload-$(DEPLOY_TYPE)