-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
111 lines (90 loc) · 2.68 KB
/
Makefile
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
org_path="github.com/mesosphere"
repo_path="${org_path}/etcd-mesos"
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(patsubst %/,%,$(dir $(mkfile_path)))
ETCD_CLUSTER_SIZE=3
MARATHON_IP=localhost
ZK_IP=localhost
# TODO document possible environment variables
DOCKER_ORG=mesosphere
VERSION=0.1.3
DOCKER_PUSH_ENABLED=0
default: clean build
.PHONY: clean
.SILENT: clean
clean:
@rm -rf bin
.PHONY: format
.SILENT: format
format:
echo "gofmt'ing..."
@govendor fmt +local
.PHONY: bin
.SILENT: bin
bin:
@mkdir -p bin
.PHONY: build
build: build_scheduler build_executor build_proxy build_etcd
.PHONY: build_scheduler
.SILENT: build_scheduler
build_scheduler: bin
echo "Building etcd-mesos-scheduler.."
go build -o bin/etcd-mesos-scheduler ./cmd/etcd-mesos-scheduler
.PHONY: build_executor
.SILENT: build_executor
build_executor: bin
echo "Building etcd-mesos-executor.."
go build -o bin/etcd-mesos-executor ./cmd/etcd-mesos-executor
.PHONY: build_proxy
.SILENT: build_proxy
build_proxy: bin
echo "Building etcd-mesos-proxy.."
go build -o bin/etcd-mesos-proxy ./cmd/etcd-mesos-proxy
.PHONY: build_etcd
.SILENT: build_etcd
build_etcd: bin
echo "Building etcd binaries.."
@git submodule init
@git submodule update
cd _vendor/coreos/etcd; ./build; mv bin/* ../../../bin/
.PHONY: run
run: format run_scheduler
# TODO add configurable Zookeeper IP and cluster size
.PHONY: run_scheduler
run_scheduler:
go run -race ./cmd/etcd-mesos-scheduler/app.go -logtostderr=true \
-master="zk://${ZK_IP}:2181/mesos" \
-framework-name="etcd-t1" \
-cluster-size=${ETCD_CLUSTER_SIZE} \
-zk-framework-persist="zk://${ZK_IP}:2181/etcd-mesos"
# TODO add configurable Zookeeper IP
.PHONY: run_proxy
run_proxy:
go run -race ./cmd/etcd-mesos-proxy/app.go \
-master="zk://${ZK_IP}:2181/mesos" \
-framework-name="etcd-t1"
install:
@govendor install +local
# TODO fix because doesn't work (at least on MacOS X)
cover:
for i in `dirname **/*_test.go | grep -v "_vendor" | sort | uniq`; do \
echo $$i; \
go test -v -race ./$$i/... -coverprofile=em-coverage.out; \
go tool cover -func=em-coverage.out; rm em-coverage.out; \
done
test:
@govendor test -race +local
.SILENT: docker_build
docker_build:
docker run --rm -v "$$PWD":/go/src/github.com/mesosphere/etcd-mesos \
-e GOPATH=/go \
-w /go/src/github.com/mesosphere/etcd-mesos \
golang:1.8.1 \
make
.SILENT: docker
docker: docker_build
docker build --no-cache -t $(DOCKER_ORG)/etcd-mesos:$(VERSION) .
test ${DOCKER_PUSH_ENABLED} = 0 || docker push $(DOCKER_ORG)/etcd-mesos:$(VERSION)
# TODO add configurable Marathon IP
marathon: docker
curl -X POST http://${MARATHON_IP}:8080/v2/apps -d @marathon.json -H "Content-type: application/json"