2017-11-22 14:02:29 +08:00
GO_LDFLAGS = -ldflags " -w"
2018-03-08 09:50:26 +08:00
VERSION = 3.5
2017-11-07 11:40:44 +08:00
WORK_DIR = /go/src/github.com/goodrain/rainbond
BASE_NAME = rainbond
2017-11-22 14:02:29 +08:00
BASE_DOCKER = ./hack/contrib/docker
BIN_PATH = ./_output/${ VERSION }
2017-11-07 19:11:49 +08:00
2017-11-22 14:02:29 +08:00
default : help
2018-06-08 18:02:06 +08:00
all : build images ## build linux binaries, build images for docker
2017-11-07 11:40:44 +08:00
2017-11-22 14:02:29 +08:00
clean :
@rm -rf ${ BIN_PATH } /*
2017-11-07 11:40:44 +08:00
2018-04-08 22:16:50 +08:00
build : build -mq build -worker build -chaos build -mqcli build -node build -entrance build -webcli build -grctl build -api ## build all binaries without event-log
2017-11-22 14:02:29 +08:00
build-mq :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -mq ./cmd/mq
build-worker :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -worker ./cmd/worker
build-chaos :
2017-11-22 15:08:35 +08:00
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -chaos ./cmd/builder
2017-11-22 14:02:29 +08:00
build-mqcli :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -mqcli ./cmd/mqcli
build-node :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -node ./cmd/node
build-entrance :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -entrance ./cmd/entrance
build-eventlog :
2017-12-18 14:44:25 +08:00
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -eventlog ./cmd/eventlog
2017-11-22 14:02:29 +08:00
build-grctl :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -grctl ./cmd/grctl
build-api :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -api ./cmd/api
build-webcli :
go build ${ GO_LDFLAGS } -o ${ BIN_PATH } /${ BASE_NAME } -webcli ./cmd/webcli
2018-06-08 18:02:06 +08:00
deb :
2017-11-22 14:02:29 +08:00
@bash ./release.sh deb
2018-06-08 18:02:06 +08:00
rpm :
2017-11-22 14:02:29 +08:00
@bash ./release.sh rpm
2017-11-22 17:04:25 +08:00
pkgs :
2017-11-22 14:02:29 +08:00
@bash ./release.sh pkg
2018-06-08 18:02:06 +08:00
images : build -image -worker build -image -mq build -image -chaos build -image -entrance build -image -eventlog build -image -api build -image -webcli build -image -cni -tools ## build all images
2017-11-22 14:02:29 +08:00
build-image-worker :
@echo " 🐳 $@ "
@bash ./release.sh worker
build-image-mq :
@echo " 🐳 $@ "
@bash ./release.sh mq
build-image-chaos :
@echo " 🐳 $@ "
@bash ./release.sh chaos
2018-06-08 18:02:06 +08:00
build-image-cni-tools :
2017-11-30 22:51:08 +08:00
@echo " 🐳 $@ "
2018-06-08 18:02:06 +08:00
@bash ./release.sh build
2017-11-22 14:02:29 +08:00
# @docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ${BASE_DOCKER}/node/${BASE_NAME}-node ./cmd/node
2018-05-31 17:08:47 +08:00
build-image-monitor :
@echo " 🐳 $@ "
@bash ./release.sh monitor
2017-11-22 14:02:29 +08:00
build-image-entrance :
@echo " 🐳 $@ "
@cp -r ${ BASE_DOCKER } /dist ${ BASE_DOCKER } /entrance/dist
@bash ./release.sh entrance
@rm -rf ${ BASE_DOCKER } /entrance/dist
build-image-eventlog :
@echo " 🐳 $@ "
@bash ./release.sh eventlog
build-image-api :
@echo " 🐳 $@ "
@bash ./release.sh api
build-image-webcli :
@echo " 🐳 $@ "
@bash ./release.sh webcli
2017-11-07 11:40:44 +08:00
2017-11-22 14:02:29 +08:00
run-api : build -api
2018-05-14 19:00:22 +08:00
${ BIN_PATH } /${ BASE_NAME } -api --log-level= debug \
--mysql= "root:admin@tcp(127.0.0.1:3306)/region" \
--kube-config= "`PWD`/test/admin.kubeconfig" \
--etcd= http://127.0.0.1:4001,http://127.0.0.1:2379
2017-11-22 14:02:29 +08:00
run-mq : build -mq
${ BIN_PATH } /${ BASE_NAME } -mq --log-level= debug
run-worker : build -worker
CUR_NET = midonet EX_DOMAIN = test-ali.goodrain.net:10080 ${ BIN_PATH } /${ BASE_NAME } -worker \
--log-level= debug \
2018-06-13 20:17:17 +08:00
--mysql= "root:@tcp(127.0.0.1:3306)/region" \
2018-01-23 18:07:02 +08:00
--kube-config= ./test/admin.kubeconfig
2017-11-22 14:55:36 +08:00
run-chaos : build -chaos
${ BIN_PATH } /${ BASE_NAME } -chaos
2017-11-22 14:02:29 +08:00
run-eventlog : build -eventlog
${ BIN_PATH } /${ BASE_NAME } -eventlog \
--log.level= debug --discover.etcd.addr= http://127.0.0.1:2379 \
--db.url= "root:admin@tcp(127.0.0.1:3306)/event" \
--dockerlog.mode= stream \
--message.dockerlog.handle.core.number= 2 \
--message.garbage.file= "/tmp/garbage.log" \
--docker.log.homepath= "/Users/qingguo/tmp"
run-node : build -node
${ BIN_PATH } /${ BASE_NAME } -node \
--run-mode= master --kube-conf= ` pwd ` /test/admin.kubeconfig \
--nodeid-file= ` pwd ` /test/host_id.conf \
--static-task-path= ` pwd ` /test/tasks \
2017-12-14 18:30:52 +08:00
--statsd.mapping-config= ` pwd ` /test/mapper.yml \
2017-11-22 14:02:29 +08:00
--log-level= debug
2017-11-07 11:40:44 +08:00
2018-06-08 18:02:06 +08:00
doc :
2017-11-22 14:02:29 +08:00
@cd cmd/api && swagger generate spec -o ../../hack/contrib/docker/api/html/swagger.json
2017-11-07 11:40:44 +08:00
2017-11-22 14:02:29 +08:00
help : ## this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $( MAKEFILE_LIST)
@echo "\033[36m 🤔 single plugin,how to work? \033[0m"
@echo "\033[01;34mmake build-<plugin>\033[0m Just like: make build-mq"
@echo "\033[01;34mmake build-image-<plugin>\033[0m Just like: make build-image-mq"
2017-11-22 16:40:51 +08:00
@echo "\033[01;34mmake run-<plugin>\033[0m Just like: make run-mq"