Deploy geWorkbench web to production
From Informatics
This is the instruction of deploy process for geWorkbench web application to production server. First, we generate geworkbench.war file on afdev server, then manually deploy it to production.
Contents |
Pre-Requirements
1. Install maven 3.1.1 version on afdev sever(http://maven.apache.org/download.cgi)
Please follow maven installation instructions to set up related environment variable.
2. Install git for linux on afdev sever(http://git-scm.com/download/linux)
Initial Setting for Deployment Script
1. login to afdev server as "cagrid" user
2. go to home directory of "cagrid", make directories "git_src" and "db_prod_config"
3. copy persistence.xml to "db_prod_config", this file is configurated for production server. It will replace the persistence.xml from check out.
4. go to "git_src" directory, use git to check out the maven project from https://github.com/geworkbench-group/geworkbench-web
5. go to "geworkbench-web" directory, you will find deployToProd.sh
How To Build War File
Currently, the initial setting is done on afdev server. You just need:
1. login to afdev server as "cagrid" user.
2. go to "~git_src/release1_1/geworkbench-web" directory (for release 1.1). For a different release, we will create a corresponding directory.
3. run "deployToProd.sh" script to generate geworkbench.war file.
4. geworkbench.war will be generated under directory "~git_src/geworkbench-web/target".
During 2017-9-19 release, `mvn package` failed on afdev (as zji) for this error. So I did `mvn package` on Windows after the code and the config files were ready to create the war that was later deployed to production succcesfully.
[ERROR] Failed to execute goal on project geworkbench: Could not resolve dependencies for project geworkbench:geworkbench:war:1.1.0-SNAPSHOT: Failure to find com.jhlabs:imaging:jar:01012005 in http://oss.sonatype.org/content/repositories/central was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-central has elapsed or updates are forced -> [Help 1]
Deploy War To Production
0. backup
sudo as geworkbenchwb, on web1, run the script called `Z:\backup_current_deployment.1sh.sh`
#!/bin/bash # backup the current deployment of geworkbench, except the database itself, which must be dumped separately backup_path=//ifs/data/c2b2/af_lab/zji/geworkbench_production_backup/ date_string=`date +%F` fullpath=${backup_path}${date_string} mkdir -p ${fullpath} scp -r ~/tomcat-instance/webapps/geworkbench zji@afdev.c2b2.columbia.edu:${fullpath} scp ~/tomcat-instance/webapps/geworkbench.war zji@afdev.c2b2.columbia.edu:${fullpath}
The location of the backup directory is at \\isilon.c2b2.columbia.edu\c2b2_data\af_lab\zji\
Backup database from mysql3.c2b2.columbia.edu:
mysqldump -u zji -p gework_web > gework_web`date +%F`.sql
In case new tables need to be added, run the mysql script from mysql3.c2b2.columbia.edu, where the production database is. For example, for this (September 2017) release, do this
mysql -u zji -p gework_web < gwb_pbqdi_table.sql
1. login to web[12] server as geworkbenchwb steps:
ssh login.c2b2.columbia.edu ssh web1.lb # or 'ssh web2.lb' sudo -u geworkbenchwb -s -H
2. cd to ~/tomcat-instance/webapps (Note the full path is /ifs/www/vhosts/geworkbench.c2b2.columbia.edu/tomcat-instance/webapps)
3. rename geworkbench.war as geworkbench.war.bak
4. copy the war file (Note this requires the password for the user account 'cagrid' as well.)
scp cagrid@afdev.c2b2.columbia.edu://ifs/data/c2b2/af_lab/cagrid/git_src/geworkbench-web/target/geworkbench.war .
This is the command that I actually used successfully on 2017-9-19
scp zji@afdev.c2b2.columbia.edu://ifs/home/c2b2/af_lab/zji/tmp/test_geworkbench_rebuild/geworkbench-web/target/geworkbench.war ~/tomcat-instance/webapps/.
application.properties used on 2017-9-19
anova.webService.url=http://afdev.c2b2.columbia.edu:9090/axis2/services/AnovaService ttest.webService.url=http://afdev.c2b2.columbia.edu:9090/axis2/services/TTestService hierClusterService.webService.url=http://afdev.c2b2.columbia.edu:9090/axis2/services/HierClusterService aracne.clusterService.url=http://afdev.c2b2.columbia.edu:9090/aracne-server/services msviper.clusterService.url=http://afdev.c2b2.columbia.edu:9090/msviper-server/services # Soft Limit on Cytoscape Objects (nodes + edges) limit.cytoscape.objects=2000 #geWorkbench data directory. this is under the user (app owner) home directory data.directory = geworkbench #public annotation file directory. this is under the user (app owner) home directory public.annotation.directory = public_annotations #genspace switch. set to "on" to turn genspace on genspace = off #send email from this email account to users who needs to confirm registration or forgot password/username mail.smtp.auth=true mail.smtp.host=smtp.gmail.com mail.smtp.port=587 mail.smtp.starttls.enable=true from.username=geworkbenchteam from.password=geworkbench2015 # cnkb UI cnkb.interactome.excluded=aracne_blca,aracne_read cnkb.interactome.prefix.excluded=cindy_,aracne_ cnkb.multi.select=yes # size limit for hierarchical clustering hierarchical.clustering.limit = 2000 # default annotation name default.annotation=HG_U95Av2.na33.annot.csv # citrus db citrus.db.url=afdev.c2b2.columbia.edu citrus.db.database=citrus citrus.db.username=db_access citrus.db.password=Access4all release.number=1.3.0 release.date=9/19/2017 build.timestamp=${timestamp} build.version=${pom.version} #pbqdi pbdqi.service.url=http://afdev.c2b2.columbia.edu:8080/pbqdi r.path=F:/Program Files/R/R-3.3.1/bin/ pbqdi.output.path=F:/cptac_project/test1/ pbqdi.working.directory=F:/cptac_project/pbqdi/runs/ source.script.directory=F:/cptac_project/test1/ pbqdi.error.file=F:/cptac_project/test1/error.txt html.location=C:/apache-tomcat-7.0.41/webapps/ROOT/ # result.option is for testing purpose #result.option=existing
persistence.xml used on 2017-9-19
<?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="default"> <provider> org.eclipse.persistence.jpa.PersistenceProvider </provider> <class>org.geworkbenchweb.pojos.Workspace</class> <class>org.geworkbenchweb.pojos.ActiveWorkspace</class> <class>org.vaadin.appfoundation.authentication.data.User</class> <class>org.geworkbenchweb.pojos.DataSet</class> <class>org.geworkbenchweb.pojos.ResultSet</class> <class>org.geworkbenchweb.pojos.SubSet</class> <class>org.geworkbenchweb.pojos.DataHistory</class> <class>org.geworkbenchweb.pojos.ExperimentInfo</class> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="eclipselink.logging.level" value="OFF" /> <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver" /> <property name="eclipselink.jdbc.url" value="jdbc:mysql://mysql3.c2b2.columbia.edu:3306/gework_web" /> <property name="eclipselink.jdbc.user" value="geweb_su" /> <property name="eclipselink.jdbc.password" value="Wr1nkleFree#" /> <property name="eclipselink.ddl-generation" value="none" /> <property name="eclipselink.ddl-generation.output-mode" value="database" /> <property name="eclipselink.orm.throw.exceptions" value="true" /> <property name="eclipselink.target-database" value="MySQL" /> </properties> </persistence-unit> </persistence>
Start/Stop Tomcat Server
When you stop/start geworkbench, your account can not be "geworkbenchwb". You should be yourself to run the following command:
sudo /sbin/start tomcat/geworkbench.c2b2.columbia.edu
sudo /sbin/stop tomcat/geworkbench.c2b2.columbia.edu
To verify server is running, click on http://geworkbench.c2b2.columbia.edu/geworkbench/
Note: after I used the above the command to stop it, it automatically restarted. Questions: (1) does it pick up the latest war file automatically? (2) how do I stop it if necessary? In another case, after I stopped it with the same command, it didn't restart by itself. How consistent is the behavior, or did I miss some specifics?
Note: I saw "start: Job failed to start" once I ran the start command. It worked on web1, but got this on web2 (both before and after I started on web1).
Log Information
There are two places you can see the log information:
1. ~/tomcat-instance/logs (this is a directory)
2. /var/log/tomcat/geworkbench.c2b2.columbia.edu.log (this is an actual log file)
To turn on or change log level, you need to add the corresponding logger in the log4j property file. For example, if you want turn on DEBUG log for marina package, add
log4j.logger.org.geworkbenchweb.plugins.marina=DEBUG
to the end of ~/tomcat-instance/webapps/geworkbench/WEB-INF/classes/log4j.properties
. You need to restart tomcat to make the new setting take effect, but you don't have to rebuild the app.
To look at the logs:
ssh login.c2b2.columbia.edu ssh web1 # I used to do 'ssh web1.lb', it kept timing out when I tried the last time. sudo -u geworkbenchwb -s -H
Tomcat Configuration Information
Please see details (e.g. the value of JAVA_OPTS, which includes Java heap memory setting) in file
/etc/init/tomcat/geworkbench.c2b2.columbia.edu.conf