Skip to content

Commit e474b4a

Browse files
authored
Merge pull request #1302 from PathwayCommons/development
3.0.1
2 parents db78ed7 + 89c097f commit e474b4a

File tree

9 files changed

+99
-64
lines changed

9 files changed

+99
-64
lines changed

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
# https://nodejs.org/en/docs/guides/nodejs-docker-webapp/
33
# https://github.com/nodejs/docker-node
44

5-
# Node.js base image
5+
# 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,18 +23,19 @@ 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

22-
# Build project
29+
# Build project
2330
RUN npm run clean
2431
RUN npm run build
2532

2633
# Expose port
2734
EXPOSE 3000
2835

29-
# Change ownership of the app to the unprivileged user
36+
# Change ownership of the app to the unprivileged user
3037
RUN chown appuser:appuser -R /home/appuser/app
31-
USER appuser
38+
USER appuser
3239

3340
# Run the command that starts the app
3441
CMD npm start

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`

docker-compose.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
version: '3'
22
services:
33
webapp:
4-
image: pathwaycommons/app-ui:development
4+
image: pathwaycommons/app-ui:master
55
container_name: appui_webapp
66
ports:
7-
- "9090:3000"
7+
- "9090:3000"
88
environment:
9-
host: "db"
10-
db:
11-
container_name: appui_db
12-
image: rethinkdb:2.3.6
13-
ports:
14-
- "8020:8080"
9+
NODE_ENV: "production"
10+
PC_URL: "http://www.pathwaycommons.org/"
11+
FACTOID_URL: "http://factoid.baderlab.org/"

src/client/common/components/error-message.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ const { Link } = require('react-router-dom');
55

66
class ErrorMessage extends React.Component {
77
render(){
8-
const logo = this.props.logo ? h(Link, { to: { pathname: `/`}, target: '_blank' }, [ h('div.pc-logo')]): null;
8+
const logo = this.props.logo
9+
? h( Link, { to: { pathname: `/`}, target: '_blank' }, [
10+
h('div.error-branding', [
11+
h('div.pc-logo'),
12+
h('div.error-branding-descriptor', [
13+
h('h2.error-subtitle', 'Pathway Commons'),
14+
h('h1.error-title', 'Search')
15+
])
16+
])
17+
])
18+
: null;
919

1020
const title = h('h1.error-message-title',
1121
this.props.title !== undefined ? this.props.title : 'An error occurred' );
@@ -21,8 +31,8 @@ class ErrorMessage extends React.Component {
2131
]);
2232

2333
return h('div.error-message-container', [
24-
logo,
2534
h('div.error-message', [
35+
logo,
2636
title,
2737
body,
2838
footer

src/client/features/enrichment/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Enrichment extends React.Component {
7777
if( networkEmpty ) {
7878
errorMessage = h(ErrorMessage, { title: 'No results to display.', body: 'Try different genes in your search.' , footer: null, logo: true } );
7979
} else if( error instanceof TimeoutError ) {
80-
errorMessage = h( ErrorMessage, { title: 'This is taking longer that we expected', body: 'Try again later.', logo: true } );
80+
errorMessage = h( ErrorMessage, { title: 'This is taking longer than expected', body: 'Try again later.', logo: true } );
8181
} else if( error ) {
8282
errorMessage = h( ErrorMessage, { logo: true } );
8383
}

src/client/features/interactions/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Interactions extends React.Component {
7777
if( networkEmpty ) {
7878
errorMessage = h(ErrorMessage, { title: 'No interactions to display.', body: 'Try different genes in your search.' , footer: null, logo: true } );
7979
} else if( error instanceof TimeoutError ) {
80-
errorMessage = h( ErrorMessage, { title: 'This is taking longer that we expected', body: 'Try again later.', logo: true } );
80+
errorMessage = h( ErrorMessage, { title: 'This is taking longer than expected', body: 'Try again later.', logo: true } );
8181
} else if( error ) {
8282
errorMessage = h( ErrorMessage, { logo: true } );
8383
}

src/client/features/search/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class Search extends React.Component {
121121
if( this.props.notFoundError ) {
122122
errorMessage = h( ErrorMessage, { title: 'We couldn\'t find the resource you are looking for', body: 'Check the location and try again.' } );
123123
} else if( this.state.error instanceof TimeoutError ) {
124-
errorMessage = h( ErrorMessage, { title: 'This is taking longer that we expected', body: 'Try again later.' } );
124+
errorMessage = h( ErrorMessage, { title: 'This is taking longer than expected', body: 'Try again later.' } );
125125
} else if( this.state.error ) {
126126
errorMessage = h( ErrorMessage );
127127
}

src/server/external-services/gprofiler/gprofiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { GPROFILER_URL } = require('../../../config');
88
const logger = require('../../logger');
99
const { cachePromise } = require('../../cache');
1010

11-
11+
const GPROFILER_GOST_URL = GPROFILER_URL + 'index.cgi';
1212
const GPROFILER_DEFAULT_OPTS = {
1313
output: 'mini',
1414
organism: 'hsapiens',
@@ -106,7 +106,7 @@ const rawEnrichment = (query, opts) => {
106106
} );
107107

108108

109-
fetch(GPROFILER_URL, { method: 'post', body: qs.stringify(gProfilerOpts)})
109+
fetch(GPROFILER_GOST_URL, { method: 'post', body: qs.stringify(gProfilerOpts)})
110110
.then( res => res.text() )
111111
.then( gprofilerRes => parseGProfilerResponse( gprofilerRes ) )
112112
.then( pathwayInfo => resolve( pathwayInfo ) )

src/styles/common/error-message.css

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,44 @@
33
justify-content: center;
44
align-items: center;
55
flex-direction: row;
6+
margin: 1.5em;
67

78
& .pc-logo {
89
background-image: url("../image/pc_logo_dark.svg");
910
background-repeat: no-repeat;
10-
height: 5em;
11-
width: 5em;
12-
padding: 0px 10px 0px 0px;
11+
height: 3em;
12+
width: 3em;
13+
padding: 0;
1314
}
1415
}
1516

17+
.error-branding {
18+
display: flex;
19+
justify-content: center;
20+
align-items: center;
21+
height: 100%;
22+
padding-right: 0.5em;
23+
margin-bottom: 1em;
24+
}
25+
26+
.error-branding-descriptor {
27+
margin-left: 0.5em;
28+
}
29+
30+
.error-title {
31+
margin: 0;
32+
line-height: 1em;
33+
color: var(--dark-base-colour);
34+
font-size: 2em;
35+
}
36+
37+
.error-subtitle {
38+
margin: 0;
39+
line-height: 1em;
40+
color: var(--dark-base-colour);
41+
font-size: 0.75em;
42+
}
43+
1644
.error-message {
1745
display: flex;
1846
justify-content: center;

0 commit comments

Comments
 (0)