Skip to content

Commit 3ea44d4

Browse files
Merge pull request #888 from PathwayCommons/v1.0.0
V1.0.0 released!
2 parents fdbd459 + 25e7dc2 commit 3ea44d4

File tree

118 files changed

+22428
-42491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+22428
-42491
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"extends": "eslint:recommended",
1010
"parserOptions": {
11+
"ecmaVersion": 8,
1112
"ecmaFeatures": {
1213
"jsx": true
1314
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ node_modules
44
build
55
.DS_Store
66
*.log
7-
package-lock.json
87
rethinkdb_data/*
98
src/scripts/pathways/*
109
src/scripts/sbgn/*
1110
src/scripts/jsonld/*
1211
.vscode/*
12+
/.idea/
13+
/nohup.out

.travis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
dist: trusty
12
language: node_js
23
node_js:
3-
- "6"
4-
- "7"
54
- "8"
65
- "stable"
7-
sudo: false
8-
script: npm run test
6+
script: npm run test:travis
7+
sudo: required
8+
before_install:
9+
- sudo apt-get -qq update
10+
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
11+
- wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
12+
- sudo apt-get update
13+
- sudo apt-get install rethinkdb
14+
- rethinkdb &

Dockerfile

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

5-
# v6 is the latest LTS
6-
FROM node:6
5+
# Node.js base image
6+
FROM node:8
7+
8+
# Create an unprivileged user w/ home directory
9+
RUN groupadd appuser \
10+
&& useradd --gid appuser --shell /bin/bash --create-home appuser
711

812
# Create app directory
9-
RUN mkdir -p /usr/src/app
10-
WORKDIR /usr/src/app
13+
RUN mkdir -p /home/appuser/app
14+
WORKDIR /home/appuser/app
1115

1216
# Bundle app
13-
COPY . /usr/src/app
17+
COPY . /home/appuser/app
1418

1519
# Install app dependencies
1620
RUN npm install
1721

1822
# Build project
19-
# RUN npm run build
23+
RUN npm run clean
24+
RUN npm run build
2025

2126
# Expose port
2227
EXPOSE 3000
2328

29+
# Change ownership of the app to the unprivileged user
30+
RUN chown appuser:appuser -R /home/appuser/app
31+
USER appuser
32+
2433
# Run the command that starts the app
2534
CMD npm start

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# app-ui
1+
# Pathway Commons App(s)
22

33

44
## Required software
@@ -19,7 +19,7 @@ npm install
1919

2020
For development:
2121
```
22-
npm run watch
22+
npm run watch
2323
```
2424

2525
For a production build:
@@ -33,14 +33,28 @@ npm run start
3333
The following environment variables can be used to configure the server:
3434

3535
- `NODE_ENV` : the environment mode, either `production` or `development` (default)
36+
- `PC_URL` : actual Pathway Commons web service endpoint URL (default: 'http://www.pathwaycommons.org/pc2/')
3637
- `PORT` : the port on which the server runs (default 3000)
3738

3839
### Configure RethinkDB
3940
1. Download [RethinkDB](https://www.rethinkdb.com/docs/install/)
4041
2. Start your RethinkDB server by following the steps [here](https://www.rethinkdb.com/docs/start-a-server/)
4142
3. Go to `src/server/database/config.js` and modify the ip field to match your server address
42-
4. Start the project : `npm run start` or `npm run watch`, then the server will auto create all the required tables for you.
43+
4. Start the project : `npm run start` or `npm run watch`, then the server will auto create all the required tables for you.
4344

45+
### Switching Pathway Commons Versions (release/other)
46+
47+
If Pathway Commons data and files have been updated since this app's last built and run,
48+
or you simply want to connect to a different PC2 instance (and set PC_URL environment variable),
49+
then the file `src/server/graph-generation/generic-physical-entities/generic-physical-entity-map.json`
50+
needs to be updated. Also, purge the RethinkDb db tables or simply switch the database.
51+
52+
The following script downloads and processes physical_entities.json.gz file from Pathway Commons:
53+
```sh
54+
cd src/scripts/generic-entity-mapping/
55+
PC_VERSION=v10 sh update.sh
56+
```
57+
(PC_VERSION should be set to the name of a sub-directory in `www.pathwaycommons.org/archives/PC2/`)
4458

4559
## Run targets
4660

@@ -86,15 +100,15 @@ Notes:
86100

87101
### Run image hosted on Docker Hub using Docker Compose
88102

89-
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.
103+
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.
90104

91105
To run the GitHub development branch:
92106

93107
```sh
94108
docker-compose --file docker-compose.yml up --detach
95109
```
96110

97-
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`.
111+
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`.
98112

99113
Notes:
100114
- References:
@@ -145,7 +159,7 @@ Students who work on the repo should follow these instructions for each feature
145159
1. Using the console: `git checkout name-of-feature`, `git merge development`
146160
1. Using GitUp:
147161
1. Make sure your `HEAD` is the newest commit of your feature branch: Right-click the latest commit on `name-of-feature` branch and select `Checkout "name-of-feature" Branch`
148-
1. Right-click the latest commit of the `development` branch and select `Merge into Current Branch`
162+
1. Right-click the latest commit of the `development` branch and select `Merge into Current Branch`
149163
1. Push your commits to GitHub:
150164
1. Note: You can push as often as you'd like so that your code is backed up on GitHub. You *must* push everything before you make a pull request.
151165
1. Using the console: `git push`
@@ -166,3 +180,4 @@ Students who work on the repo should follow these instructions for each feature
166180
1. For a breaking API change, run `npm version major.`
167181
1. For a specific version number (e.g. 1.2.3), run `npm version 1.2.3`.
168182
1. Push the release: `git push origin --tags`
183+

ci.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# This is a helper script to set up a very simple CI dev/testing server. It can
4+
# be used with `cron` in order to set up regular builds, e.g. for every 15 minutes:
5+
#
6+
# `crontab -e`
7+
#
8+
# @reboot /home/username/rethinkdb.sh > /home/username/rethinkdb.log
9+
# */15 * * * * /home/username/master.sh > /home/username/master.log
10+
#
11+
# To use this script, create a script per server instance, e.g. `master.sh`:
12+
#
13+
# #!/bin/bash
14+
#
15+
# # Mandatory repo/branch conf
16+
# export REPO=https://github.com/PathwayCommons/factoid.git
17+
# export BRANCH=master
18+
#
19+
# # Project-specific env vars
20+
# export PORT=3000
21+
#
22+
# ./ci.sh
23+
24+
JOB_NAME=$BRANCH
25+
WORKSPACE=/home/`whoami`/$JOB_NAME
26+
WORKSPACE_TMP=/tmp/$JOB_NAME
27+
28+
rm -rf $WORKSPACE_TMP
29+
mkdir -p $WORKSPACE_TMP
30+
cd $WORKSPACE_TMP
31+
32+
# get the repo
33+
git clone $REPO $WORKSPACE_TMP
34+
git checkout $BRANCH
35+
36+
# build
37+
npm install
38+
npm run clean
39+
40+
export NODE_ENV=production
41+
42+
npm run build
43+
44+
# stop the old screen session
45+
screen -X -S $JOB_NAME quit || echo "No screen session to stop"
46+
47+
# swap out old workspace with new one
48+
mkdir -p /tmp/rm
49+
mv $WORKSPACE /tmp/rm/$JOB_NAME || echo "No old workspace to move"
50+
mv $WORKSPACE_TMP $WORKSPACE
51+
52+
# start the server in a screen session
53+
screen -d -m -S $JOB_NAME npm start
54+
55+
# delete the old workspace files
56+
rm -rf /tmp/rm/$JOB_NAME || echo "No old workspace to delete"
57+

docker-compose.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
version: '2'
1+
version: '3'
22
services:
33
webapp:
4-
image: pathwaycommons/app-ui:latest
4+
image: pathwaycommons/app-ui:development
55
container_name: appui_webapp
66
ports:
7-
- "3000:3000"
7+
- "9090:3000"
88
environment:
9-
ip: "db"
10-
links:
11-
- db
9+
host: "db"
1210
db:
1311
container_name: appui_db
1412
image: rethinkdb:2.3.6
1513
ports:
16-
- "8080:8080"
17-
- "28015:28015"
14+
- "8020:8080"

0 commit comments

Comments
 (0)