forked from meshery/meshery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
184 lines (148 loc) · 6.31 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
ADAPTER_URLS := "mesherylocal.layer5.io:10000 mesherylocal.layer5.io:10001 mesherylocal.layer5.io:10002 mesherylocal.layer5.io:10003 mesherylocal.layer5.io:10004 mesherylocal.layer5.io:10006 mesherylocal.layer5.io:10007 mesherylocal.layer5.io:10008 mesherylocal.layer5.io:10009 meshery-nginx-sm:10010"
MESHERY_CLOUD_LOCAL="http://mesherylocal.layer5.io:9876"
MESHERY_CLOUD_DEV="http://localhost:9876"
MESHERY_CLOUD_PROD="https://meshery.layer5.io"
MESHERY_CLOUD_STAGING="https://staging-meshery.layer5.io"
GIT_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1`)
GIT_COMMITSHA=$(shell git rev-list -1 HEAD)
RELEASE_CHANNEL="edge"
# Build the CLI for Meshery - `mesheryctl`.
# Build Meshery inside of a multi-stage Docker container.
mesheryctl:
cd mesheryctl; go build -o mesheryctl cmd/mesheryctl/main.go
DOCKER_BUILDKIT=1 docker build -t layer5/meshery .
# `make docker` builds Meshery inside of a multi-stage Docker container.
# This method does NOT require that you have Go, NPM, etc. installed locally.
docker:
DOCKER_BUILDKIT=1 docker build -t layer5/meshery --build-arg TOKEN=$(GLOBAL_TOKEN) --build-arg GIT_COMMITSHA=$(GIT_COMMITSHA) --build-arg GIT_VERSION=$(GIT_VERSION) --build-arg RELEASE_CHANNEL=${RELEASE_CHANNEL} .
# Runs Meshery in a container locally and points to locally-running
# Meshery Cloud for user authentication.
docker-run-local-cloud:
(docker rm -f meshery) || true
docker run --name meshery -d \
--link meshery-cloud:meshery-cloud \
-e PROVIDER_BASE_URLS=$(MESHERY_CLOUD_LOCAL) \
-e DEBUG=true \
-e ADAPTER_URLS=$(ADAPTER_URLS) \
-p 9081:8080 \
layer5/meshery ./meshery
# Runs Meshery in a container locally and points to remote
# Meshery Cloud for user authentication.
docker-run-cloud:
(docker rm -f meshery) || true
docker run --name meshery -d \
-e PROVIDER_BASE_URLS=$(MESHERY_CLOUD_PROD) \
-e DEBUG=true \
-e ADAPTER_URLS=$(ADAPTER_URLS) \
-v meshery-config:/home/appuser/.meshery/config \
-v $(HOME)/.kube:/home/appuser/.kube:ro \
-p 9081:8080 \
layer5/meshery ./meshery
# Runs Meshery on your local machine and points to locally-running
# Meshery Cloud for user authentication.
run-local-cloud: error
cd cmd; go clean; rm meshery; go mod tidy; \
go build -ldflags="-w -s -X main.version=${GIT_VERSION} -X main.commitsha=${GIT_COMMITSHA} -X main.releasechannel=${RELEASE_CHANNEL}" -tags draft -a -o meshery; \
PROVIDER_BASE_URLS=$(MESHERY_CLOUD_DEV) \
PORT=9081 \
DEBUG=true \
ADAPTER_URLS=$(ADAPTER_URLS) \
./meshery; \
cd ..
# Builds and runs Meshery to run on your local machine.
# and points to remote Meshery Cloud for user authentication.
run-local: error
cd cmd; go clean; rm meshery; go mod tidy; \
go build -ldflags="-w -s -X main.version=${GIT_VERSION} -X main.commitsha=${GIT_COMMITSHA} -X main.releasechannel=${RELEASE_CHANNEL}" -tags draft -a -o meshery; \
PROVIDER_BASE_URLS=$(MESHERY_CLOUD_PROD) \
PORT=9081 \
DEBUG=true \
ADAPTER_URLS=$(ADAPTER_URLS) \
./meshery; \
cd ..
run-fast:
cd cmd; go mod tidy; \
BUILD="$(GIT_VERSION)" \
PROVIDER_BASE_URLS=$(MESHERY_CLOUD_PROD) \
PORT=9081 \
DEBUG=true \
ADAPTER_URLS=$(ADAPTER_URLS) \
go run main.go;
run-fast-cloud: error
cd cmd; go mod tidy; \
PROVIDER_BASE_URLS=$(MESHERY_CLOUD_DEV) \
PORT=9081 \
DEBUG=true \
ADAPTER_URLS=$(ADAPTER_URLS) \
go run main.go;
golangci-run: error
GO111MODULE=off GOPROXY=direct GOSUMDB=off go get github.com/golangci/golangci-lint/cmd/[email protected];
$(GOPATH)/bin/golangci-lint run
proto:
# see https://grpc.io/docs/languages/go/quickstart/
# go get -u google.golang.org/grpc
# go get -u google.golang.org/protobuf/cmd/protoc-gen-go \
# google.golang.org/grpc/cmd/protoc-gen-go-grpc
# PATH=$(PATH):`pwd`/../protoc/bin:$(GOPATH)/bin
# export PATH=$PATH:`pwd`/../protoc/bin:$GOPATH/bin
protoc -I meshes/ meshes/meshops.proto --go-grpc_out=./meshes/ --go_out=./meshes/
# Installs dependencies for building the user interface.
setup-ui-libs:
cd ui; npm i; cd ..
cd provider-ui; npm i; cd ..
# Runs the Meshery UI interface on your local machine.
run-ui-dev:
cd ui; npm run dev; cd ..
# Runs the Provider UI interface on your local machine.
run-provider-ui-dev:
cd provider-ui; npm run dev; cd ..
# Runs the lint on Meshery UI interface on your local machine.
run-ui-lint:
cd ui; npm run lint; cd ..
# Runs the lint on Meshery UI interface on your local machine.
run-provider-ui-lint:
cd provider-ui; npm run lint; cd ..
# Runs the test on Provider UI interface on your local machine.
run-provider-ui-test:
cd provider-ui; npm run test; cd ..
# Builds all user interfaces on your local machine.
build-ui:
cd ui; npm run build && npm run export; cd ..
cd provider-ui; npm run build && npm run export; cd ..
# Builds only the meshery user interface on your local machine
build-meshery-ui:
cd ui; npm run build && npm run export; cd ..
# Builds only the provider user interface on your local machine
build-provider-ui:
cd provider-ui; npm run build && npm run export; cd ..
# setup wrk2 for local dev
# NOTE: setup-wrk does not work on Mac Catalina at the moment
setup-wrk2:
cd cmd; git clone https://github.com/layer5io/wrk2.git; cd wrk2; make; cd ..
setup-nighthawk:
cd cmd; git clone https://github.com/layer5io/nighthawk-go.git; cd wrk2; make setup; cd ..
#Incorporating Make docs commands from the Docs Makefile
jekyll=bundle exec jekyll
site:
cd docs; bundle install; $(jekyll) serve --drafts --livereload --config _config_dev.yml
build-docs:
cd docs; $(jekyll) build --drafts
docker-docs:
cd docs; docker run --name meshery-docs --rm -p 4000:4000 -v `pwd`:"/srv/jekyll" jekyll/jekyll:4.0.0 bash -c "bundle install; jekyll serve --drafts --livereload"
.PHONY: chart-readme
chart-readme:
go run github.com/norwoodj/helm-docs/cmd/helm-docs -c install/kubernetes/helm/
swagger-spec:
swagger generate spec -o ./helpers/swagger.yaml --scan-models
swagger-run:swagger-spec
swagger serve ./helpers/swagger.yaml
swagger-docs:
swagger generate spec -o ./docs/_data/swagger.yml --scan-models; \
swagger flatten ./docs/_data/swagger.yml -o ./docs/_data/swagger.yml --with-expand --format=yaml
graphql-docs:
cd docs; build-docs; bundle exec rake graphql:compile_docs
gqlgen-generate:
cd internal/graphql; go run -mod=mod github.com/99designs/gqlgen generate
.PHONY: error
error:
go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./helpers -o ./helpers --skip-dirs mesheryctl