- Install rustup
- Install additional tools:
cargo install cargo-watch cargo-insta
- Install just
- Install Prettier
- Install Docker
- Install protoc. Here are a few options:
brew install protobuf
apt-get install protobuf-compiler
dnf install protobuf-compiler
- Clone graphql-engine v3 in a directory near this one,
and set the
HGE_V3_DIRECTORY
environment variable to the location of thev3
directory. (e.g.export HGE_V3_DIRECTORY="../graphql-engine/v3"
)
See architecture.md for an idea of the general structure.
cargo build
Run the PostgreSQL connector with:
just run
- Start the sample chinook postgres db, compile, run tests, and rerun server on file changes:
just dev
- Query the connector via curl:
curl -H "Content-Type: application/json" \ --data "@crates/tests/tests-common/goldenfiles/select_where_variable.json" \ http://localhost:8080/query \ | jq
Among the docker containers is a Jaeger instance for tracing/debugging, accessible at http://127.0.0.1:4002.
- Run
just dev
(orjust run
) - Run
just run-engine
- Run
just test-integrated
To test all supported databases, run just test
.
- Create a new file under
crates/tests/tests-common/goldenfiles/<your-test-name>.json
- Create a new test in
crates/tests/database-tests/src/<database>/tests/query_tests.rs
that looks like this:#[tokio::test] async fn select_5() { let result = common::test_query("select_5").await; insta::assert_json_snapshot!(result); }
- Run the tests using
just dev
orjust test
- Review the results using
cargo insta review
- Create a new folder under
crates/query-engine/translation/tests/goldenfiles/<your-test-name>/
- Create
request.json
andtables.json
files in that folder to specify your request - Create a new test in
crates/query-engine/translation/tests/tests.rs
that looks like this:#[tokio::test] async fn select_5() { let result = common::test_translation("select_5").await; insta::assert_snapshot!(result); }
- Run the tests using
just dev
for postgres orjust test
for other variants - Review the results using
cargo insta review
and accept them
See debugging.md.
You can also run just dev-citus
and just dev-cockroach
.
We can produce a flamegraph using just flamegraph
using flamegraph-rs.
Follow the installation instructions.
just heaptrack-postgres
builds and run ndc-postgres
using
heaptrack. Once the server has started you
can make requests to it, and a heaptrack....
file will be written in the
root.
This can be opened in the heaptrack_gui
tool which can be run on Linux or
MacOS.
just massif-postgres
builds and run ndc-postgres
using
valgrind, storing data in it's massif
format. You
can investigate these using massif
visualiser or (in a much more
limited fashion) using the online visualiser.
See ../benchmarks/component/README.md.
A benchmark history can be viewed here.
We have a Prometheus / Grafana set up in Docker. Run just open-prometheus
or
just open-grafana
to start them and navigate to the prometheus or grafana
dashboards respectively.
The Grafana dashboard is exported and saved in
metrics/grafana/dashboards/*.json
. To make changes, update the graphs in the
UI, export the JSON file and save it in this folder.
Run just lint
to run clippy linter
run just lint-apply
to attempt to autofix all linter suggestions
Check your formatting is great with just format-check
.
Format all Rust code with just format
.
To see OpenAPI definitions for V1 configuration, just document-openapi
.