forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
193 lines (160 loc) · 6.43 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
185
186
187
188
189
190
191
192
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
# All documents to be used in spell check.
ALL_DOCS := $(shell find . -type f -name '*.md' -not -path './.github/*' -not -path '*/node_modules/*' -not -path '*/_build/*' -not -path '*/deps/*' | sort)
PWD := $(shell pwd)
TOOLS_DIR := ./internal/tools
MISSPELL_BINARY=bin/misspell
MISSPELL = $(TOOLS_DIR)/$(MISSPELL_BINARY)
DOCKER_COMPOSE_CMD ?= docker compose
DOCKER_COMPOSE_ENV=--env-file .env --env-file .env.override
# see https://github.com/open-telemetry/build-tools/releases for semconvgen updates
# Keep links in semantic_conventions/README.md and .vscode/settings.json in sync!
SEMCONVGEN_VERSION=0.11.0
# TODO: add `yamllint` step to `all` after making sure it works on Mac.
.PHONY: all
all: install-tools markdownlint misspell
$(MISSPELL):
cd $(TOOLS_DIR) && go build -o $(MISSPELL_BINARY) github.com/client9/misspell/cmd/misspell
.PHONY: misspell
misspell: $(MISSPELL)
$(MISSPELL) -error $(ALL_DOCS)
.PHONY: misspell-correction
misspell-correction: $(MISSPELL)
$(MISSPELL) -w $(ALL_DOCS)
.PHONY: markdownlint
markdownlint:
@if ! npm ls markdownlint; then npm install; fi
@for f in $(ALL_DOCS); do \
echo $$f; \
npx --no -p markdownlint-cli markdownlint -c .markdownlint.yaml $$f \
|| exit 1; \
done
.PHONY: install-yamllint
install-yamllint:
# Using a venv is recommended
pip install -U yamllint~=1.30.0
.PHONY: yamllint
yamllint:
yamllint .
.PHONY: checklicense
checklicense:
@echo "Checking license headers..."
npx @kt3k/license-checker -q
.PHONY: addlicense
addlicense:
@echo "Adding license headers..."
npx @kt3k/license-checker -q -i
# Run all checks in order of speed / likely failure.
.PHONY: check
check: misspell markdownlint checklicense
@echo "All checks complete"
# Attempt to fix issues / regenerate tables.
.PHONY: fix
fix: misspell-correction
@echo "All autofixes complete"
.PHONY: install-tools
install-tools: $(MISSPELL)
npm install
@echo "All tools installed"
.PHONY: build
build:
$(DOCKER_COMPOSE_CMD) build
.PHONY: build-and-push-dockerhub
build-and-push-dockerhub:
$(DOCKER_COMPOSE_CMD) --env-file .dockerhub.env -f docker-compose.yml build
$(DOCKER_COMPOSE_CMD) --env-file .dockerhub.env -f docker-compose.yml push
.PHONY: build-and-push-ghcr
build-and-push-ghcr:
$(DOCKER_COMPOSE_CMD) --env-file .ghcr.env -f docker-compose.yml build
$(DOCKER_COMPOSE_CMD) --env-file .ghcr.env -f docker-compose.yml push
.PHONY: build-env-file
build-env-file:
cp .env .dockerhub.env
sed -i '/IMAGE_VERSION=.*/c\IMAGE_VERSION=${RELEASE_VERSION}' .dockerhub.env
sed -i '/IMAGE_NAME=.*/c\IMAGE_NAME=${DOCKERHUB_REPO}' .dockerhub.env
cp .env .ghcr.env
sed -i '/IMAGE_VERSION=.*/c\IMAGE_VERSION=${RELEASE_VERSION}' .ghcr.env
sed -i '/IMAGE_NAME=.*/c\IMAGE_NAME=${GHCR_REPO}' .ghcr.env
.PHONY: run-tests
run-tests:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run frontendTests
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests
.PHONY: run-tracetesting
run-tracetesting:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests ${SERVICES_TO_TEST}
.PHONY: generate-protobuf
generate-protobuf:
./ide-gen-proto.sh
.PHONY: generate-kubernetes-manifests
generate-kubernetes-manifests:
helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo update
echo "# Copyright The OpenTelemetry Authors" > kubernetes/opentelemetry-demo.yaml
echo "# SPDX-License-Identifier: Apache-2.0" >> kubernetes/opentelemetry-demo.yaml
echo "# This file is generated by 'make generate-kubernetes-manifests'" >> kubernetes/opentelemetry-demo.yaml
echo "---" >> kubernetes/opentelemetry-demo.yaml
echo "apiVersion: v1" >> kubernetes/opentelemetry-demo.yaml
echo "kind: Namespace" >> kubernetes/opentelemetry-demo.yaml
echo "metadata:" >> kubernetes/opentelemetry-demo.yaml
echo " name: otel-demo" >> kubernetes/opentelemetry-demo.yaml
helm template opentelemetry-demo open-telemetry/opentelemetry-demo --namespace otel-demo | sed '/helm.sh\/chart\:/d' | sed '/helm.sh\/hook/d' | sed '/managed-by\: Helm/d' >> kubernetes/opentelemetry-demo.yaml
.PHONY: start
start:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo is running."
@echo "Go to http://localhost:8080 for the demo UI."
@echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI."
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
.PHONY: start-minimal
start-minimal:
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose.minimal.yml up --force-recreate --remove-orphans --detach
@echo ""
@echo "OpenTelemetry Demo in minimal mode is running."
@echo "Go to http://localhost:8080 for the demo UI."
@echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI."
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
.PHONY: stop
stop:
$(DOCKER_COMPOSE_CMD) down --remove-orphans --volumes
$(DOCKER_COMPOSE_CMD) -f docker-compose-tests.yml down --remove-orphans --volumes
@echo ""
@echo "OpenTelemetry Demo is stopped."
# Use to restart a single service component
# Example: make restart service=frontend
.PHONY: restart
restart:
# work with `service` or `SERVICE` as input
ifdef SERVICE
service := $(SERVICE)
endif
ifdef service
$(DOCKER_COMPOSE_CMD) stop $(service)
$(DOCKER_COMPOSE_CMD) rm --force $(service)
$(DOCKER_COMPOSE_CMD) create $(service)
$(DOCKER_COMPOSE_CMD) start $(service)
else
@echo "Please provide a service name using `service=[service name]` or `SERVICE=[service name]`"
endif
# Use to rebuild and restart (redeploy) a single service component
# Example: make redeploy service=frontend
.PHONY: redeploy
redeploy:
# work with `service` or `SERVICE` as input
ifdef SERVICE
service := $(SERVICE)
endif
ifdef service
$(DOCKER_COMPOSE_CMD) build $(service)
$(DOCKER_COMPOSE_CMD) stop $(service)
$(DOCKER_COMPOSE_CMD) rm --force $(service)
$(DOCKER_COMPOSE_CMD) create $(service)
$(DOCKER_COMPOSE_CMD) start $(service)
else
@echo "Please provide a service name using `service=[service name]` or `SERVICE=[service name]`"
endif