Thursday, December 5

Installing a git server on ubuntu 13.10

Now it's simpler than ever before ...

First you'll need to have a ssh key, if you don't have one generate it with

$ ssh-keygen

The defaults are fine for the test

Now install the server

$ sudo apt-get install git-core gitolite

After this a wizard will popup asking for:

  1. The git user, by default gitolite (the user that gets the code)
  2. The public ssh key for the admin, or the path to it, you can use the previously generated key located in ~/.ssh/id_rsa.pub if you left all the defaults
And that's it ... I couldn't believe it, last time took me one afternoon to install the server

Now to configure the repositories you need to clone the gitolite admin


$ git clone [user you selected on the first step of the wizard]@localhost:gitolite-admin

in my case 

$ git clone gitolite@localhost:gitolite-admin





Wednesday, December 4

Configuring Jenkins to act as continuous integration server for PHP [WIP]

First install Jenkins, fortunately it's available in Ubuntu's repositories

$ sudo apt-get install jenkins

By default jenkins runs on port 8080, so if you don't have anything in conflict with that port just pointing your browser to http://localhost:8080 will pop up your jenkins installation




Now we need something to allow Jenkins to execute the unit tests in our code, the most used is PHPUnit, also at the repositories

$ sudo apt-get install phpunit

Jenkins relies on ant to build the code, in fact it is installed as a dependency, so the next thing to do is to write an ant configuration file called build.xml at the application's root

As an example this minimal configuration based on a template found in jenkins site:





Creates a project with several targets, each target can be called using ant like

$ ant target

The main target is build, which cleans the build directory and then executes phpunit, to test it simply type

$ ant build

As you can see phpunit is being called without any parameters, so it relies on it's own xml configuration file named phpunit.xml.dist (not sure if the dist is required) but it works :D

A sample content can be



basically creates a test suite and searches for all files ending in Test.php (like ControllerTest.php) in the specified directories

The logging section allows phpunit to write code coverage metrics and junit reports that jenkins can read

The filter section prevents the execution of the classloader.php since it's our bootstrap for the unit tests

With this file ant has everything to run the build, now moving to jenkins to wrap everything up