N.b. you can use public service instances for your local development to obviate local service dependencies. See below for details.
Windows Cloning
public
directory includes symlinks, which most versions of Windows Git will not correctly clone by default. Make sure to clone using the following command:git clone -c core.symlinks=true https://github.com/cytoscape/iregulon-webapp.git
Prerequisites:
nvm install 16
.nvm alias default 16
.nvm use 16.0.1
or set up a .nvmrc
file in the CWD and do nvm use
.brew install node@16
dnf
, zypper
, apt
, etc.brew install mongodb-community && brew services start mongodb-community
dnf
, zypper
, apt
, etc.Start off by running npm install
.
The main target you will run during development is npm run watch
.
Dependent services:
.env
file in the root of this project with the proper values for remote services. Do not commit the linked environment variables in public GitHub repositories.The Chrome debugger can be used for the clientside code (Chrome > View > Developer > Developer Tools) or the serverside code (npm run inspect
and go to chrome://inspect). There is also an included launch config file that allows you to debug the client or the server directly in VSC.
The following environment variables can be used to configure the server:
NODE_ENV
: the environment mode, either production
or development
(default)PORT
: the port on which the server runs (default 3000)LOG_LEVEL
: the log level for out.log
BASE_URL
: the base url of the server (e.g. https://example.com
)IREGULON_JOB_SERVICE_URL
: the full path of the iRegulon submitJob
serviceIREGULON_STATE_SERVICE_URL
: the full path of the iRegulon stateCheck
serviceIREGULON_RESULTS_SERVICE_URL
: the full path of the iRegulon results
serviceMOTIF_RANKINGS_DATABASE
: the name of the Motif Rankings databaseTRACK_RANKINGS_DATABASE
: the name of the Track Rankings databaseMONGO_URL
: the MongoDB connection URLMONGO_ROOT_NAME
: the name of the app's DB in MongoMONGO_COLLECTION_QUERIES
: the name of the query collectionSENTRY_ENVIRONMENT
: the Sentry environment name to use (automatic in prod mode, set to test*
like test_joe
to get Sentry reports in debug instances)npm start
: start the server (usually for prod mode)npm run watch
: watch mode (debug mode enabled, autorebuild, autoreload)npm run inspect
: start the server in inspection mode, with server-side code debuggable via the chrome debugger with a breakpoint automatically set on the first line (chrome://inspect)npm run build
: build projectnpm run build-prod
: build the project for productionnpm run clean
: clean the projectnpm run lint
: lint the projectnpm run fix
: fix linting errors that can be automatically addressednpm run test:mocha
: run model testsnpm test
: run model tests, linting, and a build (run this before doing a pull request)Build the container. Here, iregulon
is used as the container name.
docker build -t iregulon .
Run the container:
docker run -it -p 12345:3000 -e "NODE_ENV=production" --name "my-iregulon" iregulon
Notes:
-it
switches are necessary to make node
respond to ctrl+c
etc. in docker
.-p
switch indicates that port 3000 on the container is mapped to port 12345 on the host. Without this switch, the server is inaccessible.-u
switch is used so that a non-root user is used inside the container.-e
switch is used to set environment variables. Alternatively use --env-file
to use a file with the environment variables.All files /test
will be run by Mocha. You can npm run test:mocha
to run all tests, or you can run npm run test:mocha -- -g specific-test-name
to run specific tests.
Chai is included to make the tests easier to read and write.
By running npm test
, you will run the tests, the linting, and a test build.
npm test
npm run lint
npm version
, in accordance with semver. The version
command in npm
updates both package.json
and git tags, but note that it uses a v
prefix on the tags (e.g. v1.2.3
).npm version patch
.npm version minor
.npm version major.
npm version 1.2.3
.git push origin --tags