No description, website, or topics provided.
Branch: master
Clone or download
jmelis Merge pull request #24 from jmelis/graphql-schema-dynamic
Dynamic GraphQL Schema - intermediate format
Latest commit 29763e9 Feb 7, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets working schemas in intermediate format Feb 1, 2019
openshift fix readiness and liveliness probe Jan 25, 2019
src refactor interfaces and datafile checking logic Feb 2, 2019
test make tests pass Feb 2, 2019
.dockerignore docker: ignore dist/* Jan 22, 2019
.env.example add support for loading files from fs Dec 7, 2018
.gitignore introduce webpack + typescript Jan 21, 2019
.travis.yml travis: turn off email notifications Jan 23, 2019
LICENSE add apache license Jan 21, 2019
Makefile Add more information to development process Feb 3, 2019 add Nov 29, 2018
package.json preferred used of import over require Feb 2, 2019
tsconfig.json add /src and /static and get tests passing Jan 22, 2019
tslint.json add tslint Jan 21, 2019
webpack.config.ts support loading project modules without extension Jan 31, 2019
yarn.lock preferred used of import over require Feb 2, 2019


qontract (Queryable cONTRACT) is a collection of tools used to SREs to expose available managed services to application developer teams. This repository compromises the server component, which is implemented as a GraphQL API.

Development Environment

Although it is not required, it's recommended that you use yarn for install dependencies and running development scripts.

To install this projects dependencies to a local node_modules directory:

yarn install

To run a process that watches for edits and rebuilds JavaScript from TypeScript:

yarn run watch

Or alternatively, you can run the TypeScript compilation once:

yarn build

To run an instance of the qontract GraphQL console:

LOAD_METHOD=fs DATAFILES_FILE=your_test_datafile yarn run server

Specific instructions for CentOS 7:

# Install node10
sudo yum install centos-release-scl-rh
sudo yum install rh-nodejs10

# Install yarn (as root)
scl enable rh-nodejs10 bash
npm install -g yarn

# Enable node10 (as user in qontract-server git repo)
scl enable rh-nodejs10 bash

# Install qontract-server yarn modules
yarn install

# Build the JavaScript
yarn build

# Start the server
LOAD_METHOD=fs DATAFILES_FILE=<data-bundle-json> yarn run server

Creating the data and schema bundles

The bundles are required to run the validation and to start the server.

docker pull
docker run --rm -v $DATA_DIR:/data:z qontract-bundler /data > data.json
docker run --rm -v $SCHEMAS_DIR:/schemas:z qontract-bundler /schemas > schemas.json

As of right now, the $SCHEMAS_DIR is assets/schemas/ dir in the qontract-server git repository, although in the future it will be removed from this repository.

Validating the data against the schemas

docker run --rm -v $BUNDLES_DIR:/bundles:z qontract-validator --only-errors /bundles/schemas.json /bundles/data.json

The $BUNDLES_DIR is a directory that must contain the data.json and schemas.json file created in the previous section.


All code should follow the airbnb style guide, which is enforced by this projects lint script:

yarn run lint