Jordan Arentsen said that he would like to read about Continuous Integration. With a great pleasure!
I would like to talk about Cerberus tool and how we apply it in particular. Cerberus is a great simple tool to perform rake tasks continuously on your project whenever it updates.
I will guide you through the setup.
- First of all, make sure that your subversion client is at least at version 1.2. It will not work with earlier versions.
- Setup an email alias for notifications, something like
dev-foobar@foobar.comthat will forward any email (except spam!) to your team.
- Then, simply install Cerberus from a gem:
gem install cerberus
- Create a user for cerberus:
adduser -m cerberus,passwd cerberus
- Log in as a cerberus (or just use
sudo -H -u cerberusas a prefix)
- Assuming you have a project at
file:///var/lib/svn/foobar/foobar/trunkjust do
cerberus add file:///var/lib/svn/foobar/foobar/trunk \
APPLICATION_NAME=FooBar \
RECIPIENTS=dev-foobar@foobar.com
- Open /home/cerberus/.cerberus/config.yml and specify there such parameters:
publisher:
# active: mail jabber rss campfire irc
active: mail campfire # you may also use irc, jabber and rss,
# which we are not using at the moment
mail:
sender: cerberus@foobar.com
address: foobar.com
port: 25
domain: foobar.com
#authentication: plain
#user_name: someuser
#password: somepassword
campfire:
url: http://cerberus@foobar.com:crbrs@foobar.campfirenow.com/room/58153
# jabber:
# jid: cerberus@gtalk.google.com
# port: 5222
# password: mypass
# digest: false
# irc:
# nick: cerb
# server: irc.freenode.net
# channel: cerberus
# rss:
# file: /usr/www/rss.xml
builder:
rake:
task: db:migrate # we are also adding here 'spec spec_with_rcov ', since we use
# both RSpec and RCov
* Then, open /home/cerberus/.cerberus/config/FooBar.yml and edit it:
---
publisher:
mail:
recipients: dev-foobar@foobar.com
# specify the rest publishers per project parameters here
scm:
type: svn
url: file:///var/lib/svn/foobar/foobar/trunk
changeset_url: http://trac.foobar.com/changeset/ # If you have Trac (you should! :), integrate with it
- You can override system-wide settings (/home/cerberus/.cerberus/config.yml) with project-wide settings (/home/cerberus/.cerberus/config/FooBar.yml), (I’d suggest to pay attention to at least builder: => rake:) (consider looking at a full list)
- You can perform a test by typing
cerberus build FooBar. It will email you about project setup.
*/10 * * * * cerberus buildall
- You’re done!
Few more tips:
- If you want Cerberus to rebuild FooBar from the scratch, simply
rm -rf /home/cerberus/.cerberus/work/FooBar
- I strongly recommend to generate RCov diagram each time Cerberus runs. Here is how you can integrate RCov with RSpec:
lib/tasks/rcov.task:
require 'rake'
require 'spec/rake/spectask'
Spec::Rake::SpecTask.new('spec_with_rcov') do |t|
t.rcov = true
end
- To integrate it without RSpec, look here (not sure it is what you need exactly, however)
- Then simply symlink generated coverage directory to some web-accessible (preferably httpauth protected)
I will try to talk more on a coverage analysis later. Now it’s too late (or too early, 4:45 AM)





Thanks a lot Yurii. I’m definitely going to try this out in the future.
A quicker way to force a rebuild is to just delete /home/cerberus/.cerberus/work/FooBar/status.log. That way it won’t have to checkout everything again.
Yes, lovely thingie
Why Cerberus? Why not ZentTest? Have you tried that?
http://www.zenspider.com/ZSS/Products/ZenTest/
It has autotest as far as I can tell. Note I have not used it.. I am just getting/setting my development env. and trying to figure out whats the easiest solution on a day to day basis rather then setup..
I would like to hear your view. I don’t know wheather rcov will work with ZenTest..
Regards.
Antonio,
You could take a look at http://www.robbyonrails.com/articles/2007/01/10/the-zen-of-auto-rspec
Actually, it seems that Cerberus and autorspec seems to serve different needs. Cerberus makes you sure you haven’t broke your code in repository and autorspec helps you to monitor how your local code changes affect tests.
Thank you for the answer.. I read that post and I read your post so I was a bit confused. Now its clear. On another point I like your productive developer post.. Any more tips that you have in your bag and would like to share :=)
Thanks!
Antonio,
Yes, I’m going to post more various tips on my blog, including Rails-specific.
Stay tuned! :)
Hi, All.
First I would like to admit that Yuri have written great blog article about Cerberus.
About rebuilding:
To rebuild cerberus project you could also run build command with—force flag.
something like this
cerberus—force build MyNewCoolProject
it would run tests even sources are unchanged. It would be helpful when you change environment like installing new gems.
If you remove status.log file cerberus would think that you just setup project. (Remember that status.log contains results of previous build).
And as was mentioned before you could just remove full work directory – cerberus would automatically checkout project again. It would be helpful if you change sources in your cerberus/work directory and would like to be sure that cerberus contains clean sources.
Also take into account that if you have subversion repository on your own server it would be preferable for you to run cerberus from subversion hook. http://svnbook.red-bean.com/en/1.1/ch05s02.html#svn-ch-5-sect-2.1
Also I am very glad that people interesting in Cerberus. I made this software for myself (and my customers) because I did not find anything that would help me keep my project’s tests in a good shape. Now I see that it helps to others also.
Anatol,
Thank you for creating Cerberus! And thank you for your tip about
--force, I have missed this option for some reason.Software which is written for own needs is always pretty nice!
Check our Parabuild. The whole installation is a single command:
sudo sh parabuild_3_1_0_linux.sh -q
—AP
Anatol,
I really liked the idea of running Cerberus from subversion hook, but I found no simple way to run it asynchronously, I mean launch the Cerberus build process and don’t wait for it to finish to allow the commit.
I understand such an approach can have implication on Cerberus way to handle build, for example : what if the previous Cerberus build command is not finished when another commit occurs ? But do you think anytime we would see Cerberus fork a new process for build or run as a daemon allowing us to just tell it to build and immediately return to process the commit ?
disannuller trikeria testamentary gemmiform tumuli outmalaprop muffin unemancipable Cadron Creek Christian Curriculum http://www.magickalmayhem.com
sfgawf