FAQ

Why Cerberus uses an external scheduler and not internal one like CruiseControl?

Cerberus was developed as a stateless continuous building tool.

In this context it means that Cerberus won’t consume RAM all the time. For example, CruiseControl requires about 120 Megabites of RAM even if it has nothing to do. If you have a dedicated server just for running Continuous Integration tool, then probably you would not care about it. But if you like to use your development computer for building projects, then probably you would like to avoid wasting your computer’s resources like RAM and CPU cycles. In that kindof situation stateless nature of Cerberus is appropriate. Contrary to CruiseControl, Cerberus process will not be running most of the time. Every now and then Cerberus would be activated by an external scheduler (or subversion hook, or something else) to check if your sources the software repository have changed. Time to check this is usually small, so Cerberus process will not require any resources for too long.

It is a really smart and nifty technique.

How to change task(s) for Rake

Q: In my project we need to run Rails migrations before tests. But by default Cerberus runs the :default task. How could I run eg. migrations?

It is easy - just setup rake task option in config:

builder:
  rake:
    task: db:migrate test

given configuration above, rake would run first migrations and then tests. You could set task option to any other combination of Rake tasks.

How to schedule Cerberus build on nnCron

nnCron is a scheduling tool for Windows. It is a good replacement for Unix Cron on the Windows platform. nnCron has simple user interface and it is easy to add new scheduled tasks.

There is only one issue - nnCron doesn’t pass HOME environment variable to process, so you need to add it to nncron.tab file. You could add CERBERUS_HOME environment variable or HOME (in the last case CERBERUS_HOME would evaluate to HOME/.cerberus)

My nncron.tab file looks as follows:

SET CERBERUS_HOME="C:\Documents and Settings\anatol\.cerberus"

#( cerberus
AsLoggedUser
LoadProfile
Time: */15 * * * * *
Action:
SWHide   NormalPriority
START-APPW: c:\progra~1\ruby\bin\cerberus.CMD buildall
)#

Running Cerberus from Subversion post-commit hook

Subversion as well as other SCMs allow you to hook actions on commit. If you install Cerberus on the same system where you keep your Subversion repository, you could add a custom hook to run CI tool right after the user commit. In this case you don’t need to use cron or any other scheduling system.

Next follows a short guide how to do it, in fact, it is very simple.

First you need to copy SUBVERSIONREPO/hooks/post-commit.tmpl to SUBVERSIONREPO/hooks/post-commit and make it executable for user who would manage the repository. For example, on Ubuntu Linux with subversion repository served by Apache (through modsvn) hooks are run as userwww-data_ so change the ownership of post-commit to www-data:

sudo chown www-data:www-data SUBVERSION_REPO/hooks/post-commit

Remember that cerberus will run as user owning post-commit. So be careful with permissions of CERBERUS_HOME folder.

Then add the following content to SUBVERSION_REPO/hooks/post-commit:

#!/bin/sh
/usr/bin/env cerberus build YOUR_APPLICATION_NAME &

To test correctness of the hook, just run

sudo -u YOUR_USER post-commit

If you have any problems with permissions (for example CERBERUS_HOME not writable for user), the command above would tell you so.

If command finished successfully, you should have a file in CERBERUSHOME/work/YOURAPPLICATION_NAME/logs.

I would like to disable (but not remove) a project in Cerberus

Sometimes we need to temporarily disable an application and not allow cerberus buildall command to build it.

To achieve this, just rename configuration file for YOURAPPLICATION fromconfig/YOURAPPLICATION.yml to eg. config/YOUR_APPLICATION.yml.disabled

Cerberus picks up only configurations that end with .yml

Cerberus hangs on updating password-protected repository

When subversion tries to update password-protected repository, it prompts for user to enter appropriate credentials. Cerberus cannot interact with subversion client in an interactive way, making subversion to wait for password infinitely.

To solve it you need to specify username and password pair like in example below.

scm:
  type: svn
  url: svn+ssh://rubyforge.org/var/svn/cerberus
  user_name: someuser
  password: somepassword

Another and even better option would be to create a ssh key pair in repository and copy resulting private key to the same host cerberus is running and configure your ssh client to use it.

I have added Cerberus job to Cron but it does not work for me. It doesn’t even start to build.

It seems that you configured Cron incorrectly.

Let’s imagine you are trying to run Cerberus every 10 minutes. You need edit your crontab file: Type

crontab -e
And then add your job here
*/10 * * * * cerberus buildall
This task would check all projects every 10 minutes. Note that build would happend only if sources actually changed.

You also need to tell cron where to find executables like ‘cerberus’, ‘svn’, ‘darcs’, ‘rake’ and others. For this you need to add PATH environment variable at the top of the crontab file:

PATH=/opt/local/bin/
Of course path depends on your system.

This works for me. But if you get some strange errors, the following trick might help you. Add

MAILTO=your.mail.go@s.here
on the top of the crontab file and all Cron output would be directed to your mailbox.

For more info please read Cron manual:

man crontab

How to change location of Cerberus directory

By default cerberus creates its own files in user’s home directoy. But you could change it by setting the environment variable CERBERUS_HOME:

export CERBERUS\_HOME=/var/cerberus

How to add Darcs project to Cerberus

If you want to add Darcs (or other custom SCM) project to cerberus, you should explicitly tell that to cerberus.

cerberus add PROJECT_DIR SCM=darcs

Currently supported SCM systems are SVN, Darcs, Perforce and CVS.

How to be notified of all activity (including successful builds)

By default, Cerberus does not publish a notification after a successful build, unless the previous build was unsuccessful.

To always be notified of successful builds, add the following to your projects config file:

publisher:
  on_event: all