Rainbond/Makefile

86 lines
3.2 KiB
Makefile
Raw Normal View History

2017-11-22 14:02:29 +08:00
GO_LDFLAGS=-ldflags " -w"
2018-07-10 17:06:53 +08:00
VERSION=3.7
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-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-07-24 23:20:27 +08:00
build_items="api builder entrance grctl monitor mq node webcli worker eventlog"
ifeq ($(origin WHAT), undefined)
WHAT = all
endif
.PHONY: build
build:
@echo "🐳build ${WHAT}"
@./release.sh localbuild $(WHAT)
image:
@echo "🐳build image ${WHAT}"
@bash ./release.sh ${WHAT}
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
2018-08-02 14:11:56 +08:00
pkg:
@bash ./release.sh build
2017-11-07 11:40:44 +08:00
2018-07-24 23:20:27 +08:00
run:build
ifeq ($(WHAT),api)
2018-05-14 19:00:22 +08:00
${BIN_PATH}/${BASE_NAME}-api --log-level=debug \
2018-08-02 12:16:50 +08:00
--mysql="root:admin@tcp(127.0.0.1:3306)/region" \
2018-07-24 23:20:27 +08:00
--kube-config="`PWD`/test/admin.kubeconfig" \
2018-08-02 12:16:50 +08:00
--api-ssl-enable=true \
--client-ca-file="`PWD`/test/ssl/ca.pem" \
--api-ssl-certfile="`PWD`/test/ssl/server.pem" \
--api-ssl-keyfile="`PWD`/test/ssl/server.key.pem"
2018-07-24 23:20:27 +08:00
--etcd=http://127.0.0.1:4001,http://127.0.0.1:2379
else ifeq ($(WHAT),mq)
2017-11-22 14:02:29 +08:00
${BIN_PATH}/${BASE_NAME}-mq --log-level=debug
2018-07-24 23:20:27 +08:00
else ifeq ($(WHAT),worker)
2017-11-22 14:02:29 +08:00
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" \
--kube-config=./test/admin.kubeconfig
2018-07-24 23:20:27 +08:00
else ifeq ($(WHAT),builder)
${BIN_PATH}/${BASE_NAME}-chaos \
2018-07-10 14:36:36 +08:00
--log-level=debug \
2018-07-24 23:20:27 +08:00
--mysql="root:@tcp(127.0.0.1:3306)/region"
else ifeq ($(WHAT),eventlog)
2017-11-22 14:02:29 +08:00
${BIN_PATH}/${BASE_NAME}-eventlog \
--log.level=debug --discover.etcd.addr=http://127.0.0.1:2379 \
2018-07-05 11:09:18 +08:00
--db.url="root:@tcp(127.0.0.1:3306)/event" \
2017-11-22 14:02:29 +08:00
--dockerlog.mode=stream \
--message.dockerlog.handle.core.number=2 \
--message.garbage.file="/tmp/garbage.log" \
--docker.log.homepath="/Users/qingguo/tmp"
2018-07-24 23:20:27 +08:00
else ifeq ($(WHAT),node)
2017-11-22 14:02:29 +08:00
${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 \
--statsd.mapping-config=`pwd`/test/mapper.yml \
2018-07-24 23:20:27 +08:00
--log-level=debug
endif
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
2018-08-02 12:16:50 +08:00
cert-ca:
2018-08-02 22:53:37 +08:00
@_output/3.7/rainbond-certutil create --is-ca --ca-name=./test/ssl/ca.pem --ca-key-name=./test/ssl/ca.key.pem --domains region.goodrain.me
2018-08-02 12:16:50 +08:00
cert-server:
2018-08-02 22:53:37 +08:00
@_output/3.7/rainbond-certutil create --ca-name=./test/ssl/ca.pem --ca-key-name=./test/ssl/ca.key.pem --crt-name=./test/ssl/server.pem --crt-key-name=./test/ssl/server.key.pem --domains region.goodrain.me
2018-08-02 12:16:50 +08:00
cert-client:
2018-08-02 22:53:37 +08:00
@_output/3.7/rainbond-certutil create --ca-name=./test/ssl/ca.pem --ca-key-name=./test/ssl/ca.key.pem --crt-name=./test/ssl/client.pem --crt-key-name=./test/ssl/client.key.pem --domains region.goodrain.me
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"