When I first started using Jenkins (it was Hudson at the time), I would push my ColdFusion updates to various servers (e.g. staging and production) with an FTP sync ant task. It wasn’t a particularly great way to do things, but it saved a lot of time and it worked. I used this setup because I wanted to manage all of the Jenkins projects from a single Jenkins point of entry. I wanted to avoid setting up and managing Jenkins on multiple servers. I have since abandoned the FTP sync in favor of ant running on each server via a Jenkins node.
This post is geared towards ColdFusion developers because it assumes you do not need to compile your code and simply want to update your code base with changes from SCM. I will also note that Jenkins nodes are often used to distribute work load. I’m not going to cover that here. I’m simply going to explain how I setup Jenkins nodes on a Windows 2008 server. I will write-up a more detailed post about the build process we use on some projects here at Troy Web.
If you don’t already have Jenkins running somewhere, you can go get a native installer at https://jenkins-ci.org/
Setting up a Jenkins Node on Windows 2008 Server
Log into Jenkins and go to Manage Jenkins => nodes.
- Click New Node.
- Give the node a name (e.g. Production), select Dumb Slave.
- Click OK.
On the next page fill out the following:
- # of executors. This controls the number of concurrent builds the node can run.
- Remote FS root. This is the directory on your slave machine where Jenkins will install files necessary to run projects. Something like c:\Jenkins
- Usage. Accept the default of Utilize this slave as much as possible.
- Launch method. For Windows, select Launch slave agents via Java Web Start
- Availability. Accept the default of Keep this slave on-line as much as possible.
With the new node defined, log into the master Jenkins FROM the slave machine and go to Manage Jenkins => nodes. Click on your node and you will be presented with a page showing details on how to launch the node.
I haven’t had any luck with the Launch button, so I recommend running the jnlp from the command line.
Once the node has connected to the master you should see a window that indicates the slave has connected.
To install as a window service, select File => Install as Windows Service.
Assigning Projects to a Node
If you want a Jenkins project to run on your new node, go to a project configuration page and check the box next to Restrict where this project can be run. In the Label Expression field, enter the name of the node where the project should run.
Troubleshooting the Connection Between Master and Slave
You may need to set anonymous read access for users in Jenkins.
I had to open up a port in the firewall and then set the port to fixed under Manage Jenkins => Configure System => TCP port for JNLP slave agents.