The main Ontohub service that serves the data for the frontend and other clients via the GraphQL API.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
bin
config
db
git/hooks
lib
log
public
spec
tmp
.codeclimate.yml
.env
.gitattributes
.gitignore
.hound.yml
.rspec
.rubocop.yml
.ruby-version
.stickler.yml
.travis.yml
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
config.ru
invoker.ini

README.md

Build Status Coverage Status Code Climate GitHub issues

ontohub-backend

The main Ontohub service that serves the data for the frontend and other clients via the GraphQL API.

Run the backend in development mode

You need to have the postgres and rabbitmq services started. This guide assumes that you have got the hets-agent located at ../hets-agent relative to the ontohub-backend repository.

With invoker

We use the invoker process manager during development to run all the needed processes with one command. You can start it with either bundle exec rails invoker or bundle exec invoker start invoker.ini (the former only calls the latter, but consumes more memory).

Manually

Alternatively, you can start the processes yourself by running each of these commands in a separate terminal:

  • bundle exec rails sneakers:run to run the sneakers workers
  • bundle exec rails server to run the HTTP server of the backend in development mode
  • pushd ../hets-agent && bin/hets_agent; popd to run the HetsAgent

Access the backend

The backend is then reachable from the browser at http://localhost:3000. The interactive GraphiQL console can be accessed at http://localhost:3000/graphiql.

Dependencies

The backend is implemented in Ruby on Rails. First, the Ruby version referenced in the file .ruby-version needs to be installed, as well as the gem bundler. git needs to be installed as well. Invoking the command bundle install in the directory of this repository will then install all dependencies of the backend.

Set up a development environment

In order to set up a complete environment, please refer to the wiki page Setting up the development environment.

Build the REST API documentation

We maintain API documentation with a JSON schema description. The schemas are located at spec/support/api/schemas. You can build an HTML-representation of it with doca. This requires the tools npm and yarn to be installed on your system and be in your PATH.

First, you need to install doca with npm. We created a Rake task for this:

rails apidoc:prepare

Next, you need to create the documentation server files:

rails apidoc:init

This initialization must be run whenever new schema files are created.

And finally, you can run the API documentation server (the default port is 3002):

rails apidoc:run
# or to change the port:
PORT=8001 rails apidoc:run

Then, visit http://localhost:3002 to see the REST API documentation. This server listens to changes on the JSON schema files and updates the documentation.