deploy type copy

This commit is contained in:
Andreas Neue 2022-09-29 10:25:43 +02:00
parent 37cbb51573
commit cfc7d1ca0b
4 changed files with 45 additions and 27 deletions

View File

@ -1,5 +1,6 @@
.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
@ -12,9 +13,17 @@ self-update:
deploy: upload pre-deploy pull start post-deploy
pre-deploy: pre-deploy-$(DEPLOY_TYPE)
post-deploy: post-deploy-$(DEPLOY_TYPE)
pre-deploy:
@- echo "\n### running pre-deploy script"
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh pre-deploy.sh"; \
)
post-deploy:
@- echo "\n### running post-deploy script"
@- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh post-deploy.sh"; \
)
upload:
@- echo "\n### uploading files"

View File

@ -34,10 +34,6 @@ Example `secrets.mk`:
## Usage
### Available options for DEPLOY_TYPE
compose, swarm, k8s (TBD), helm (TBD), cron (TBD)
### Start the deployment process
make deploy
@ -46,3 +42,26 @@ compose, swarm, k8s (TBD), helm (TBD), cron (TBD)
make create-docker-contexts
### Update make-deploy submodule in your project
make self-update
### Available options for DEPLOY_TYPE
copy, compose, swarm, k8s (TBD), helm (TBD), cron (TBD)
#### copy
Just copy the repo to the remote location(s). Put additional logic into pre- and post-deploy.sh.
#### compose
Docker Compose deployment.
##### swarm
Docker Swarm deployment.
##### k8s, helm, cron
To be implemented.

10
copy.mk Normal file
View File

@ -0,0 +1,10 @@
# copy
#
# this just rsyncs the stuff to the remote server(s) and runs
# pre- and post-deploy
pull-copy:
# nop
start-copy:
# nop

View File

@ -8,26 +8,6 @@ create-docker-contexts:
docker context create $(host) --description "$(host)" --docker "host=ssh://$(SSH_USER)@$(host)"; \
)
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.sh"; \
)
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.sh"; \
)
pull-compose:
@- echo "\n### pulling image(s)"
@- $(foreach ctx,$(DEPLOY_HOSTS), \