github.com/technosophos/deis@v1.7.1-0.20150915173815-f9005256004b/Makefile (about) 1 # 2 # Deis Makefile 3 # 4 5 include includes.mk 6 7 # the filepath to this repository, relative to $GOPATH/src 8 repo_path = github.com/deis/deis 9 10 GO_PACKAGES = version 11 GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES)) 12 13 COMPONENTS=builder cache controller database logger logspout publisher registry router $(STORE_IF_STATEFUL) 14 START_ORDER=publisher $(STORE_IF_STATEFUL) logger logspout database cache registry controller builder router 15 CLIENTS=client deisctl 16 17 all: build run 18 19 dev-registry: check-docker 20 @docker inspect registry >/dev/null 2>&1 && docker start registry || docker run --restart="always" -d -p 5000:5000 --name registry registry:0.9.1 21 @echo 22 @echo "To use a local registry for Deis development:" 23 @echo " export DEV_REGISTRY=`docker-machine ip $$(docker-machine active 2>/dev/null) 2>/dev/null || echo $(HOST_IPADDR) `:5000" 24 25 dev-cluster: discovery-url 26 vagrant up 27 ssh-add ~/.vagrant.d/insecure_private_key 28 deisctl config platform set sshPrivateKey=$(HOME)/.vagrant.d/insecure_private_key 29 deisctl config platform set domain=local3.deisapp.com 30 deisctl config platform set enablePlacementOptions=true 31 deisctl install platform 32 33 discovery-url: 34 @for i in 1 2 3 4 5; do \ 35 URL=`curl -s -w '\n' https://discovery.etcd.io/new?size=$$DEIS_NUM_INSTANCES`; \ 36 if [ ! -z $$URL ]; then \ 37 sed -e "s,discovery: #DISCOVERY_URL,discovery: $$URL," contrib/coreos/user-data.example > contrib/coreos/user-data; \ 38 echo "Wrote $$URL to contrib/coreos/user-data"; \ 39 break; \ 40 fi; \ 41 if [ $$i -eq 5 ]; then \ 42 echo "Failed to contact https://discovery.etcd.io after $$i tries"; \ 43 else \ 44 sleep 3; \ 45 fi \ 46 done 47 48 build: check-docker 49 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) build &&) echo done 50 @$(foreach C, $(CLIENTS), $(MAKE) -C $(C) build &&) echo done 51 52 clean: 53 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) clean &&) echo done 54 @$(foreach C, $(CLIENTS), $(MAKE) -C $(C) clean &&) echo done 55 56 full-clean: 57 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) full-clean &&) echo done 58 59 install: 60 @$(foreach C, $(START_ORDER), $(MAKE) -C $(C) install &&) echo done 61 62 uninstall: 63 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) uninstall &&) echo done 64 65 start: 66 @$(foreach C, $(START_ORDER), $(MAKE) -C $(C) start &&) echo done 67 68 stop: 69 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) stop &&) echo done 70 71 restart: stop start 72 73 run: install start 74 75 dev-release: 76 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) dev-release &&) echo done 77 78 push: 79 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) push &&) echo done 80 81 set-image: 82 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) set-image &&) echo done 83 84 release: check-registry 85 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) release &&) echo done 86 87 deploy: build dev-release restart 88 89 setup-gotools: 90 go get -u -v github.com/tools/godep 91 go get -u -v github.com/golang/lint/golint 92 go get -u -v golang.org/x/tools/cmd/cover 93 go get -u -v golang.org/x/tools/cmd/vet 94 95 setup-root-gotools: 96 # "go vet" and "go cover" must be installed as root on some systems 97 sudo GOPATH=/tmp/tmpGOPATH go get -u -v golang.org/x/tools/cmd/cover 98 sudo GOPATH=/tmp/tmpGOPATH go get -u -v golang.org/x/tools/cmd/vet 99 sudo rm -rf /tmp/tmpGOPATH 100 101 test: test-style test-unit test-functional push test-integration 102 103 test-functional: 104 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) test-functional &&) echo done 105 106 test-unit: 107 @$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) test-unit &&) echo done 108 @$(foreach C, pkg $(CLIENTS), $(MAKE) -C $(C) test-unit &&) echo done 109 110 test-integration: 111 $(MAKE) -C tests/ test-full 112 113 test-smoke: 114 $(MAKE) -C tests/ test-smoke 115 116 test-style: 117 # display output, then check 118 $(GOFMT) $(GO_PACKAGES) 119 @$(GOFMT) $(GO_PACKAGES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi 120 $(GOVET) $(GO_PACKAGES_REPO_PATH) 121 @for i in $(addsuffix /...,$(GO_PACKAGES)); do \ 122 $(GOLINT) $$i; \ 123 done 124 @$(foreach C, tests pkg $(CLIENTS) $(COMPONENTS), $(MAKE) -C $(C) test-style &&) echo done 125 126 commit-hook: 127 cp contrib/util/commit-msg .git/hooks/commit-msg