forked from apollographql/federation-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add command line processing (apollographql#70)
* Add command line processing resolves apollographql#64 Added command line processing with log level and file watch functionality. Server API now allows config by file with optional watching for hot reload. File watching is implemented using Hotwatch to generate a stream of events. * Apply suggestions from code review Co-authored-by: Cecile Tonglet <[email protected]> * Added support for project_dir Added env support. Added the ability to set the directory where configuration files are obtained from. Default config directory is OS dependent. * Update crates/server/src/state_machine.rs Co-authored-by: Cecile Tonglet <[email protected]> * Added support to display project_dir in the help. Take in feedback. * Simplify logging config * Fix imports Co-authored-by: bryn <[email protected]> Co-authored-by: Cecile Tonglet <[email protected]>
- Loading branch information
1 parent
238a0b8
commit acadcfe
Showing
15 changed files
with
755 additions
and
148 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Development | ||
Rust implementation of federation router. | ||
|
||
## Libs | ||
* Configuration - Config model and loading. | ||
* Query planner - Query plan model and a caching wrapper for calling out to the nodejs query planner. | ||
* Execution - Converts a query plan to a stream. | ||
* Server - Handles requests, | ||
obtains a query plan from the query planner, | ||
obtains an execution pipeline, | ||
returns the results | ||
|
||
## Binaries | ||
* Main - Starts a server. | ||
|
||
## Development | ||
We recommend using [asdf](https://github.com/asdf-vm/asdf) to make sure your nodejs and rust versions are correct. | ||
The versions currently used to compile are specified in [.tool-versions](.tool-versions). | ||
To set up your toolchain run: | ||
```shell | ||
asdf add-plugin rust | ||
asdf add-plugin nodejs | ||
asdf install | ||
asdf reshim | ||
``` | ||
|
||
The `harmonizer` dependency requires building a nodejs project. This should happen automatically, but may take some time. | ||
|
||
Set up your git hooks: | ||
```shell | ||
git config --local core.hooksPath .githooks/ | ||
``` | ||
|
||
### Getting started | ||
Use `cargo build --all-targets` to build the project.` | ||
|
||
Some tests run against the existing nodejs implementation of the router. This requires that the `federation-demo` | ||
project is running. | ||
|
||
```shell | ||
git submodule sync --recursive; git submodule update --recursive --init | ||
cd submodules/federation-demo; npm install; | ||
npm run start-services &; | ||
# Wait for the services to start | ||
npm run start-gateway &; | ||
``` | ||
|
||
### Strict linting | ||
While developing locally doc warnings and other lint checks are disabled. | ||
This limits the noise generated while exploration is taking place. | ||
|
||
When you are ready to create a PR, run a build with strict checking enabled. | ||
Use `scripts/ci-build.sh` to perform such a build. | ||
|
||
## Project maintainers | ||
Apollo Graph, Inc. <[email protected]> | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,27 @@ | ||
# Router | ||
Rust implementation of federation router. | ||
# Apollo Federation Router | ||
Rust implementation of Federated GraphQL router. | ||
|
||
## Libs | ||
* Configuration - Config model and loading. | ||
* Query planner - Query plan model and a caching wrapper for calling out to the nodejs query planner. | ||
* Execution - Converts a query plan to a stream. | ||
* Server - Handles requests, | ||
obtains a query plan from the query planner, | ||
obtains an execution pipeline, | ||
returns the results | ||
|
||
## Binaries | ||
* Main - Starts a server. | ||
## Usage | ||
Apollo Federation Router requires `configuration.yaml` and `supergraph.graphql` to be supplied. | ||
These are either located in the default directory (OS dependent) or explicitly specified via flag. | ||
|
||
## Development | ||
We recommend using [asdf](https://github.com/asdf-vm/asdf) to make sure your nodejs and rust versions are correct. | ||
The versions currently used to compile are specified in [.tool-versions](.tool-versions). | ||
To set up your toolchain run: | ||
```shell | ||
asdf add-plugin rust | ||
asdf add-plugin nodejs | ||
asdf install | ||
asdf reshim | ||
The router will draw its configuration from an OS dependent directory that can be viewed via the help command. | ||
``` | ||
|
||
The `harmonizer` dependency requires building a nodejs project. This should happen automatically, but may take some time. | ||
|
||
Set up your git hooks: | ||
```shell | ||
git config --local core.hooksPath .githooks/ | ||
OPTIONS: | ||
-c, --config <configuration-path> Configuration location relative to the project directory [env: | ||
CONFIGURATION_PATH=] [default: configuration.yaml] | ||
-p, --project_dir <project-dir> Directory where configuration files are located (OS dependent). [env: | ||
PROJECT_DIR=] [default: /home/bryn/.config/federation] | ||
-s, --schema <schema-path> Schema location relative to the project directory [env: SCHEMA_PATH=] | ||
[default: supergraph.graphql] | ||
``` | ||
|
||
### Getting started | ||
Use `cargo build --all-targets` to build the project.` | ||
|
||
Some tests run against the existing nodejs implementation of the router. This requires that the `federation-demo` | ||
project is running. | ||
|
||
```shell | ||
git submodule sync --recursive; git submodule update --recursive --init | ||
cd submodules/federation-demo; npm install; | ||
npm run start-services &; | ||
# Wait for the services to start | ||
npm run start-gateway &; | ||
To use configuration from another directory use the `-p` option. | ||
``` | ||
router -p examples/supergraphdemo | ||
``` | ||
|
||
### Strict linting | ||
While developing locally doc warnings and other lint checks are disabled. | ||
This limits the noise generated while exploration is taking place. | ||
|
||
When you are ready to create a PR, run a build with strict checking enabled. | ||
Use `scripts/ci-build.sh` to perform such a build. | ||
This CLI is not meant to be a long term thing, as users will likely use Rover to start the server in future. | ||
|
||
## Project maintainers | ||
Apollo Graph, Inc. <[email protected]> | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ env_logger = "0.9.0" | |
[dev-dependencies] | ||
httpmock = "0.5.8" | ||
maplit = "1.0.2" | ||
ctor = "0.1.20" |
Oops, something went wrong.