5. Project Milestone 5: Details and Instructions - airavata-courses/TeamAlpha GitHub Wiki

First create a VM on Jetstream. Create VM of Ubuntu 14.04.3 - Phylogenetics image - https://use.jetstream-cloud.org/application/images/67 (this image works well, whereas we were facing issues with Ubuntu Development image)

SSH to your VM

Install apache tomcat on the VM

 sudo apt-get install openjdk-7-jdk  
 wget http://mirrors.ibiblio.org/apache/tomcat/tomcat-7/v7.0.68/bin/apache-tomcat-7.0.68.tar.gz  
 tar xvf apache-tomcat-7.0.68.tar.gz  
 rm -rf apache-tomcat-7.0.68.tar.gz  
 sudo mv apache-tomcat-7.0.68 /opt/

Deploy Jenkins

sudo wget http://mirrors.jenkins-ci.org/war-stable/latest/jenkins.war  
sudo mv jenkins.war /opt/apache-tomcat-7.0.68/webapps/  
sudo sh /opt/apache-tomcat-7.0.68/bin/startup.sh

Install git and maven on VM

sudo apt-get install git  
sudo apt-get install maven

Configure Jenkins

a) Download required plugins

Open your browser and visit http://{IP_OF_YOUR_VM}:8080/jenkins/

Click on 'Manage Jenkins' -> 'Manage Plugins' -> 'Available' tab

Install following plugins
 
 i. Github Plugin 
ii. Deploy to container Plugin

Restart Jenkins

b) Store your github credentials

Click on 'Manage Jenkins' -> 'Manage Credentials', Then select 'Add Credentials' -> 'Username and Password'. Save your github login id and password.


Create Job to auto-deploy on git commit

Click on 'New Item' -> 'Freestyle Project' name it 'Airavata' and then click Ok

Select 'git' in 'Source Code Management' section, and enter repository path and select your github credentials

Check 'Build when a change is pushed to GitHub' in Build Triggers section

In Build Section -> Click on 'Add Build Step' -> 'invoke top-level maven targets' and enter 'clean install' in Goal text field. Then Click on advanced tab, then enter 'Airavata_Remote_Job_Runner/pom.xml' in POM field

![](https://github.com/airavata-courses/TeamAlpha/raw/master/Airavata_Remote_Job_Runner/Instructions/maven build.png)

Again click on 'Add Build Step' -> select 'Execute Shell Script' & paste following content in the command field

 sudo rm -rf /opt/scripts/
 sudo mkdir /opt/scripts/
 sudo cp Airavata_Remote_Job_Runner/db/airavata_ddl_20160321.sql /opt/scripts
 sudo cp Airavata_Remote_Job_Runner/db/airavata_dml_20160321.sql /opt/scripts
 sudo cp Airavata_Remote_Job_Runner/db/db_script.sh /opt/scripts
 sudo sh /opt/scripts/db_script.sh'

![](https://github.com/airavata-courses/TeamAlpha/raw/master/Airavata_Remote_Job_Runner/Instructions/shell execution.png)

 Click on 'Add post-build action' -> Select 'Deploy war/ear to container'
 Enter 'Airavata_Remote_Job_Runner/target/Airavata_Remote_Job_Runner.war' in War file field

 Then click on 'Add Container' -> Select tomcat-7.X
 Now enter your tomcat manager username password.[tomcat manager user should have 'manager-script' role, you could add or change roles by editin tomcat-users.xml file present in your tomcat conf folder]. And enter IP of your VM as tomcat URL

![](https://github.com/airavata-courses/TeamAlpha/raw/master/Airavata_Remote_Job_Runner/Instructions/tomcat user.png)

 Click Save

Configure WebHook on github repo:

go to https://github.com/airavata-courses/TeamAlpha/settings/hooks
Click on edit Jenkins WebHook
Enter IP address of your VM instead of the one already present in the config

  Now whenever someone commits something on the git repository, application would be re-built and deployed.

  • Finally do not forget to put public key of VM machine to your karst account.

User Inputs : Below are the fields expected from users.

This fields are present in the file present at : https://github.com/airavata-courses/TeamAlpha/blob/Milestone-4/Airavata_Remote_Job_Runner/src/main/resources/user_input.properties

Property File:

private.key.path=path to the private key for which ssh is configured

private.key.passphrase=pass phrase for the key if set 

user.name=username 

user.job.file.path=path to the directory where job file is kept 

user.job.file.name=job file name 

user.job.remotefile.path=path to the directory on the server 

retry.time.interval=time interval for successive request to monitor job status(milliseconds) 

default.retry.attempts=default number of attempts (changes as per the required time provided by the server)