Defines data structure for ABT Node backend API, and maintains schema for GQL endpoint.
You can choose one of the following two ways to build schema. It is recommended to build with Docker.
Requirements:
- Docker
docker pull arcblock/blocklet-server-proto
docker run --rm -v {absolute path of core/schema}:/home/root/schema arcblock/blocklet-server-proto
Requirements:
- go 1.8+
- Mac: brew install go
- Other platform: https://go.dev/doc/install
# you can use `go env` to check the go environment
go env
# Install(Mac OS), other platform: https://www.gnu.org/software/sed/
brew install gnu-sed
# Make `sed` command work, only for homebrew:
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
- Mac: brew install protobuf
- Other platform: https://developers.google.com/protocol-buffers/docs/downloads
vim ~/.profile
# add the profile to the end of the file
# ----------------------------------------------------------
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
# you can query the GOROOT/GOPATH/GOBIN by `go env`
export GOROOT=/usr/local/Cellar/go/1.15.5/libexec // replace to your local go path
export GOPATH=$HOME/.golang
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
# ----------------------------------------------------------
source ~/.profile
Run make init
If there is a network problem, try to change golang registry by https://goproxy.cn/
Make sure you're in the core/schema
directory, run make build
Ensure that core/schema has been built, please see here.
If you are using mac, you may need replace the
sed
command withgsed
just run:
npm run open:gql
should make sure the DB Proxy is running, if not, run
yarn start
in a new terminal
just run:
npm run upgrade
In the root directory of the project, run:
npm run update:schema
The execution steps of this command are as follows:
- Step 1: Execute 'make build' in the 'core/schema' directory
- Step 2: Execute 'npm run open:gql' in the 'core/webapp' directory
- Step 3: Execute 'npm run upgrade' in the 'core/client' directory
- Step 4: Terminate the process started in Step 2