| Start a Windows 2008 instance from an Amazzon base windows 2008 AMI in the us-east-1 region | It needs to be in the US-East region as this is where Jira Studio expects to find the build agent. |
| Using AMI ami-d9e40db0 | |
| Turn off windows firewall or ensure you have port 22626 open | |
| Ensure jre &/or jdk installed and files from jdk that are needed are also in jre folder if you decide to use the jre as your JAVA_HOME | You will need tools.jar in your JAVA_HOME path so you will have to install the jdk to get that |
| Install whatever components you need to be able to undertake a build e.g visual studio, msbuild etc and other bits | |
| Use the link here as a guide | http://confluence.atlassian.com/display/BAMBOO/Creating+a+Custom+Elastic+Image |
| Set up the Amazon ec2 API tools as outlined in the Atlassian guide ( section 5.4) | Specific guidance for windows can be obtained from the AWS documentation |
| To check the version of bamboo click on administration then expand under system \ system information | |
| Scroll down to see the Bamboo version | |
| | |
| Download the bamboo-elastic-agent that matches the version of Bamboo that is being used in Jira Studio | http://www.atlassian.com/software/bamboo/BambooDownloadCenter.jspa Make sure you click show all. |
| Create folder c:\bamboo-elastic-agent | |
| Unzip the bamboo-elastic-agent-2.6.2.zip to folder created above | To the folder : c:\bamboo-elastic-agent |
| Add bin to path variable | c:\bamboo-elastic-agent\bin |
| Download the latest zip of ant and unzip into c:\ant\ | http://www.apache.org/dist/ant/binaries/ |
| Set up environmental and path variables | |
| Download the latest zip of maven | http://www.apache.org/dist/maven/binaries/ |
| Unzip maven into c:\ apache-maven-2.0.11 | |
| Set up environment variable and path as done for ant | |
| Summary of relevant Environment variables | ANT_HOME C:/ant EC2_CERT c:\ec2-api-tools\YOUR-cert.pem EC2_HOME c:\ec2-api-tools EC2_PRIVATE_KEY c:\ec2-api-tools\YOUR-pk.pem JAVA_HOME C:\Program Files\Java\jre6 MAVEN_HOME c:\apache-maven-2.0.11 |
| Path variables | ....... c:/ant\bin;C:\Program Files\Java\jdk1.6.0_23;c:\apache-maven-2.0.11\bin;C:\ec2-api-toolsbin;c:\bamboo-elastic-agent\bin |
| Create batch file that consists of two lines | Line 1: the Java classpath ( This was obtained by using a simple Powershell script to scrape the lib folder under bamboo-elastic-agent and setting the result as a CLASSPATH variable) Line2: This will run the actual elastic-agent |
| Note there are over a hundred jar files but to date Atlassian have been unable to let me know which ones are actually needed hence the snippet of the batch file I used rather than the full list. | SET CLASSPATH=acegi-security-1.0.4.jar;activation-1.1.1.jar;activeio-core-3.1.0.jar;activemq-core-5.2.0.jar;activemq-ra-5.2.0......... java -server -Xms32m -Xmx512m -XX:MaxPermSize=256m -classpath %CLASSPATH% com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap 2>&1 > c:\bamboo-elastic-agent\bamboo-elastic-agent.log |
| Test that everything is set up okay by running the batch file interactively. You should see output similar that opposite. The key points are it trying to get userdata and attempting to create the tunnel. The agent needs to be started by the bamboo controller hence the errors. | ......... Java.io.FileNotFoundException: http://169.254.169.254/2008-02-01/user-data at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So urce) at java.net.URL.openStream(Unknown Source) .......... oo.agent.elastic.client.ElasticAgentBootstrap 0 [main] INFO com.atlassian.bamboo.agent.elastic.client.ElasticAgentBootstrap - Using tunnnelling. Registering 'httpt' and 'httpst' protocols. 577 [com.sun.sungrid.service.tunnel.server.TunnelServer] INFO com.sun.sungrid.se rvice.tunnel.server.TunnelServer - Waiting for tunnel connection. |
| The agent needs to start automatically on starting the instance | |
| I looked at using the wrapper obtained via this url but that failed miserably | http://confluence.atlassian.com/pages/viewpage.action?pageId=91554194 |
| I used the nssm to wrap the batch file as a service | https://iain.cx/src/nssm/ |
| Set it to start automatically | |
| Create the AMI | |
| Do the bamboo controller configuration & do some basic testing | Register the AMI, Set up the capabilities , test that it will spin up the instance , test a basic build |
| | |
| | |
| | |
| | |
|
| |