Compare commits

...
Sign in to create a new pull request.

35 commits

Author SHA1 Message Date
2599224295 copyright date 2025-05-16 13:28:04 +02:00
5f6b651e83 changed README.md 2025-05-16 09:58:10 +02:00
105e14a085 removed final_destination in compose.mk 2025-04-16 09:52:22 +02:00
27f15d441a introduced DEPLOY_PROJECT_DIR to specify project workdir under project path 2025-04-14 10:13:08 +02:00
Thomas Schneider
ea3f38010c add DEPLOY_SUBPATH documentation 2025-04-10 15:37:42 +02:00
Thomas
0071d31d26 add possiblity to add subpath in compose (when docker-compose file is not in repo root) 2025-04-10 15:27:07 +02:00
Thomas Schneider
b299948bf8 add possibility to add a subpath if docker-compose stuff is not in repo root 2025-04-09 16:11:18 +02:00
Thomas Schneider
99f4568e7e allow additional params for kubectl 2025-03-17 22:56:45 +01:00
Thomas Schneider
9753ac7c67 allow setting individual K8S_MANIFEST_FILENAME 2025-03-11 11:58:41 +01:00
Stefan Riepenhausen
1611cc73df fix mandatory expression namespace 2024-07-18 10:25:52 +02:00
8f527a16a3 more fixes fixing things to be fixed 2024-07-08 09:31:28 +02:00
deb24ec5ae fix broken MANDATORY parsing 2024-07-08 09:11:53 +02:00
938e276821 notification for manual deployments 2024-07-01 09:02:17 +02:00
Stefan Riepenhausen
cd9575d0a7 Update swarm.mk 2024-06-17 12:11:18 +02:00
Stefan Riepenhausen
380ac9c214 Update kustomize.mk 2024-06-17 12:10:17 +02:00
Stefan Riepenhausen
35070eff29 Update k8s.mk 2024-06-17 11:40:27 +02:00
Andreas Neue
4d8672aa8b Merge branch 'fix_mandatory_handling' into 'master'
fix mandatory handling

See merge request pub/make-deploy!8
2024-06-17 09:44:24 +02:00
e5f6c11ea9 fix the fix 2024-06-05 09:45:48 +02:00
37bb6e9c12 fix mandatory handling 2024-06-05 09:43:19 +02:00
Stefan Riepenhausen
c5ed8be31b Merge branch 'deal_with_unset_docker_login' into 'master'
Deal with unset docker login

See merge request pub/make-deploy!7
2024-06-05 09:29:49 +02:00
Stefan Riepenhausen
af2cad09b4 Deal with unset docker login 2024-06-05 09:29:49 +02:00
a52d5c8ba6 terraform module 2024-05-03 14:18:33 +02:00
Stefan Riepenhausen
6cdb0632c3 Merge branch 'SYS-6762_make-deploy-helm-change_to_support_helm_repositories' into 'master'
helm type modifications

See merge request pub/make-deploy!6
2024-02-15 10:16:10 +01:00
Stefan Riepenhausen
9cbde1ddbd helm type modifications 2024-02-15 09:57:49 +01:00
3bd4805df1 cleanup stage 2023-10-16 17:52:08 +02:00
cb856b1396 cleanup stage 2023-10-16 09:30:34 +02:00
Stefan Riepenhausen
21c5d0c58e evals 2023-09-21 12:45:18 +02:00
Stefan Riepenhausen
fda569350e again, spaces and eval 2023-09-21 12:28:56 +02:00
Stefan Riepenhausen
28c66e0399 fix again variable set 2023-09-21 12:23:14 +02:00
Stefan Riepenhausen
f173e89c2d fix command not found 2023-09-21 12:18:08 +02:00
Thomas Schneider
c6e09b7825 Merge branch 'helm_debug' into 'master'
add --debug possibility to helm deploy

See merge request pub/make-deploy!5
2023-09-15 08:45:44 +02:00
Thomas
bb5a388c4f add --debug possibility to helm deploy 2023-09-15 08:44:44 +02:00
47c0d2f4b1 include additional rsync options in .rsync and .rsync_HOSTNAME, mostly meant for additional filters in addition to the defaults 2023-08-22 13:37:36 +02:00
575402c7a8 include additional rsync options in .rsync and .rsync_HOSTNAME, mostly meant for additional filters in addition to the defaults 2023-08-22 13:36:12 +02:00
7045e37564 include additional rsync options (.rsync and .rsync_), mostly meant for additional filters in addition to the defaults 2023-08-21 15:03:35 +02:00
18 changed files with 213 additions and 52 deletions

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2022 Andreas Neue <an@dnix.de> Copyright (c) 2022 Andreas Neue <an@dnix.de>
Copyright (c) 2022-23 the make-deploy authors (see CONTRIBUTORS) Copyright (c) 2022-25 the make-deploy authors (see CONTRIBUTORS)
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View file

@ -1,4 +1,7 @@
DEPLOY_START_DELAY = 0 DEPLOY_START_DELAY = 0
DEPLOY_PROJECT_DIR =
MANDATORY = DEPLOY_NAME DEPLOY_HOSTS DEPLOY_PATH SSH_USER
-include secrets.mk -include secrets.mk
include config.mk include config.mk
@ -9,20 +12,19 @@ ifeq ($(DEPLOY_TYPE), copy)
DEPLOY_TYPE = simple DEPLOY_TYPE = simple
endif endif
project_dir = $(DEPLOY_PATH)/$(DEPLOY_NAME)$(DEPLOY_PROJECT_DIR)
include make-deploy/$(DEPLOY_TYPE).mk include make-deploy/$(DEPLOY_TYPE).mk
.PHONY: self-update mandatory prerequisites prepare build test deploy pre-deploy post-deploy pre-local post-local upload pull start stop restart reload .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
self-update: self-update:
@- git submodule update --remote @- git submodule update --remote
deploy: mandatory prepare build test upload pre-deploy pre-local pull start post-local post-deploy reload deploy: mandatory cleanup prepare build test upload pre-deploy pre-local pull start notify post-local post-deploy reload
mandatory: mandatory:
@- echo "\n### mandatory check" @- echo "\n### mandatory check"
ifndef MANDATORY-$(DEPLOY_TYPE)
$(error MANDATORY-$(DEPLOY_TYPE) is not defined)
endif
@ $(foreach var,$(MANDATORY), \ @ $(foreach var,$(MANDATORY), \
if test -z "${$(var)}"; then \ if test -z "${$(var)}"; then \
echo "Missing mandatory variable: $(var)"; \ echo "Missing mandatory variable: $(var)"; \
@ -34,6 +36,15 @@ prerequisites:
@- echo "\n### prerequisites ..." @- echo "\n### prerequisites ..."
@- ./prerequisites.sh @- ./prerequisites.sh
ifdef DEPLOY_CLEANUP
cleanup:
@- echo "\n### cleanup ..."
@- $(foreach host,$(DEPLOY_HOSTS), \
scp cleanup.sh $(SSH_USER)@$(host):/$(DEPLOY_PATH)/$(DEPLOY_NAME); \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); sh cleanup.sh $(host)"; \
)
endif
prepare: prepare:
@- echo "\n### preparing ..." @- echo "\n### preparing ..."
@- chmod 600 secrets.mk @- chmod 600 secrets.mk
@ -98,7 +109,13 @@ ifdef DEPLOY_HOSTS
@- echo "\n### uploading files" @- echo "\n### uploading files"
@- $(foreach host,$(DEPLOY_HOSTS), \ @- $(foreach host,$(DEPLOY_HOSTS), \
ssh $(SSH_USER)@$(host) "mkdir -p $(DEPLOY_PATH)/$(DEPLOY_NAME)"; \ ssh $(SSH_USER)@$(host) "mkdir -p $(DEPLOY_PATH)/$(DEPLOY_NAME)"; \
rsync -rav --exclude '*~' --exclude '.git*' --exclude '*.swp' . $(SSH_USER)@$(host):$(DEPLOY_PATH)/$(DEPLOY_NAME); \ rsync_xtra=`cat .rsync`; \
rsync_xtra_host=`cat .rsync_$(host)`; \
param="-ravv"; \
param="$$param $$rsync_xtra"; \
param="$$param $$rsync_xtra_host"; \
param="$$param --exclude '*~' --exclude '.git*' --exclude '*.swp' . $(SSH_USER)@$(host):$(DEPLOY_PATH)/$(DEPLOY_NAME)"; \
eval rsync $$param; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME) && chmod o-r .env secrets*"; \ ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME) && chmod o-r .env secrets*"; \
) )
endif endif
@ -109,6 +126,16 @@ start: start-$(DEPLOY_TYPE)
stop: stop-$(DEPLOY_TYPE) stop: stop-$(DEPLOY_TYPE)
notify:
ifdef DEPLOY_NOTIFY_HOSTS
ifdef DEPLOY_NOTIFY_MAIL
ifdef DEPLOY_NOTIFY_MSG
@- echo "\n### notify"
@- echo "$$DEPLOY_NOTIFY_MSG :: Please deploy manually on following hosts: $$DEPLOY_NOTIFY_HOSTS" | mail -s "make-deploy notification" $(DEPLOY_MAIL)
endif
endif
endif
logs: logs-$(DEPLOY_TYPE) logs: logs-$(DEPLOY_TYPE)
restart: restart-$(DEPLOY_TYPE) restart: restart-$(DEPLOY_TYPE)

View file

@ -2,8 +2,6 @@
A simple Makefile based deployment system. A simple Makefile based deployment system.
**make-deploy** was initially hosted at https://git.dnix.de/an/make-deploy. Since it has become heavily used at chefkoch.de for system deployments, and lots of code is committed there, we moved the repo to https://git.chefkoch.net/pub/make-deploy. A mirror still exists at https://git.dnix.de/mirror/make-deploy.
**make-deploy** is licensed under the terms of the MIT-License. See [LICENSE](LICENSE) for info. **make-deploy** is licensed under the terms of the MIT-License. See [LICENSE](LICENSE) for info.
## Installation ## Installation
@ -24,6 +22,7 @@ Example `config.mk`:
DEPLOY_PATH = /srv DEPLOY_PATH = /srv
DEPLOY_TYPE = compose DEPLOY_TYPE = compose
DEPLOY_HOSTS = server01.example.com server02.example.com DEPLOY_HOSTS = server01.example.com server02.example.com
DEPLOY_SUBPATH = my-sub-path
DOCKER_IMAGE = dr.example.com/my-project:latest DOCKER_IMAGE = dr.example.com/my-project:latest
DOCKER_LOGIN = 1 DOCKER_LOGIN = 1
@ -36,6 +35,8 @@ Example `secrets.mk`:
DOCKER_USER = root DOCKER_USER = root
DOCKER_PASS = secret1234 DOCKER_PASS = secret1234
`DEPLOY_SUBPATH` is used to define a location for `DEPLOY_TYPE` = compose that states where the docker-compose.yml is placed at. If that variable is undefined, it is expected to be in projects root.
By setting `DEPLOY_CONFIG_OVERRIDE`, an alternative config can be loaded to override existing configuration settings. This is useful in script calling make deploy or in a `.gitlab-ci.yml` in order to control settings for different targets. By setting `DEPLOY_CONFIG_OVERRIDE`, an alternative config can be loaded to override existing configuration settings. This is useful in script calling make deploy or in a `.gitlab-ci.yml` in order to control settings for different targets.
## Usage ## Usage
@ -54,6 +55,8 @@ Relying only on GNU Make and simple CLI tools makes deployments robust and still
`mandatory`: Checks if all needed variables are set in config.mk. `mandatory`: Checks if all needed variables are set in config.mk.
`cleanup`: Runs `cleanup.sh` on each remote target, meant to be used to wipe contents of prior installations.
`prepare`: Creates needed directory for the deployment on the target system, sets secure file permissions for `secrets.mk`. `prepare`: Creates needed directory for the deployment on the target system, sets secure file permissions for `secrets.mk`.
`build`: Calls `build.sh` locally. This is for building purposts, e.g. docker build and push. `build`: Calls `build.sh` locally. This is for building purposts, e.g. docker build and push.
@ -131,3 +134,11 @@ systemd. (TBD)
##### apt ##### apt
APT deployment on debian-like distributions. APT deployment on debian-like distributions.
##### tf
Deploy via Terraform. Config is mostly done with terraform.
`TF_FLAGS`: What you think.
`TF_TARGET`: Limits deployment to `TF_TARGET`.

2
apt.mk
View file

@ -1,4 +1,4 @@
MANDATORY-apt = APT_PACKAGES MANDATORY = $(shell printenv MANDATORY) APT_PACKAGES
pull-apt: pull-apt:
# nop # nop

View file

@ -1,4 +1,8 @@
MANDATORY-compose-file = DEPLOY_HOSTS DEPLOY_TYPE TAG DEPLOY_COMPOSE_FILE DEPLOY_COMPOSE_PROJECT MANDATORY = $(shell printenv MANDATORY) SSH_USER DEPLOY_COMPOSE_FILE DEPLOY_COMPOSE_PROJECT
ifndef DOCKER_LOGIN
DOCKER_LOGIN = 0
endif
pull-compose-file: pull-compose-file:
@- echo "\n### pulling image(s)" @- echo "\n### pulling image(s)"
@ -9,7 +13,10 @@ pull-compose-file:
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \ echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \ ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
fi; \ fi; \
if test -n "$(DOCKER_IMAGE)" ; \
then \
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \ ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
fi; \
) )
start-compose-file: start-compose-file:

View file

@ -1,39 +1,45 @@
MANDATORY-compose = DEPLOY_HOSTS DEPLOY_TYPE TAG ifdef DOCKER_LOGIN
MANDATORY = $(shell printenv MANDATORY) DOCKER_USER DOCKER_PASS DOCKER_REGISTRY
endif
ifndef DOCKER_LOGIN
DOCKER_LOGIN = 0
endif
pull-compose: pull-compose:
@- echo "\n### pulling image(s)" @echo "\n### pulling image(s)"
@- $(foreach host,$(DEPLOY_HOSTS), \ $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
if test $(DOCKER_LOGIN) -eq 1 ; \ if test "$(DOCKER_LOGIN)" = "1" ; \
then \ then \
echo "\n#### perfom docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \ echo "\n#### perform docker login with user $(DOCKER_USER) on $(DOCKER_REGISTRY)"; \
ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \ ssh $(SSH_USER)@$(host) "docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) $(DOCKER_REGISTRY)"; \
fi; \ fi; \
if test -n "$(DOCKER_IMAGE)" ; \
then \
ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \ ssh $(SSH_USER)@$(host) "docker pull $(DOCKER_IMAGE)"; \
fi; \
) )
start-compose: start-compose:
@- echo "\n### starting service(s)" @echo "\n### starting service(s)"
@- $(foreach host,$(DEPLOY_HOSTS), \ $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose up -d"; \ ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose up -d"; \
sleep $(DEPLOY_START_DELAY); \ sleep $(DEPLOY_START_DELAY); \
) )
stop-compose:
@- echo "\n### stopping service(s)"
@- $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose down"; \
)
logs-compose: logs-compose:
@- echo "\n### logs" @echo "\n### logs"
@- ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose logs -f $(service)" $(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose logs -f $(service)"; \
)
restart-compose: restart-compose:
@- $(foreach host,$(DEPLOY_HOSTS), \ @echo "\n### restarting service(s)"
$(foreach host,$(DEPLOY_HOSTS), \
echo "$(host)"; \ echo "$(host)"; \
ssh $(SSH_USER)@$(host) "cd $(DEPLOY_PATH)/$(DEPLOY_NAME); docker-compose restart"; \ ssh $(SSH_USER)@$(host) "cd $(project_dir); docker-compose restart"; \
sleep $(DEPLOY_START_DELAY); \ sleep $(DEPLOY_START_DELAY); \
) )

View file

@ -1,4 +1,4 @@
MANDATORY-cron = true MANDATORY = $(shell printenv MANDATORY) CRON_USER
start-cron: start-cron:
@- echo "\n### starting..." @- echo "\n### starting..."

30
helm.mk
View file

@ -1,4 +1,4 @@
MANDATORY-helm = K8S_CONTEXT HELM_CHART_NAME HELM_CHART_PATH HELM_VALUES_FILE NAMESPACE MANDATORY = $(shell printenv MANDATORY) K8S_CONTEXT HELM_CHART_NAME HELM_CHART_PATH HELM_VALUES_FILE K8S_NAMESPACE
# helm # helm
# #
# deploys helm charts on k8s via helm # deploys helm charts on k8s via helm
@ -14,21 +14,43 @@ ifdef TEST_MODE
endif endif
ifdef NAMESPACE ifdef NAMESPACE
K8S_NAMESPACE = $(NAMESPACE) @ $(eval K8S_NAMESPACE = $(NAMESPACE))
endif endif
ifdef HELM_REPO_URL
@- echo "Helm Repo: $(HELM_REPO_URL)"
@ helm repo add $(HELM_CHART_NAME) $(HELM_REPO_URL)
@- helm repo update $(HELM_CHART_NAME)
endif
ifdef DEBUG_MODE
@- echo "\n### deploying helm chart with --debug flag"
@- echo "-- DEBUG DEPLOYMENT --------------------"
@- echo " "
@- echo "Namespace: $(K8S_NAMESPACE)"
@- echo "Helm Chart: $(HELM_CHART_PATH)"
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
@- echo "Values File: $(HELM_VALUES_FILE)"
@- echo " "
@- echo "----------------------------------"
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --debug --wait --values - --version "$(HELM_CHART_VERSION)"
else
@- echo "\n### deploying helm chart" @- echo "\n### deploying helm chart"
@- echo "-- DEPLOYMENT --------------------" @- echo "-- DEPLOYMENT --------------------"
@- echo " " @- echo " "
@- echo "Namespace: $(K8S_NAMESPACE)" @- echo "Namespace: $(K8S_NAMESPACE)"
@- echo "Helm Chart: $(HELM_CHART_PATH)" @- echo "Helm Chart: $(HELM_CHART_PATH)"
@- echo "Helm Version (use latest if empty): $(HELM_CHART_VERSION)"
@- echo "Values File: $(HELM_VALUES_FILE)" @- echo "Values File: $(HELM_VALUES_FILE)"
@- echo " " @- echo " "
@- echo "----------------------------------" @- echo "----------------------------------"
@ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --wait --values - @ envsubst < $(HELM_VALUES_FILE) | helm upgrade $(HELM_CHART_NAME) $(HELM_CHART_PATH) -n $(K8S_NAMESPACE) --install --wait --values - --version "$(HELM_CHART_VERSION)"
endif
pull-helm: pull-helm:

7
k8s.mk
View file

@ -2,15 +2,16 @@
# #
# deploys k8s # deploys k8s
MANDATORY-k8s = K8S_CONTEXT MANDATORY = $(shell printenv MANDATORY) K8S_CONTEXT
K8S_MANIFEST_FILENAME ?= kubernetes.yaml
start-k8s: start-k8s:
@- echo "\n### starting deployment with k8s" @- echo "\n### starting deployment with k8s"
@- echo "\n### setting kubernetes context to $(K8S_CONTEXT)" @- echo "\n### setting kubernetes context to $(K8S_CONTEXT)"
@ kubectl config use-context $(K8S_CONTEXT) @ kubectl config use-context $(K8S_CONTEXT)
@- echo "\n### run kubectl apply -f kubernetes.yaml and secrets.yaml" @- echo "\n### run kubectl apply -f $(K8S_MANIFEST_FILENAME) and secrets.yaml"
@ cat kubernetes.yaml secrets.yaml | envsubst | kubectl apply -f - @ cat $(K8S_MANIFEST_FILENAME) secrets.yaml | envsubst | kubectl apply $(K8S_ADDITIONAL_PARAMS) -f -
pull-k8s: pull-k8s:
# nop # nop

View file

@ -1,4 +1,4 @@
MANDATORY-kustomize = K8S_CONTEXT KUSTOMIZE_FOLDER NAMESPACE MANDATORY = $(shell printenv MANDATORY) K8S_CONTEXT KUSTOMIZE_FOLDER NAMESPACE
# kustomize # kustomize
# #
# this uses kustomize to install stuff on k8s # this uses kustomize to install stuff on k8s

View file

@ -1,11 +1,12 @@
MANDATORY-copy = DEPLOY_TYPE DEPLOY_HOSTS SSH_USER DEPLOY_PATH DEPLOY_NAME # simple
MANDATORY-simple = $(MANDATORY-copy)
# copy
# #
# this just rsyncs the stuff to the remote server(s) and runs # this just rsyncs the stuff to the remote server(s) and runs
# build.sh, pre-/post-deploy, pre-/post-local, start.sh, etc. # build.sh, pre-/post-deploy, pre-/post-local, start.sh, etc.
ifndef DEPLOY_StART_DELAY
DEPLOY_START_DELAY = 0
endif
pull-simple: pull-simple:
# nop # nop

View file

@ -1,5 +1,3 @@
MANDATORY-swarm = DEPLOY_HOSTS DEPLOY_TYPE TAG
pull-swarm: pull-swarm:
start-swarm: start-swarm:

50
test.sh Executable file
View file

@ -0,0 +1,50 @@
#!/bin/bash
set -e
DIR=$(mktemp -d)
TESTS=$DIR/make-deploy/testing
function prepdir() {
mkdir $DIR/make-deploy
cp -r * $DIR/make-deploy
cd $DIR
ln -s make-deploy/Makefile
touch secrets.mk
echo "::::::::: testing directory root: $DIR"
}
function cleandir(){
rm -fr $DIR
echo "::::::::: cleanup done"
}
function test_with_minimal_vars_apt(){
echo "::::::::: $FUNCNAME ::::::::::::"
cp $TESTS/apt_config.mk config.mk
make deploy
}
function test_with_minimal_vars_compose(){
echo "::::::::: $FUNCNAME ::::::::::::"
cp $TESTS/compose_config.mk config.mk
cp $TESTS/docker-compose.yml .
make deploy
rm -f docker-compose.yml
}
function test_with_minimal_vars_compose_file(){
echo "::::::::: $FUNCNAME ::::::::::::"
cp $TESTS/compose_file_config.mk config.mk
cp $TESTS/docker-compose.yml .
make deploy
rm -f docker-compose.yml
}
prepdir
test_with_minimal_vars_apt
test_with_minimal_vars_compose
test_with_minimal_vars_compose_file
cleandir

6
testing/apt_config.mk Normal file
View file

@ -0,0 +1,6 @@
DEPLOY_NAME = make-deploy-test-apt
DEPLOY_PATH = /tmp
DEPLOY_HOSTS = localhost
DEPLOY_TYPE = apt
SSH_USER = $(USER)
APT_PACKAGES = curl

View file

@ -0,0 +1,5 @@
DEPLOY_NAME = make-deploy-test-compose
DEPLOY_PATH = /tmp
DEPLOY_HOSTS = localhost
DEPLOY_TYPE = compose
SSH_USER = $(USER)

View file

@ -0,0 +1,7 @@
DEPLOY_NAME = make-deploy-test-compose-file
DEPLOY_PATH = /tmp
DEPLOY_HOSTS = localhost
DEPLOY_TYPE = compose-file
SSH_USER = $(USER)
DEPLOY_COMPOSE_PROJECT = make-deploy-test-compose-file
DEPLOY_COMPOSE_FILE = docker-compose.yml

View file

@ -0,0 +1,4 @@
services:
curl:
image: "alpine/curl"
command: -s -o /dev/null https://www.test.de

16
tf.mk Normal file
View file

@ -0,0 +1,16 @@
MANDATORY = $(shell printenv MANDATORY) TF_FLAGS
# tf
#
# deploys via tf apply
#
start-tf:
ifdef TF_TARGET
terraform apply $(TF_FLAGS) -t $(TF_TARGET)
else
terraform apply $(TF_FLAGS)
endif
pull-tf:
# nop