Auto deploy geWorkbench web to afdev
From Informatics
This is the instruction of setting up auto deploy process for geWorkbench web application on afdev server
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)
Maven Deployment Setting
1. Add an user with administrator access right for Tomcat. To add Tomcat user, edit this file –“%TOMCAT_PATH%/conf/tomcat-users.xml“.
<tomcat-users> <role rolename="manager-gui"/> <role rolename="admin"/> <user username="username" password="password" roles="admin,manager-gui"/> </tomcat-users>
2. Add the same user authentication and profiles information in ~/apache-maven-3.1.1/conf/settings.xml.
<servers> <server> <id>TestTomcatServer</id> <username>username</username> <password>password</password> </server> </servers> <profiles> <profile> <id>env-test</id> <activation> <property> <name>env</name> <value>test</value> </property> </activation> <properties> <tomcatUrl>http://afdev.c2b2.columbia.edu:8082/manager/html</tomcatUrl> <serverName>TestTomcatServer</serverName> </properties> </profile> </profiles>
Initial Setting for Auto Deployment Script
1. login to afdev server as "cagrid" user
2. go to home directory of "cagrid", make directories "git_src" and "db_config"
3. copy persistence.xml to "db_config", this file is configurated for afdev 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 "master/geworkbench-web" directory, you will find deployToTest.sh. (If we need to test a different branch, say, release1_1, then go to a different directory "release1_1/geworkbench-web" instead.)
6. add "deployToTest.sh" to crontab and run it as daily job
Please note: you can run this script at any time as needed.
More details
The content of ~/git_src/geworkbench-web/deployToTest.sh
#!/bin/sh #$ -S /bin/sh . ~/.bash_profile cd ~/git_src/geworkbench-web git pull > ~/git_src/geworkbench-web/deployToTest.log cp ~/git_src/db_test_config/persistence.xml ~/git_src/geworkbench-web/src/main/resources/META-INF/. mv $CATALINA_HOME/webapps/geworkbench.war $CATALINA_HOME/webapps/geworkbench.war_OLD rm -r $CATALINA_HOME/webapps/geworkbench_OLD mv $CATALINA_HOME/webapps/geworkbench $CATALINA_HOME/webapps/geworkbench_OLD mvn tomcat7:deploy -Denv=test
Current environment variables:
JAVA_HOME=/ifs/data/c2b2/af_lab/cagrid/java/jdk1.6.0_29 ANT_HOME=/ifs/data/c2b2/af_lab/cagrid/caGrid1.4/apache-ant-1.7.0 GLOBUS_LOCATION=/ifs/data/c2b2/af_lab/cagrid/caGrid1.4/ws-core-4.0.3 AXIS2_HOME=/ifs/data/c2b2/af_lab/cagrid/axis2-1.6.2 CATALINA_HOME=/ifs/data/c2b2/af_lab/cagrid/apache-tomcat-7.0.30 M2_HOME=/ifs/data/c2b2/af_lab/cagrid/apache-maven-3.1.1 M2=$M2_HOME/bin