Recently I have been looking into setting up my own build server, having used Cruisecontrol, Hudson, Teamcity in the passed I wanted to give something new a try. With the recent release of Bamboo 3.1.1 I thought I would see what all the fuss is about. I logged onto Atlassian’s site and payed my 10 bucks, which much to my delight and respect, goes to charity.
I then spun up a clean Ubuntu server running 10.04.02, yes old trusty Long Term Support release, and ran through the following steps.
First install the Sun Java development kit, I use this in preference over OpenJDK at the moment for QA as it is what I normally deploy to for customers. To install this package we need to modify the
/etc/apt/sources.list and remove the comments at the start of the lines which include the partner repositories. These look as follows
deb http://archive.canonical.com/ubuntu lucid partner deb-src http://archive.canonical.com/ubuntu lucid partner
Run apt-get to update the cache of packages.
$ sudo apt-get update
Then install the dpkg for Sun\Oracle JDK.
$ sudo apt-get install sun-java-jdk
Now create a PostgreSQL user and database, note you will be prompted to enter a password for the bamboo user.
$ sudo -u postgres createuser -R -D -S -P -e bamboo $ sudo -u postgres createdb -O bamboo bamboo_db
To test this is login will work fine I use the
psql command and pass it a hostname to connect to using TCP/IP, this is to ensure our JDBC driver will connect fine.
$ psql -h localhost -U bamboo bamboo_db Password for user bamboo: psql (9.0.4) SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) Type "help" for help. bamboo_db=> \q
Install tomcat6 using apt, the reason I am using this package rather than the all in from Atlassian is I like my tomcat maintained. Dumping a tomcat in your OS with no one watching your ass is unwise in my opinion.
$ sudo apt-get install tomcat6
Rather than just popping the war file into
/var/lib/tomcat6/webapps, I prefer to externalise the application by extracting the archive into it’s own directory under
/var/lib. I then configure tomcat to load the application from this location. This is done so that I can guarantee tomcat upgrade won’t nuke or otherwise disturb my Bamboo installation.
$ sudo mkdir /usr/share/atlassian-bamboo-3.1.1 $ cd /usr/share/atlassian-bamboo-3.1.1 $ sudo jar xvf ~/atlassian-bamboo-3.1.1.war
Before we start ensure tomcat is shut down, otherwise it mite go and deploy bamboo before we are ready!
$ sudo /etc/init.d/tomcat6 stop
Next we need to configure tomcat to use load this web application, to do this we create navigate to the tomcat configuration directory.
$ cd /var/lib/tomcat6/conf/Catalina/localhost
Backup the original
ROOT.xml, being careful to preserve the permissions.
$ sudo cp -ipv ROOT.xml ROOT.bak
Edit file named
ROOT.xml as root, I will be making my bamboo the ROOT application in this tomcat, in other words served at
http://myserver.com/. Put the following content in this file. Note you also need to generate a password for your DB login and enter it where the XXXXXXXX is.
<Context path="/" docBase="/usr/share/atlassian-bamboo-3.1.1"> <Resource name="jdbc/BambooDS" auth="Container" type="javax.sql.DataSource" username="bamboo" password="XXXXXXXX" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://localhost:5432/bamboo_db" /> </Context>
ROOT.xml file only readable by the tomcat user to protect the plain text password located within.
$ sudo chmod 600 ROOT.xml
Remove the current root web application from tomcats
$ sudo rm -r /var/lib/tomcat6/webapps/ROOT
Create a data location for bamboo, and change the file permissions so that tomcat6 can write to this location.
$ sudo mkdir /var/lib/atlassian-bamboo $ sudo chown tomcat6:tomcat6 /var/lib/atlassian-bamboo
Now install the PostgreSQL driver in tomcat, to do this first download it to your home directory then copy it to
/usr/share/tomcat6/lib as follows.
$ cd ~/ $ wget http://jdbc.postgresql.org/download/postgresql-9.0-801.jdbc4.jar $ sudo cp postgresql-9.0-801.jdbc4.jar /usr/share/tomcat6/lib
/usr/share/atlassian-bamboo-3.1.1/WEB-INF/classes/log4j.properties as root, to correct the location of the log file. This in my opinion needs to be a MUST configure item during there installation process otherwise the log file could end up anywhere, for example the PWD of the executing start up script.
Navigate to the line that looks like this.
And change it to this.
Also you will need to configure the bamboo.home in
/usr/share/atlassian-bamboo-3.1.1/WEB-INF/classes/bamboo-init.properties. This should be changed to the following value. Again this will need to be done as root.
Before we start tomcat we need to increase the amount of memory available to tomcat as well as some other params. This is done by editing
Open the file as root and edit to the following line.
Change it to the following value.
JAVA_OPTS="-server -XX:MaxPermSize=256m -Djava.awt.headless=true -Xmx512m"
Now start tomcat and then tail the server log file.
$ sudo /etc/init.d/tomcat6 start $ tail -f /var/log/tomcat6/atlassian-bamboo.log
Now open your browser and to
http://servername:8080/ and follow the prompts.
When prompted for data base, select use datasource and specify the following value.
Now I have a nice new Atlassian Bamboo server ready to build my software, more on how that goes in future posts.
comments powered by Disqus