github.com/jiasir/deis@v1.12.2/controller/Makefile (about) 1 include ../includes.mk 2 3 .PHONY: all test logs 4 5 all: build run 6 7 SHELL_SCRIPTS = $(wildcard bin/*) $(shell find "." -name '*.sh') 8 9 COMPONENT = controller 10 IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG) 11 DEV_IMAGE = $(REGISTRY)$(IMAGE) 12 13 build: check-docker 14 docker build -t $(IMAGE) . 15 16 clean: check-docker check-registry 17 docker rmi $(IMAGE) 18 19 full-clean: check-docker check-registry 20 docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f 21 22 install: check-deisctl 23 deisctl install $(COMPONENT) 24 25 uninstall: check-deisctl 26 deisctl uninstall $(COMPONENT) 27 28 start: check-deisctl 29 deisctl start $(COMPONENT) 30 31 stop: check-deisctl 32 deisctl stop $(COMPONENT) 33 34 restart: stop start 35 36 run: install start 37 38 dev-release: push set-image 39 40 push: check-registry 41 docker tag -f $(IMAGE) $(DEV_IMAGE) 42 docker push $(DEV_IMAGE) 43 44 set-image: check-deisctl 45 deisctl config $(COMPONENT) set image=$(DEV_IMAGE) 46 47 release: 48 docker push $(IMAGE) 49 50 deploy: build dev-release restart 51 52 runserver: 53 python manage.py runserver 54 55 postgres: 56 docker start postgres || docker run --restart="always" -d -p 5432:5432 --name postgres postgres:9.4.1 57 docker exec postgres createdb -U postgres deis 2>/dev/null || true 58 @echo "To use postgres for local development:" 59 @echo " export PGHOST=`docker-machine ip $$(docker-machine active) 2>/dev/null || echo 127.0.0.1`" 60 @echo " export PGPORT=5432" 61 @echo " export PGUSER=postgres" 62 63 db: 64 python manage.py syncdb --migrate --noinput 65 66 coverage: 67 coverage run manage.py test --noinput api 68 coverage html 69 70 test: test-unit test-functional 71 72 setup-venv: 73 @if [ ! -d venv ]; then virtualenv venv; fi 74 venv/bin/pip install --disable-pip-version-check -q -r requirements.txt -r dev_requirements.txt 75 76 test-style: setup-venv 77 venv/bin/flake8 --show-pep8 --show-source 78 shellcheck $(SHELL_SCRIPTS) 79 80 test-unit: setup-venv test-style 81 venv/bin/coverage run manage.py test --noinput web registry api 82 venv/bin/coverage report -m 83 84 test-functional: 85 @$(MAKE) -C ../tests/ test-etcd 86 @$(MAKE) -C ../tests/ test-postgresql 87 GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/...