make-deploy/Makefile

73 lines
1.8 KiB
Makefile
Raw Normal View History

-include secrets.mk
include config.mk
2022-09-29 08:25:43 +00:00
include make-deploy/copy.mk
2022-07-05 06:27:23 +00:00
include make-deploy/docker.mk
2022-07-08 17:44:23 +00:00
include make-deploy/k8s.mk
include make-deploy/cron.mk
include make-deploy/kustomize.mk
include make-deploy/helm.mk
2022-07-08 17:44:23 +00:00
2022-11-07 15:47:36 +00:00
.PHONY: self-update create-contexts deploy pre-deploy post-deploy upload pull start stop restart reload
2022-07-03 21:06:54 +00:00
2022-07-04 15:43:57 +00:00
self-update:
@- git submodule update --remote
2022-10-05 14:02:54 +00:00
deploy: upload pre-deploy pre-local pull start post-local post-deploy
2022-07-03 21:06:54 +00:00
2022-09-29 08:25:43 +00:00
pre-deploy:
ifdef DEPLOY_HOSTS
@- echo "\n### running pre-deploy script(s)"
2022-09-29 08:25:43 +00:00
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh pre-deploy.sh $(host); sh pre-deploy_$(host).sh"; \
2022-09-29 08:25:43 +00:00
)
endif
2022-09-29 08:25:43 +00:00
post-deploy:
ifdef DEPLOY_HOSTS
@- echo "\n### running post-deploy script(s)"
2022-09-29 08:25:43 +00:00
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh post-deploy.sh $(host); sh post-deploy_$(host).sh"; \
2022-09-29 08:25:43 +00:00
)
endif
2022-10-05 14:02:54 +00:00
pre-local:
ifneq (,$(wildcard pre-local.sh))
2022-10-05 14:02:54 +00:00
@- echo "\n### running pre-local script"
@- $(foreach host,$(DEPLOY_HOSTS), \
./pre-local.sh $(host); \
)
else
@- echo "\n### no pre-local script found"
endif
2022-10-05 14:02:54 +00:00
post-local:
ifneq (,$(wildcard post-local.sh))
@- echo "\n### running post-local script"
@- $(foreach host,$(DEPLOY_HOSTS), \
./post-local.sh $(host); \
)
else
@- echo "\n### no post-local script found"
endif
2022-07-03 21:06:54 +00:00
upload:
ifdef DEPLOY_HOSTS
2022-07-03 21:06:54 +00:00
@- echo "\n### uploading files"
@- $(foreach host,$(DEPLOY_HOSTS), \
2022-07-08 17:44:23 +00:00
ssh $(SSH_USER)@$(host) "mkdir -p $(DEPLOY_PATH)/$(DEPLOY_NAME)"; \
2022-07-04 15:47:31 +00:00
rsync -rav --exclude '*~' --exclude '.git*' . $(SSH_USER)@$(host):$(DEPLOY_PATH)/$(DEPLOY_NAME); \
2022-07-03 21:06:54 +00:00
)
endif
2022-07-03 21:06:54 +00:00
2022-07-04 21:33:58 +00:00
pull: pull-$(DEPLOY_TYPE)
2022-07-03 21:06:54 +00:00
start: start-$(DEPLOY_TYPE)
stop: stop-$(DEPLOY_TYPE)
logs: logs-$(DEPLOY_TYPE)
2022-07-03 21:06:54 +00:00
restart: restart-$(DEPLOY_TYPE)
reload: reload-$(DEPLOY_TYPE)