forked from retracedhq/retraced
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (73 loc) · 3.84 KB
/
Makefile
File metadata and controls
94 lines (73 loc) · 3.84 KB
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
.PHONY: clean prebuild deps lint swagger routes build cover test report-coverage pkg build run run-processor run-debug
SKIP :=
REPO := retracedhq/retraced
PATH := $(shell pwd):${PATH}
SHELL := /bin/bash -lo pipefail
clean:
rm *.snyk-patch
prebuild:
rm -rf build
mkdir -p build
deps:
yarn install --force
lint:
`yarn bin`/tslint --project ./tsconfig.json --fix
swagger:
`yarn bin`/tsoa swagger
routes:
`yarn bin`/tsoa routes
build: swagger routes
`yarn bin`/tsc
mkdir -p bin && cp build/src/retracedctl.js bin/retracedctl && chmod +x bin/retracedctl
cover:
yarn cover
test:
yarn test
report-coverage:
yarn report-coverage
# Bundle into four standalone binaries so we can obfuscate the source code
#
# the sed command is because ug-format uses a bizarre import that does `require(__dirname + '/some-module')`
# and we need to change it to `require('./some-module')` to make `pkg` work, because pkg can't currently
# handle imports that are not string literals.
# sed -i.bak 's/lazyLoad(.\(.\+\).\, opts)/require(".\/api\/\1.js")/g' node_modules/@elastic/elasticsearch/api/index.js &&
# sed -i.bak 's/function ESAPI/const path = require("path");\nfunction ESAPI/g' node_modules/@elastic/elasticsearch/api/index.js && cat node_modules/@elastic/elasticsearch/api/index.js &&
pkg:
if [ -n "$(SKIP)" ]; then exit 0; else \
sed -i.bak "s/__dirname + '/'.\//g" node_modules/pg-format/lib/index.js && \
sed -i.bak 's/lazyLoad(.\(.\+\).\, opts)/require(".\/api\/\1.js")(opts)/g' node_modules/@elastic/elasticsearch/api/index.js && \
`yarn bin`/pkg -t node16-linux --options no-deprecation --output api ./build/src/index.js && \
`yarn bin`/pkg -t node16-linux --options no-deprecation --output retracedctl ./build/src/retracedctl.js && \
`yarn bin`/pkg -t node16-linux --options no-deprecation --output processor ./build/src/_processor/index.js && \
`yarn bin`/pkg -t node16-linux --options no-deprecation --output retraceddb ./build/src/_db/runner-lite.js && \
`yarn bin`/pkg -t node16-linux --options "max_old_space_size=4096,no-deprecation" --output retraceddb4G ./build/src/_db/runner-lite.js && \
`yarn bin`/pkg -t node16-linux --options "max_old_space_size=8192,no-deprecation" --output retraceddb8G ./build/src/_db/runner-lite.js && \
`yarn bin`/pkg -t node16-linux --options "max_old_space_size=16384,no-deprecation" --output retraceddb16G ./build/src/_db/runner-lite.js; \
fi
run:
node --no-deprecation ./build/index.js
run-processor:
node --no-deprecation ./build/_processor/index.js
run-debug:
node --no-deprecation ./build/index.js
# `yarn bin`/ts-node --inspect=0.0.0.0 --no-deprecation ./src/index.ts
k8s-pre:
rm -rf build/k8s
mkdir -p build/k8s
k8s-deployment:
`yarn bin`/handlebars --tag '"$(tag)"' < deploy/k8s/api-deployment.yml.hbs > build/k8s/api-deployment.yml
`yarn bin`/handlebars --tag '"$(tag)"' < deploy/k8s/processor-deployment.yml.hbs > build/k8s/processor-deployment.yml
`yarn bin`/handlebars --tag '"$(tag)"' < deploy/k8s/cron-deployment.yml.hbs > build/k8s/cron-deployment.yml
`yarn bin`/handlebars --tag '"$(tag)"' < deploy/k8s/nsqd-deployment.yml.hbs > build/k8s/nsqd-deployment.yml
k8s-service:
`yarn bin`/handlebars < deploy/k8s/api-service.yml.hbs > build/k8s/api-service.yml
`yarn bin`/handlebars < deploy/k8s/nsqd-service.yml.hbs > build/k8s/nsqd-service.yml
k8s-ingress:
`yarn bin`/handlebars < deploy/k8s/api-ingress.yml.hbs > build/k8s/api-ingress.yml
k8s-migrate:
`yarn bin`/handlebars --tag '"$(tag)"' < ./deploy/k8s/migratepg-job.yml.hbs > ./build/k8s/migratepg-job.yml
`yarn bin`/handlebars --tag '"$(tag)"' < ./deploy/k8s/migratees-job.yml.hbs > ./build/k8s/migratees-job.yml
k8s: k8s-pre k8s-deployment k8s-service k8s-ingress k8s-migrate
: "Templated k8s yamls"
dev:
skaffold dev --status-check=false --force=true