-
Notifications
You must be signed in to change notification settings - Fork 0
/
includes.mk
51 lines (39 loc) · 1.74 KB
/
includes.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
ifndef FLEETCTL
FLEETCTL = fleetctl --strict-host-key-checking=false
endif
ifndef FLEETCTL_TUNNEL
$(error You need to set FLEETCTL_TUNNEL to the IP address of a server in the cluster.)
endif
ifndef DEIS_NUM_INSTANCES
DEIS_NUM_INSTANCES = 1
endif
ifndef DEIS_HOSTS
DEIS_HOSTS = $(shell seq -f "172.17.8.%g" -s " " 100 1 `expr $(DEIS_NUM_INSTANCES) + 99` )
endif
ifndef DEIS_NUM_ROUTERS
DEIS_NUM_ROUTERS = 1
endif
ifndef DEIS_FIRST_ROUTER
DEIS_FIRST_ROUTER = 1
endif
DEIS_LAST_ROUTER = $(shell echo $(DEIS_FIRST_ROUTER)\+$(DEIS_NUM_ROUTERS)\-1 | bc)
define ssh_all
for host in $(DEIS_HOSTS); do ssh -o LogLevel=FATAL -o Compression=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PasswordAuthentication=no core@$$host -t $(1); done
endef
define rsync_all
for host in $(DEIS_HOSTS); do rsync -Pave "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --exclude=venv/ --exclude=.git/ --exclude='*.pyc' $(SELF_DIR)/* core@$$host:/home/core/share; done
endef
define echo_cyan
@echo "\033[0;36m$(subst ",,$(1))\033[0m"
endef
define echo_yellow
@echo "\033[0;33m$(subst ",,$(1))\033[0m"
endef
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
ROUTER_UNITS = $(shell seq -f "deis-router@%g.service" -s " " $(DEIS_FIRST_ROUTER) 1 $(DEIS_LAST_ROUTER))
check-fleet:
@LOCAL_VERSION=`$(FLEETCTL) -version`; \
REMOTE_VERSION=`ssh -o StrictHostKeyChecking=no core@$(subst :, -p ,$(FLEETCTL_TUNNEL)) fleetctl -version`; \
if [ "$$LOCAL_VERSION" != "$$REMOTE_VERSION" ]; then \
echo "Your fleetctl client version should match the server. Local version: $$LOCAL_VERSION, server version: $$REMOTE_VERSION. Uninstall your local version and install the latest build from https://github.com/coreos/fleet/releases"; exit 1; \
fi