-
Notifications
You must be signed in to change notification settings - Fork 115
/
build.sh
executable file
·47 lines (33 loc) · 1.91 KB
/
build.sh
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
#!/usr/bin/env bash
set -e
SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
cd $SCRIPT_PATH
# Load and export variables from root .env file into shell environment
set -a
. ../.env
set +a
# Install codegen tools (outside of workspaces to avoid @polkadot/api conflicts)
yarn --cwd codegen install
yarn clean
yarn codegen:noinstall
cp mappings/src/queryTemplates.ts generated/graphql-server/src/
yarn typegen # if this fails try to run this command outside of yarn workspaces
################################################
# We run yarn again to ensure graphql-server dependencies are installed
# and are inline with root workspace resolutions
yarn
# Add missing typeorm binary symlink
ln -s ../../../../../node_modules/typeorm/cli.js ./generated/graphql-server/node_modules/.bin/typeorm
yarn workspace query-node codegen
yarn workspace query-node build
yarn workspace query-node-mappings build
cp ./generated/graphql-server/generated/schema.graphql ../storage-node/src/services/queryNode/schema.graphql
cp ./generated/graphql-server/generated/schema.graphql ../distributor-node/src/services/networking/query-node/schema.graphql
################################################
# temporary patche TODO: create proper solution
# Add command to run Query Node's Graphql server with Opentelemetry instrumentation
sed -i -e '/"start:prod": "WARTHOG_ENV=production yarn dotenv:generate && node dist\/src\/index.js"/a \
"start:prod:with-instrumentation": "export OTEL_APPLICATION=query-node; WARTHOG_ENV=production yarn dotenv:generate && node --require @joystream/opentelemetry dist/src/index.js",' ./generated/graphql-server/package.json
# Add @joystream/opentelemetry dependency symlink, as it is not specified in generated/graphql-server/package.json dependencies
mkdir -p ./generated/graphql-server/node_modules/@joystream
ln -s ../../../../../node_modules/@joystream/opentelemetry ./generated/graphql-server/node_modules/@joystream/opentelemetry