The following environment variables can be used to configure the server:
General:
NODE_ENV
: the environment mode; eitherproduction
ordevelopment
(default)PORT
: the port on which the server runs (default3000
)LOG_LEVEL
: minimum log level; one ofinfo
(default),warn
,error
Database:
DB_NAME
: name of the db (defaultfactoid
)DB_HOST
: hostname or ip address of the database host (defaultlocalhost
)DB_PORT
: port where the db can be accessed (default28015
, the rethinkdb default)DB_USER
: username if the db uses auth (undefined by default)DB_PASS
: password if the db uses auth (undefined by default)DB_CERT
: local file path to certificate (cert) file if the db uses ssl (undefined by default)
Services:
DEFAULT_CACHE_SIZE
: default max number of entries in each cacheREACH_URL
: full url of the reach textmining endpointUNIPROT_URL
: full url of uniprot query serviceUNIPROT_CACHE_SIZE
: overrides default cache size for uniprot query cache
npm start
: start the servernpm stop
: stop the servernpm run build
: build projectnpm run build-prod
: build the project for productionnpm run bundle-profile
: visualise the bundle dependenciesnpm run clean
: clean the projectnpm run watch
: watch mode (debug mode enabled, auto rebuild, livereload)npm test
: run testsnpm run lint
: lint the project
Build the container. Here, factoid
is used as the container name.
cd factoid
docker build -t factoid .
Run the container:
docker run -it -p 12345:3000 -u "node" -e "NODE_ENV=production" -e "PORT=3000" --name "factoid" factoid
Or run with an env file that defines the environment variables:
docker run -it -p 12345:3000 -u "node" --env-file prod.env --name "factoid" factoid
Notes:
- The
-it
switches are necessary to makenode
respond toctrl+c
etc. indocker
. - The
-p
switch indicates that port 3000 on the container is mapped to port 12345 on the host. Without this switch, the server is inaccessible. - The
-u
switch is used so that a non-root user is used inside the container. - The
-e
switch is used to set environment variables. Alternatively use--env-file
to use a file with the environment variables. - References:
All files /test
will be run by Mocha. You can npm test
to run all tests, or you can run mocha -g specific-test-name
(prerequisite: npm install -g mocha
) to run specific tests.
The tests expect rethinkdb
to be running on localhost
on the default port (28015).
Chai is included to make the tests easier to read and write.
Notes:
- The
Syncher.synch()
is setup separately for each test file and namespaced. The reason for this is that the tests need to be able to be run independently and previousSyncher.synch()
calls from other files would otherwise conflict. - Each test file should
require('./util/conf')
to make debugging with promises easier etc.
- Make sure the tests are passing:
npm test
- Make sure the linting is passing:
npm run lint
- Bump the version number with
npm version
, in accordance with semver. Theversion
command innpm
updates bothpackage.json
and git tags, but note that it uses av
prefix on the tags (e.g.v1.2.3
). - For a bug fix / patch release, run
npm version patch
. - For a new feature release, run
npm version minor
. - For a breaking API change, run
npm version major.
- For a specific version number (e.g. 1.2.3), run
npm version 1.2.3
. - Push the release:
git push origin --tags