Jenkins automates builds and tests. This post describes setting up Jenkins for the Play 2 Framework.
First off, you need a machine with a good amount of resources. I tried first on a small cloud machine with 2GB of RAM and it was not sufficient, so get a machine with 4GB of RAM.
Next you need to install Java and SBT. Also, git if you use it for source control.
sudo apt-get install openjdk-7-jdk git wget http://repo.scala-sbt.org/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.13.0/sbt.deb sudo dpkg -i sbt
Now that you have Java installed, you can install Jenkins:
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
To be able to have Jenkins check the source code out of GitHub or BitBucket, you need to setup an SSH deploy key. First create an SSH key:
sudo su jenkins ssh-keygen -t rsa $ cat /var/lib/jenkins/.ssh/id_rsa.pub
Copy the key into GitHub/BitBucket as a deploy key.
Accept the remote host as a machine to trust connections to:
ls-remote -h git@host:org/repo.git HEAD
Now go to the Jenkins web UI. First, Install Jenkins GIT plugin and Jenkins sbt plugin.
Then, setup the system configuration under “Manage” > “Configure System”. Point the sbt plugin to the launcher jar we installed earlier at
/usr/share/sbt/bin/sbt-launch.jar. Also set the “System Admin e-mail address” under “Jenkins Location”, which will be the email address you will receive alerts from. Finally, setup the SMTP host, username, and password under “E-mail Notification”.
At this point, you can create a “New Job” selecting “Build a free-style software project”. Enter your git repo location, how often to build, and set it to build with sbt. Enjoy!