github.com/mboersma/deis@v1.13.4/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 controller database logger logspout publisher registry router $(STORE_IF_STATEFUL)
    14  START_ORDER=publisher $(STORE_IF_STATEFUL) logger logspout database 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  
    94  setup-root-gotools:
    95  # "go vet" and "go cover" must be installed as root on some systems
    96  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v golang.org/x/tools/cmd/cover
    97  	sudo rm -rf /tmp/tmpGOPATH
    98  
    99  test: test-style test-unit test-functional push test-integration
   100  
   101  test-functional:
   102  	@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) test-functional &&) echo done
   103  
   104  test-unit:
   105  	@$(foreach C, $(COMPONENTS), $(MAKE) -C $(C) test-unit &&) echo done
   106  	@$(foreach C, pkg $(CLIENTS), $(MAKE) -C $(C) test-unit &&) echo done
   107  
   108  test-integration:
   109  	$(MAKE) -C tests/ test-full
   110  
   111  test-smoke:
   112  	$(MAKE) -C tests/ test-smoke
   113  
   114  test-style:
   115  # display output, then check
   116  	$(GOFMT) $(GO_PACKAGES)
   117  	@$(GOFMT) $(GO_PACKAGES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
   118  	$(GOVET) $(GO_PACKAGES_REPO_PATH)
   119  	@for i in $(addsuffix /...,$(GO_PACKAGES)); do \
   120  		$(GOLINT) $$i; \
   121  	done
   122  	@$(foreach C, tests pkg $(CLIENTS) $(COMPONENTS), $(MAKE) -C $(C) test-style &&) echo done
   123  
   124  commit-hook:
   125  	cp contrib/util/commit-msg .git/hooks/commit-msg