I have recently been asked to help a client with setting up their server environments and to figure out a development workflow so the site can be moved from dev -> staging -> live in some manner. Tired of the way I was doing things myself, I took it as an opportunity to see some of the ways developers were setting up their development workflow. In doing so, I stumbled upon some amazing articles by mig5 on his blog, most particularly about Zero-touch Drupal deployment with Jenkins, Aegir, Git, Fabric, and Drush. I have been getting something similar set up on the servers at my day job (on our dev servers to start) and the difference in working with my colleagues has been very positive (no more logging in for immediate updates, faster changes...less reliant on me being around for them to do their work). And this is all without Aegir even being part of the picture (I have to get my head wrapped around that along with some scripts and will hopefully post on that in the future). Getting back on topic, I needed to install Jenkins and Fabric to get started on the initial work (I'm still debating between Fabric and Capistrano - they both do different things but going to see which better fits the task). Doing this work for the client has been turning out to be a little more challenging that I had expected, however.
I was now out of my element and working with Red Hat Enterprise Linux (or RHEL) servers having being set up by the hosting company. For the past 4 or 5 years, I've primarily worked with the Debian / Ubuntu distribution and was used to things being relatively easy to set up (apt-get X, etc - its surprising just how much is set up right away). So let's get down to it (and what happened):
yum install java
Yay, that installed java 1.6. I don't think Jenkins requires anything more than that. Now I see that Jenkins is not a part of the yum repositories. But the Jenkins wiki has instructions. So let's follow them:
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
Wow, that was...surprisingly easy. The download showed it was on version 1.4.x so I'm feeling good! Let's start this up:
Starting Jenkins Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: /tmp/jna8547980376337168520.tmp: /tmp/jna8547980376337168520.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
... 5 more
Err... what the heck is that?!? After some cursing and research, I find out through the following command:
grep tmp /etc/fstab
That the /tmp directory (which jenkins uses) has noexec enabled meaning temp files cannot execute in there. Both good and bad - argh. I found one way that I could get around this was via the following (and this might work if you are installing some program and it is just for that purpose):
mount -o remount,exec /tmp
mount -o remount,noexec /tmp
I found a similar issue and change the JENKINS_JAVA_OPTIONS in
/etc/sysconfig/jenkins along with changing the prefix so I can access it at http://url/jenkins:
Now I try starting Jenkins - yay, it works!
On to Fabric. By default, the server came with both python2.4 and python2.6 (with 2.4 being the default). And the instructions to install fabric were...obtuse. However, upon some further reading, there were recommendations to install Fabric via PIP. This seems like a better way to approach the whole thing and easy_install actually allows it! After some trial and error, the following:
yum install python26-setuptools python26-devel
pip install pycrypto fabric
This will ensure pip gets set up with utilizing python2.6 and that packages such as fabric will specifically call on that version of Python as well. So far, seems to work quite well :) Now we're up and running with the basics!
Let's install git - bah, it is not a part of the yum repositories. Thankfully, we can use the EPEL project which will take care of all the pieces.
rpm -Uvh http://ftp.osuosl.org/pub/fedora-epel/5/i386/epel-release-5-4.noarch.rpm
yum install git
We're set up with git as well. Now the repository can finally get loaded into Jenkins.