Skip to end of metadata
Go to start of metadata

If you have a FreeNAS server, you can run a virtualised Jenkins server inside a FreeNAS jail. It will start and stop with your FreeNAS server, have its own IP address, and you can mount any folder from the FreeNAS file system as the Jenkins home folder. This has the advantage of keeping the server isolated in its own virtualised sandbox, while all the Jenkins jobs and configuration data is held on the FreeNAS file system. These steps were written for the most recent version of FreeNAS at the time of this page's creation: FreeNAS 9.2.1.3.

Create a new jail for Jenkins

Log in to the FreeNAS admin console as root, or any user with enough privileges to create and configure jails. Create a new jail by navigating to Jails > Add Jails. Configure the jail settings to meet your requirements, but ensure that you change the jail type setting from the default pluginjail to portjail (the "standard" option should also work). Learn more about FreeNAS jail types here. Ensure that the Autostart and VMIMAGE and options are enabled.

Install Jenkins in the jail

Once the jail has been created, log in through the FreeNAS web admin console to install Java and Jenkins. Select the Jenkins jail you created from the Jails page and press the Shell button to open a shell as root inside the jail. Install the OpenJDK 7 with the following commands:

$ cd /usr/ports/java/openjdk7
$ make install clean BATCH=yes

When Java is installed, install Jenkins:

$ cd /usr/ports/devel/jenkins
$ make install clean BATCH=yes

Configure Jenkins

FreeNAS is built on top of FreeBSD. You can read all about how to configure Jenkins on FreeBSD at the Jenkins CI wiki page for FreeBSD.

Enable and start Jenkins

Once Jenkins is installed, you must enable it by adding the following line to /etc/rc.conf:

jenkins_enable="yes"

Start Jenkins with the following command:

$ service jenkins start

Note that if you selected the Autostart when creating the jail, Jenkins will now start automatically when FreeNAS boots.

Access Jenkins

Once installed, configured, and started, you can access Jenkins from the jail's IP address on the port and path you specified. If you used the default settings, the URL will be:

http://<HOSTNAME>:8180/jenkins

For example, if your jail has the IP address 10.0.0.10, the URL will be 10.0.0.10:8180/jenkins/.

  • No labels