ipld-eth-server/postgraphile
2019-04-15 14:17:33 -04:00
..
spec Add schemas to config 2019-04-15 14:17:33 -04:00
src Add schemas to config 2019-04-15 14:17:33 -04:00
.dockerignore Dockerize postgraphile 2019-02-11 11:27:27 +01:00
Dockerfile Nuke OpenRC from docker image, update readme's 2019-02-11 11:27:33 +01:00
package.json Add schemas to config 2019-04-15 14:17:33 -04:00
README.md Add schemas to config 2019-04-15 14:17:33 -04:00
tsconfig.json Add Postgraphile subscription exposure 2018-09-04 20:20:43 -05:00
tsconfig.test.json Add Postgraphile subscription exposure 2018-09-04 20:20:43 -05:00
tslint.json Add Postgraphile subscription exposure 2018-09-04 20:20:43 -05:00
webpack.config.js Add Postgraphile subscription exposure 2018-09-04 20:20:43 -05:00
yarn.lock readme addition; fix postgraphile lodash and webpack-dev-server alerts 2019-04-09 19:03:08 -05:00

Vulcanize GraphQL API

This application utilizes Postgraphile to expose GraphQL endpoints for exposure of the varied data that VulcanizeDB tracks.

Docker use

Note: currently this image is ~500MB large (unpacked)

Build the docker image in this directory. Start the GraphiQL frontend by:

  • Setting the env variables for the database connection: DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD (and optionally DATABASE_PORT if running on non-standard port).
    • The specified user needs to be superuser on the vulcanizeDB database
  • Run the container (ex. docker run -e DATABASE_HOST=localhost -e DATABASE_NAME=vulcanize_public -e DATABASE_USER=vulcanize -e DATABASE_PASSWORD=vulcanize -d m0ar/images:postgraphile-alpine)
  • GraphiQL is available at :3000/graphiql

By default, this build will expose only the "public" schema - to add other schemas, use a config file config.toml and set the env var CONFIG_PATH to point to its location. Example toml:

[database]
    name     = "vulcanize_public"
    hostname = "localhost"
    port = 5432
    schemas = ["public", "yourschema"]

Building

This application assumes the use of the Yarn package manager. The use of npm may produce unexpected results.

Install dependencies with yarn and execute yarn build. The bundle produced by Webpack will be present in build/dist/.

This application currently uses the Postgraphile supporter plugin. This plugin is present in the vendor/ directory and is copied to node_modules/ after installation of packages. It is a fresh checkout of the plugin as of August 31st, 2018.

Running

Provide the built bundle to node as a runnable script: node ./build/dist/vulcanize-postgraphile-server.js

Testing

Tests are executed via Jasmine with a console reporter via the yarn test task.