Skip to content
Permalink
Browse files

Initial commit of PBrowse: A web-based platform for real-time collabo…

…rative exploration and sharing of genomic data
  • Loading branch information
andr-kun committed Apr 15, 2016
0 parents commit aac0b97cb2276b88e941fd73f33d2d1833a52c45
Showing with 66,002 additions and 0 deletions.
  1. +224 −0 AWS_setup.md
  2. +14 −0 LICENSE
  3. +98 −0 README.md
  4. +3 −0 WebContent/META-INF/MANIFEST.MF
  5. +18 −0 WebContent/WEB-INF/web.xml
  6. +354 −0 WebContent/components/CollabTests.jsp
  7. +970 −0 WebContent/components/Dialogs.jsp
  8. +1,081 −0 WebContent/components/IndexJS.jsp
  9. +968 −0 WebContent/css/bootstrap-scoped.css
  10. +6,760 −0 WebContent/css/bootstrap.css
  11. +6 −0 WebContent/css/bootstrap.min.css
  12. +6,584 −0 WebContent/css/bootstrap.original.css
  13. +56 −0 WebContent/css/dalliance-scoped.css
  14. +80 −0 WebContent/css/dalliance.css
  15. +1 −0 WebContent/css/font-awesome.min.css
  16. +1 −0 WebContent/css/jquery-ui.min.css
  17. +427 −0 WebContent/css/normalize.css
  18. +154 −0 WebContent/css/pbrowse.css
  19. +24,416 −0 WebContent/dalliance-compiled.js
  20. BIN WebContent/fonts/FontAwesome.otf
  21. BIN WebContent/fonts/fontawesome-webfont.eot
  22. +414 −0 WebContent/fonts/fontawesome-webfont.svg
  23. BIN WebContent/fonts/fontawesome-webfont.ttf
  24. BIN WebContent/fonts/fontawesome-webfont.woff
  25. BIN WebContent/fonts/glyphicons-halflings-regular.eot
  26. +288 −0 WebContent/fonts/glyphicons-halflings-regular.svg
  27. BIN WebContent/fonts/glyphicons-halflings-regular.ttf
  28. BIN WebContent/fonts/glyphicons-halflings-regular.woff
  29. BIN WebContent/fonts/glyphicons-halflings-regular.woff2
  30. +58 −0 WebContent/help/index.html
  31. +3 −0 WebContent/img/README.md
  32. BIN WebContent/img/close_pop.png
  33. BIN WebContent/img/glyphicons-halflings.png
  34. BIN WebContent/img/loader.gif
  35. BIN WebContent/img/spinner_16.gif
  36. BIN WebContent/img/spinner_192.gif
  37. BIN WebContent/img/spinner_24.gif
  38. BIN WebContent/img/spinner_32.gif
  39. BIN WebContent/img/spinner_48.gif
  40. BIN WebContent/img/spinner_96.gif
  41. +320 −0 WebContent/index.jsp
  42. +3,042 −0 WebContent/js/CollabManager.js
  43. +415 −0 WebContent/js/GenomeBrowser.js
  44. +1,084 −0 WebContent/js/HelperObjects.js
  45. +2,363 −0 WebContent/js/bootstrap.js
  46. +7 −0 WebContent/js/bootstrap.min.js
  47. +4 −0 WebContent/js/jquery-2.1.4.min.js
  48. +1 −0 WebContent/js/jquery-ui.min.js
  49. BIN WebContent/patient_reads_sorted.bam
  50. BIN WebContent/patient_reads_sorted.bam.bai
  51. +358 −0 WebContent/solotests.html
  52. +64 −0 WebContent/tester.html
  53. +103 −0 WebContent/token.jsp
  54. +7,467 −0 WebContent/worker-all.js
  55. +9 −0 email_bot_config.properties
  56. +29 −0 pbrowse.iml
  57. BIN pbrowsedb.png
  58. +122 −0 pbrowsedb.sql
  59. +78 −0 pom.xml
  60. +66 −0 src/com/backend/collab/CacheManager.java
  61. +137 −0 src/com/backend/collab/IUser.java
  62. +283 −0 src/com/backend/collab/PSession.java
  63. +101 −0 src/com/backend/collab/SendMailTLS.java
  64. +2,348 −0 src/com/backend/collab/SessionManager.java
  65. +18 −0 src/com/backend/collab/SocketServlet.java
  66. +354 −0 src/com/backend/collab/WebSocketHandler.java
  67. +635 −0 src/com/backend/filesystem/FileServlet.java
  68. +385 −0 src/com/backend/filesystem/UploadEndpoint.java
  69. +196 −0 src/com/backend/filters/GzipFilter.java
  70. +51 −0 src/com/database/mysql/Comment.java
  71. +2,251 −0 src/com/database/mysql/DBA.java
  72. +66 −0 src/com/database/mysql/DataDesc.java
  73. +155 −0 src/com/frontend/pdalliance/Pbrowse.java
  74. +70 −0 src/com/frontend/pdalliance/UtilLauncher.java
  75. +61 −0 src/com/tests/logger/ResultsLogger.java
  76. +149 −0 src/utils/offline/DataBaseBuilder.java
  77. +232 −0 src/utils/offline/RemoteDataBaseBuilder.java
@@ -0,0 +1,224 @@
# PBrowse: The Collaborative Genome Browser

This repository contains both the PBrowse web-application and the PBrowse collaborative server.

## Requirements

The server was compiled with *Java8* using *Maven* and was deployed on an *Jetty9* instance. A MySQL server was also used as the backend database software. To ensure workability, use these software packages. Java8 installation may vary depending on your OS distribution.

Installing Java8

```
sudo yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
sudo update-alternatives --config java #You will need to then enter a number corresponding to jdk8
```

Installing mysql

```
sudo yum install -y mysql-server
sudo chkconfig mysqld on
sudo service mysqld start
mysqladmin -u root password [your_new_pwd]
```

Installing maven [source](https://gist.github.com/sebsto/19b99f1fa1f32cae5d00)

```
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
```

Jetty 9 can be installed by downloading the following archive and extracting it to */opt/jetty/*:

```
wget http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.3.6.v20151106.tar.gz
tar -xzf jetty-distribution-9.3.6.v20151106.tar.gz
sudo mkdir /opt/jetty
sudo mv -r jetty-distribution-9.3.6.v20151106/* /opt/jetty/
```

Be sure to create the directory:

```
sudo mkdir /opt/pbrowse/
```

Grant read and write access to the user group which controls the webserver. User uploaded files are stored here and much functionality will be broken without this access.The PBrowse server will create any needed subdirectories as they are needed.

Create a new user for running webserver

```
sudo adduser pbrowse
sudo chown -R pbrowse:root /opt/pbrowse
sudo chown -R pbrowse:root /opt/jetty
```

The web-application was developed for the Mozilla Firefox, Chrome, and Safari browsers. IE and older browsers may have unexpected issues so use them at your own risk.

## Building

The repository should first be cloned:

```
sudo yum install -y git
git clone https://[username]@git.victorchang.edu.au/scm/holab/pbrowse.git
```

Initialise the MySQL server, as the super-user run the commands provided in the *pbrowsedb.sql* file to setup the required tables and users with either of the following commands:

```
mysql -u root -p < pbrowsedb.sql
```
OR
```
mysql> source pbrowsedb.sql
```

All further database access is made by the application through the *pbrowse* user.

Then navigate into the *pbrowse* directory. Run the command:

```
mvn clean install
```

Copy the created *.war* file from *./target/* directory to your jetty installation *webapps* directory, renaming the output *war* file to *pbrowse.war* e.g.
```
cp ./target/*.war /opt/jetty/webapps/root.war
```

## Configure Jetty SSL

The application itself can run over http, but the underlying websocket connection must be run over SSL so you have to configure the SSL connector in Jetty. If you aren't familiar with the process, see this
[guide](https://wiki.eclipse.org/Jetty/Howto/Configure_SSL#Generating_Key_Pairs_and_Certificates) to generating a self-signed SSL certificate for testing purposes.

```
keytool -genkey -keyalg RSA -alias pbrowse -keystore pbrowse.jks -validity 365 -keysize 2048
keytool -importkeystore -srckeystore pbrowse.jks -destkeystore keystore
sudo cp keystore /opt/jetty/etc
```

For production, you will need to purchase SSL from a CA (such as GeoTrust, Comodo etc). Once you have purchased, you will normally be provided with 3 files - a .key file containing your private key, a .crt file containing the certificate for your domain and another .crt file containing intermediate CA certificate (if you buy the certificate from a reseller like goDaddy and RapidSSL). The instruction below is tailored to RapidSSL specifically (Instruction taken from answer by s_t_e_v_e in [here](http://stackoverflow.com/questions/4008837/configure-ssl-on-jetty)).
```
cat your.domain.crt intermediateCA.crt > certchain.crt # combine the two certificate to one file
openssl pkcs12 -export -inkey your.privatekey.key -in certchain.crt -out jetty.pkcs12 # create a pkcs12 file (you will be asked to set up a password for pkcs12 file)
keytool -importkeystore -srckeystore jetty.pkcs12 -srcstoretype PKCS12 -destkeystore keystore (you will need to set up another password for the keystore (which will be the password used for the settings below)
```

Check to make sure that your keystore contains your certificate chains
```
keytool -list -v -keystore keystore
```

Expected output
```
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: 1
Creation date: 17/02/2016
Entry type: PrivateKeyEntry
Certificate chain length: 2
Certificate[1]:
...
Certificate[2]:
...
```

Now add the following lines into your */opt/jetty/etc/jetty-ssl-context.xml* file, updating the *KeyStorePath* path (currently set up */opt/jetty/etc*) and password fields if you have changed them:

```
<Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set>
<Set name="KeyStorePath">/opt/jetty/etc/keystore</Set>
<Set name="KeyStorePassword">pbrowse</Set>
<Set name="KeyManagerPassword">pbrowse</Set>
<Set name="TrustStorePath">/opt/jetty/etc/keystore</Set>
<Set name="TrustStorePassword">pbrowse</Set>
```

Also modify your */opt/jetty/start.ini* file and add the following two lines to the end:

```
--module=ssl
--module=https
```

## Configure email bot

You will need to create *email_bot_config.properties* under */opt/pbrowse*. The file needs to contain

```
email=[username]@gmail.com
password=password
```

Currently only gmail account is supported as the smtp settings is hardcoded to use gmail's. This can be modified on the SendMailTLS class.

## Running

Start the jetty server:

```
sudo -su pbrowse
cd /opt/jetty/
java -jar start.jar &
```

Note: & is required to run jetty in the background

and begin browsing by visiting:
```
http://localhost:8080/
```


## Enabling access to standard ports

To access pbrowse, you currently need to specify the 8080 port for http and 8443 port for https. In order to allow access using the standard http and https port (80 and 443 respectively), you need to set up iptables redirect. (Information taken from [jetty doc](http://www.eclipse.org/jetty/documentation/current/setting-port80-access.html) and [this instruction](https://gist.github.com/kentbrew/776580).)

Check that no configuration has been previously made using
```
sudo iptables -t nat -L
```

You should see the output below:
```
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
```

Now, set up the rules for http and https
```
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 8443
```

If you run the command to check the configuration again (`sudo iptables -t nat -L`), you should now see the new rules
```
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- anywhere anywhere tcp dpt:https redir ports 8443
REDIRECT tcp -- anywhere anywhere tcp dpt:http redir ports 8080
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
```
14 LICENSE
@@ -0,0 +1,14 @@
Copyright (c) 2016, Victor Chang Cardiac Research Institute

Permission to use, copy, modify, and/or distribute this software for academic
purposes without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies, and appropriate attribution of
PBrowse is made in any publication resulting from the use of PBrowse. For
commercial or other use, please contact the authors.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,98 @@
# PBrowse: A web-based platform for real-time collaborative exploration and sharing of genomic data

Authors: Peter S. Szot, Andrian Yang, Joshua Ho
Contact: j.ho@victorchang.edu.au
Copyright (c) 2016, Victor Chang Cardiac Research Institute

This repository contains both the PBrowse web-application and the PBrowse collaborative server.

## Requirements

The server was compiled with *Java8* using *Maven* and was deployed on an *Jetty9* instance. A MySQL server was also used as the backend database software. To ensure workability, use these software packages.

```
$ apt-get install mysql-server maven
```

Java8 installation may vary depending on your OS distribution. Jetty 9 can be installed by downloading the following archive and extracting it to */opt/jetty/*:

```
$ wget http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.3.6.v20151106.tar.gz
```

Be sure to create the directory:

```
$ mkdir /opt/pbrowse/
```

Grant read and write access to the user group which controls the webserver. User uploaded files are stored here and much functionality will be broken without this access.The PBrowse server will create any needed subdirectories as they are needed.

The web-application was developed for the Mozilla Firefox, Chrome, and Safari browsers. IE and older browsers may have unexpected issues so use them at your own risk.

## Building

The repository should first be cloned:

```
$ git clone https://petszo@git.victorchang.edu.au/scm/holab/pbrowse.git
```

Initialise the MySQL server, as the super-user run the commands provided in the *pbrowsedb.sql* file to setup the required tables and users with either of the following commands:

```
$ mysql < pbrowsedb.sql
```
OR
```
mysql> source pbrowsedb.sql
```

All further database access is made by the application through the *pbrowse* user.

Then navigate into the *pbrowse* directory. Run the command:

```
$ mvn clean install
```

Copy the created *.war* file from *./target/* directory to your jetty installation *webapps* directory, renaming the output *war* file to *pbrowse.war* e.g.
```
$ cp ./target/*.war /opt/jetty/webapps/root.war
```

## Configure Jetty SSL

The application itself can run over http, but the underlying websocket connection must be run over SSL so you have to configure the SSL conector in Jetty. If you aren't familiar with the process, see this
[guide](http://examples.javacodegeeks.com/enterprise-java/jetty/jetty-ssl-configuration-example/) to generating a self-signed SSL certificate for testing purposes. Now add the following lines into
your */opt/jetty/etc/jetty-ssl-context.xml* file, updating the *KeyStorePath* path and password fields if you have changed them:

```
<Set name="useCipherSuitesOrder"><Property name="jetty.sslContext.useCipherSuitesOrder" default="true"/></Set>
<Set name="KeyStorePath">/opt/pbrowse/.keystore</Set>
<Set name="KeyStorePassword">pbrowse</Set>
<Set name="KeyManagerPassword">pbrowse</Set>
<Set name="TrustStorePath">/opt/pbrowse/.keystore</Set>
<Set name="TrustStorePassword">pbrowse</Set>
```

Also modify your */opt/jetty/start.ini* file and add the following two lines to the end:

```
--module=ssl
--module=https
```

## Running

Start the jetty server:

```
$ cd /opt/jetty/
$ java -jar start.jar
```

and begin browsing by visiting:
```
http://localhost:8080/
```
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>pbrowse</display-name>
<security-constraint>
<web-resource-collection>
<web-resource-name>pbrowse</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
</security-constraint>
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>com.backend.filters.GzipFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>

0 comments on commit aac0b97

Please sign in to comment.
You can’t perform that action at this time.