Node.js implementation to load compendia from third party repositories and handle direct user uploads for the o2r web api.
Currently, it implements the endpoint /api/v1/substitution
.
- Node.js
>= 6.2
- npm
The configuration can be done via environment variables.
SUBSTITUTER_PORT
Define on which port substituter should listen. Defaults to8090
.SUBSTITUTER_MONGODB
Required Location for the MongoDB. Defaults tomongodb://localhost/
. You will very likely need to change this.SUBSTITUTER_MONGODB_DATABASE
Which database inside the mongo db should be used. Defaults tomuncher
.SUBSTITUTER_BASEPATH
The local path where compendia are stored. Defaults to/tmp/o2r/
.SESSION_SECRET
String used to sign the session ID cookie, must match other microservices.
npm install
# manually start mongodb, o2r-loader, and o2r-muncher
npm start
npm test
The file Dockerfile
is the basis for the Docker image published at Docker Hub.
To build and run locally use the following commands to start other required microservices
docker build --tag substituter .
docker run --name mongodb -d -p 27017:27017 mongo:3.4
docker run --name testmuncher -d -p 8080:8080 --link mongodb:mongodb -v /tmp/o2r:/tmp/o2r -v /var/run/docker.sock:/var/run/docker.sock -e MUNCHER_MONGODB=mongodb://mongodb:27017 -e DEBUG=* o2rproject/o2r-muncher:latest
docker run --name testloader -d -p 8088:8088 --link mongodb:mongodb -v /tmp/o2r:/tmp/o2r -v /var/run/docker.sock:/var/run/docker.sock -e LOADER_MONGODB=mongodb://mongodb:27017 -e DEBUG=* loader
docker run --name testsubstituter -it -p 8090:8090 --link mongodb:mongodb -v /tmp/o2r:/tmp/o2r -e SUBSTITUTER_MONGODB=mongodb://mongodb:27017 -e DEBUG=* substituter
o2r-substituter is licensed under Apache License, Version 2.0, see file LICENSE.
Copyright (C) 2017 - o2r project.