-
Notifications
You must be signed in to change notification settings - Fork 216
/
Makefile
120 lines (103 loc) · 4.71 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
LATEST_VERSION := $$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' package.json)
BUILD_PLATFORMS = linux/arm64,linux/amd64
include .env
.PHONY: all
all: install-tools
.PHONY: install-tools
install-tools:
yarn install
@echo "All tools installed"
.PHONY: dev-build
dev-build:
docker compose -f docker-compose.dev.yml build
.PHONY: dev-up
dev-up:
docker compose -f docker-compose.dev.yml up -d
.PHONY: dev-down
dev-down:
docker compose -f docker-compose.dev.yml down
.PHONY: dev-lint
dev-lint:
./docker/ingestor/run_linting.sh && npx nx run-many -t lint:fix
.PHONY: ci-lint
ci-lint:
./docker/ingestor/run_linting.sh && npx nx run-many -t ci:lint
.PHONY: dev-int-build
dev-int-build:
docker compose -p int -f ./docker-compose.ci.yml build
.PHONY: dev-int
dev-int:
docker compose -p int -f ./docker-compose.ci.yml run --rm api dev:int $(FILE)
docker compose -p int -f ./docker-compose.ci.yml down
.PHONY: ci-int
ci-int:
docker compose -p int -f ./docker-compose.ci.yml run --rm api ci:int
@echo "\n\n"
@echo "Checking otel-collector...\n"
curl -v http://localhost:23133
@echo "\n\n"
@echo "Checking ingestor...\n"
curl -v http://localhost:28686/health
.PHONY: dev-unit
dev-unit:
npx nx run-many -t dev:unit
.PHONY: ci-unit
ci-unit:
npx nx run-many -t ci:unit
# TODO: check db connections before running the migration CLIs
.PHONY: dev-migrate-db
dev-migrate-db:
@echo "Migrating Mongo db...\n"
npx nx run @hyperdx/api:dev:migrate-db
@echo "Migrating ClickHouse db...\n"
npx nx run @hyperdx/api:dev:migrate-ch
.PHONY: build-local
build-local:
docker build ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target prod &
docker build ./docker/ingestor -t ${IMAGE_NAME}:${LATEST_VERSION}-ingestor --target prod &
docker build ./docker/otel-collector -t ${IMAGE_NAME}:${LATEST_VERSION}-otel-collector --target prod &
docker build --build-arg CODE_VERSION=${LATEST_VERSION} . -f ./packages/miner/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-miner --target prod &
docker build --build-arg CODE_VERSION=${LATEST_VERSION} . -f ./packages/go-parser/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-go-parser &
docker build \
--build-arg CODE_VERSION=${LATEST_VERSION} \
--build-arg PORT=${HYPERDX_API_PORT} \
. -f ./packages/api/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-api --target prod &
docker build \
--build-arg CODE_VERSION=${LATEST_VERSION} \
--build-arg OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT} \
--build-arg OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME} \
--build-arg PORT=${HYPERDX_APP_PORT} \
--build-arg SERVER_URL=${HYPERDX_API_URL}:${HYPERDX_API_PORT} \
. -f ./packages/app/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-app --target prod
.PHONY: version
version:
sh ./version.sh
.PHONY: release
release:
docker buildx build --platform ${BUILD_PLATFORMS} ./docker/hostmetrics -t ${IMAGE_NAME}:${LATEST_VERSION}-hostmetrics --target prod --push &
docker buildx build --platform ${BUILD_PLATFORMS} ./docker/ingestor -t ${IMAGE_NAME}:${LATEST_VERSION}-ingestor --target prod --push &
docker buildx build --platform ${BUILD_PLATFORMS} ./docker/otel-collector -t ${IMAGE_NAME}:${LATEST_VERSION}-otel-collector --target prod --push &
docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} --platform ${BUILD_PLATFORMS} . -f ./packages/miner/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-miner --target prod --push &
docker buildx build --build-arg CODE_VERSION=${LATEST_VERSION} --platform ${BUILD_PLATFORMS} . -f ./packages/go-parser/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-go-parser --push &
docker buildx build \
--build-arg CODE_VERSION=${LATEST_VERSION} \
--build-arg PORT=${HYPERDX_API_PORT} \
--platform ${BUILD_PLATFORMS} . -f ./packages/api/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-api --target prod --push &
docker buildx build \
--build-arg CODE_VERSION=${LATEST_VERSION} \
--build-arg OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT} \
--build-arg OTEL_SERVICE_NAME=${OTEL_SERVICE_NAME} \
--build-arg PORT=${HYPERDX_APP_PORT} \
--build-arg SERVER_URL=${HYPERDX_API_URL}:${HYPERDX_API_PORT} \
--platform ${BUILD_PLATFORMS} . -f ./packages/app/Dockerfile -t ${IMAGE_NAME}:${LATEST_VERSION}-app --target prod --push &
docker buildx build \
--squash . -f ./docker/local/Dockerfile \
--build-context clickhouse=./docker/clickhouse \
--build-context otel-collector=./docker/otel-collector \
--build-context ingestor=./docker/ingestor \
--build-context local=./docker/local \
--build-context api=./packages/api \
--build-context app=./packages/app \
--platform ${BUILD_PLATFORMS} \
-t ${LOCAL_IMAGE_NAME_DOCKERHUB}:latest -t ${LOCAL_IMAGE_NAME_DOCKERHUB}:${LATEST_VERSION} \
-t ${LOCAL_IMAGE_NAME}:latest -t ${LOCAL_IMAGE_NAME}:${LATEST_VERSION} --push