hudson is awesome CI(continuous integration) tool.
We want to install it on our ubuntu server to do CI for our rails projects.
Here are the steps of how to make it work:
1. ssh username@servername, to login remotely to your ubutu server.
(After you install a brandly new ubuntu on the server, you will need to sudo apt-get install openssh-server, then you can ssh it from your laptop)
2. install hudson on the ubuntu server, here is the instructions:
(the good news after you finished the installing is, hudson is already so system daemon that will be auto-started when ubuntu reboot.)
(after installed hudson and reboot ubuntu server, open a web browser, access http://serveaddress:8080/, you can see the lovely interface of hudson. Then you need to install several plugins for hudson, like ruby, rake, git etc, this can be easily done through hudson UI)
3. install ruby on the ubuntu server, run the following command
sudo apt-get install ruby
(this will install ruby 1.8.7 as default)
4. after login ubuntu server on your laptop, run this command on the terminal of your laptop to act as the hudson user auto-created by the hudson installation.
sudo -Hiu hudson
(you have to act as hudson user, because the next step is to install rvm, if you install rvm under another account, hudson account will not be able to execute rvm command.)
5. install rvm, here is the instructions:
(make sure you are using hudson account on ubuntu, by this way, the rvm will be installed under hudson directory)
(you will need to create a .bashrc file to $HOME dir, and add a this line to that file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function)
5. rvm install ruby-1.9.2
6. rvm --default ruby-1.9.2
then we are almost there!
7. How to set Hudson to use smtp.gmail.com to send emails after a build failed?
go to hudson config page
smtp server: smtp.gmail.com
smtp port: 465
8. I run into another problem when trying to check out a project.
We used "externals" feature in svn 1.6, but when I build a project for the 1st time, the code in external is not checked out.
My solution is in the config screen of the project, at the section setting svn urls, press "add" to add a location.
then fill in the svn url of the external codes,
then fill in correct local directory that the external codes should go in.
then this problem is bypassed.
9. set the build part in project:
a. select "execute shell"
b. add the following lines:
# Environment setup
# Use the correct ruby
rvm use 1.9.2@gemsetname
On linux server, we installed glpk library. then we installed rglpk gem under a gem set through RVM.
We try to use rglpk in our soft, but got this error:
libglpk.so.0: cannot open shared object file: No such file or directory - /home/username/.rvm/gems/ruby-1.9.2-p180@projectname/gems/rglpk-0.2.4/lib/glpk_wrapper.so
If we install the rglpk gem under system ruby paths, (by using
sudo gem install rglpk), rglpk will work as expected.
From the error message, we deduce the problom is rglpk can't find the
Then we checked the usr/local/lib dir, we find that file is actually there, what's wrong?
readelf -a glpk_wrapper.so
Using this command to check the content in the binary file
and comparing this file the
glpk_wrapper.so from system ruby, we find that
library path is wrong in RVM's
glpk_wrapper.so file, the library path is
glpk_wrapper.so file, the library path is
So we make a link from RVM's library path to the correct library path
usr/local/lib like this:
ln -s /usr/local/lib/libglpk.so.0 libglpk.so.0
Finally, this solved the issue, and rglpk works again!
So the reason is when we run gem install rglpk under a specific gemset under rvm, the library path indicated in glpk_wrapper.so file is wrongly configured.
It’s cool to have different gemset for each project. However, the problem is that you have to install gems, e.g. thin, bundler, etc, that shared among them again and again.
Of course, there is already good way to deal with this:
RVM provides (>= 0.1.8) a @global gemset per interpreter.
Gems that are installed to the per-interpreter @global gemset are available to all other gemsets for that interpreter.
This is a good way to allow all of your projects to share the same installed gem for a specific ruby interpreter installation.
see http://beginrescueend.com/gemsets/global/ for more details
Below shows an example about installing bundler into @global gemset:$ rvm 1.9.2@global
$ gem install bundler —no-ri —no-rdoc
$ rvm use 1.9.2@other_gemset
$ gem list
You should see bundler in other_gemset too. But not that if you switch to other ruby version, e.g. 1.8.7, you have to do it again for 1.8.7@global.