Skip to content

Commit 8c79ec9

Browse files
authored
Merge pull request #1300 from PathwayCommons/jvwong-iss1287_readme
Jvwong iss1287 readme
2 parents 1c549d0 + 369fb39 commit 8c79ec9

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
# Node.js base image
66
FROM node:8
77

8+
# default NODE_ENV for building the app (clientside JS etc.)
9+
ARG NODE_ENV=production
10+
11+
# default NODE_ENV for running the server
12+
ENV NODE_ENV=production
13+
814
# Create an unprivileged user w/ home directory
915
RUN groupadd appuser \
1016
&& useradd --gid appuser --shell /bin/bash --create-home appuser
@@ -17,7 +23,8 @@ WORKDIR /home/appuser/app
1723
COPY . /home/appuser/app
1824

1925
# Install app dependencies
20-
RUN npm install
26+
# Note: must be development so that dev deps are installed
27+
RUN NODE_ENV=development npm install
2128

2229
# Build project
2330
RUN npm run clean

README.md

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,52 @@
33

44
## Required software
55

6-
- [Node.js](https://nodejs.org/en/) >=6.3.0
6+
- [Node.js](https://nodejs.org/en/) >=8.11.2
77
- [RethinkDB](https://www.rethinkdb.com/) >=2.3.6
8-
- [Chromium](https://www.chromium.org/Home)
8+
99
## Running the App Locally
10-
1. Start rethinkdb by typing this command in your terminal
11-
```
12-
rethinkdb
13-
```
14-
2. Install the project dependencies by typing:
15-
```
16-
npm install
17-
```
1810

19-
3. Run the project using one of the defined package scripts:
11+
1. Install the project dependencies by typing:
12+
```
13+
npm install
14+
```
2015
21-
For development:
22-
```
23-
npm run watch
24-
```
16+
2. Run the project using one of the defined package scripts:
2517
26-
For a production build:
27-
```
28-
npm run build-prod
29-
npm run start
30-
```
18+
For development:
19+
```
20+
npm run watch
21+
```
22+
23+
For a production build:
24+
```
25+
npm run build-prod
26+
npm run start
27+
```
3128
3229
## Configuration
3330
3431
The following environment variables can be used to configure the server:
3532
36-
- `NODE_ENV` : the environment mode, either `production` or `development` (default)
37-
- `PC_URL` : root Pathway Commons URL (default: 'http://www.pathwaycommons.org/')
38-
- `FACTOID_URL` : the Factoid app URL (default: 'http://unstable.factoid.baderlab.org/')
39-
- `PORT` : the port on which the server runs (default 3000)
40-
41-
### Configure RethinkDB
42-
1. Download [RethinkDB](https://www.rethinkdb.com/docs/install/)
43-
2. Start your RethinkDB server by following the steps [here](https://www.rethinkdb.com/docs/start-a-server/)
44-
3. Go to `src/server/database/config.js` and modify the ip field to match your server address
45-
4. Start the project : `npm run start` or `npm run watch`, then the server will auto create all the required tables for you.
33+
- `NODE_ENV`: the environment mode, either `production` or `development` (default)
34+
- `PORT`: the port on which the server runs (default 3000)
35+
- `PC_URL`: root Pathway Commons URL (default: 'http://www.pathwaycommons.org/')
36+
- `NCBI_API_KEY`: NCBI E-Utilities API key ([read more](https://ncbiinsights.ncbi.nlm.nih.gov/2017/11/02/new-api-keys-for-the-e-utilities/))
37+
- `FACTOID_URL`: the Factoid app URL (default: 'http://unstable.factoid.baderlab.org/')
4638
4739
### Switching Pathway Commons Versions (release/other)
4840
4941
If Pathway Commons data and files have been updated since this app's last built and run,
5042
or you simply want to connect to a different PC2 instance (don't forget to set PC_URL),
5143
then the file `src/server/graph-generation/biopax-metadata/generic-physical-entity-map.json`
52-
needs to be updated. Also, purge the RethinkDb db tables or simply switch the database.
44+
needs to be updated.
5345
54-
The following script downloads and processes physical_entities.json.gz file from Pathway Commons:
46+
Use the script
5547
```sh
5648
cd src/scripts/generic-entity-mapping/
57-
PC_VERSION=v10 sh update.sh
49+
PC_VERSION=v11 sh update.sh
5850
```
59-
(PC_VERSION should be set to the name of a sub-directory in `www.pathwaycommons.org/archives/PC2/`)
51+
to refresh `physical_entities.json.gz` from the path `www.pathwaycommons.org/archives/PC2/<PC_VERSION>/` in Pathway Commons.
6052

6153
## Run targets
6254

@@ -69,6 +61,7 @@ PC_VERSION=v10 sh update.sh
6961
- `npm run watch` : watch mode (debug mode enabled, autorebuild, autoreload)
7062
- `npm test` : run tests
7163
- `npm run lint` : lint the project
64+
- `npm run ci` : run the tests and lint at once
7265

7366

7467
## Running via Docker
@@ -79,13 +72,13 @@ Build the container. Here, `app-ui` is used as the container name.
7972

8073
```
8174
cd app-ui
82-
docker build --build-arg "NODE_ENV=production" -t app-ui .
75+
docker build --build-arg NODE_ENV=production -t app-ui .
8376
```
8477

8578
Run the container:
8679

8780
```
88-
docker run -it -p 12345:3000 -u "node" -e "NODE_ENV=production" --name "app-ui" app-ui
81+
docker run -it --rm -p 12345:3000 -e "NODE_ENV=production" --name "app-ui" app-ui
8982
```
9083

9184
Notes:
@@ -104,13 +97,13 @@ Notes:
10497

10598
Pathway Commons maintains a [Docker Hub](https://hub.docker.com/) image for [app-ui](https://hub.docker.com/r/pathwaycommons/app-ui/) that is automatically built each time a commit is pushed to GitHub.
10699

107-
To run the GitHub development branch:
100+
To run the GitHub master branch:
108101

109102
```sh
110103
docker-compose --file docker-compose.yml up --detach
111104
```
112105

113-
Access the app instance at port `9090`.The default configuration declared in `docker-compose.yml` also runs a [rethinkdb](https://hub.docker.com/_/rethinkdb/) image; access the UI at port `8020`.
106+
Access the app instance at port `9090`.
114107

115108
Notes:
116109
- References:
@@ -119,16 +112,16 @@ Notes:
119112

120113
## Testing
121114

122-
All files `/test` will be run by [Mocha](https://mochajs.org/). 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.
115+
All files `/test` will be run by [Mocha](https://mochajs.org/). You can `npm test` to run all tests, or you can run `npm run test ./test/path/to/test` to run specific tests.
123116

124117
[Chai](http://chaijs.com/) is included to make the tests easier to read and write.
125118

126119

127-
## Devloping a feature and making a pull request
120+
## Developing a feature and making a pull request
128121

129122
Students who work on the repo should follow these instructions for each feature that they work on:
130123

131-
1. Initial prepartion (only needed once)
124+
1. Initial preparation (only needed once)
132125
1. [Make a fork on Github](https://github.com/PathwayCommons/app-ui#fork-destination-box) (if you haven't already) under your personal account
133126
1. Check out the fork repo: `git clone https://github.com/myusername/app-ui.git`
134127
1. Change the directory to the project: `cd app-ui`

0 commit comments

Comments
 (0)