We welcome new developers to this project. To see the guidlines on how you can get started and the conventions that are used, follow this guide
Clone the repository
git clone https://github.com/bcgsc/pori_graphkb_api.git
cd pori_graphkb_api
git checkout develop
Install the dependencies
npm install
To actually use the API, the orientDB instance must already be running. To configure where the tests will point to the user can either modify config/config.js
or set the environment variables which override this config (default values are shown below, this will change depending on how you db server is configured).
GKB_DBS_PASS=root
GKB_DBS_USER=root
GKB_DB_HOST='orientdb02.bcgsc.ca'
GKB_DB_PORT=2480
GKB_KEY_FILE='id_rsa' # used in generating the tokens
After these options are configured, the full set of tests can be run
npm run test
The non-database tests can be run without the above configuration
npm run test:unit
Just the tests which require a database connection can be run with
npm run test:integration
Default configurations for all non-sensitive content can be set using the various start commands
The local test envinronment should be used for testing without authentication
npm run start:local
The dev test environment should be used for developing against the test keycloak server (can only be used within the same network as the auth server being used). This defaults connecting to the development database (backup of production)
npm run start:dev
This example deploys a tag named v1.1.0
SSH to the host server and clone the repository
ssh <SERVER NAME>
cd /var/www/app/graphkb-api
git clone https://github.com/bcgsc/pori_graphkb_api.git v1.1.0
cd v1.1.0
git checkout v1.1.0
Install the dependencies
npm install
Create the keyfile
yes | ssh-keygen -t rsa -b 4096 -f id_rsa -N ''
Create the logging directories
mkdir logs
Create an env.sh file to hold the configurable environment variables as well as the PM2 ones
export PM2_HOME=/var/www/app/graphkb_api/pm2_logs
Set the Database password (It is better not to store this)
export GKB_DBS_PASS=<some password>
Now source the file and start your pm2 process
pm2 start config/pm2.config.js --env development
You should now be able to view the running process with
pm2 ls