2008-08-24 10:25:05 -04:00
|
|
|
# Rails Continuous Integration Server Setup Notes
|
|
|
|
# This procedure was used to set up http://ci.rubyonrails.org on Ubuntu 8.04
|
|
|
|
# It can be used as a guideline for setting up your own CI server against your local rails branches
|
|
|
|
|
|
|
|
* Set up ci user:
|
|
|
|
# log in as root
|
|
|
|
$ adduser ci
|
|
|
|
enter user info and password
|
|
|
|
$ visudo
|
|
|
|
# give ci user same sudo rights as root
|
|
|
|
|
|
|
|
* Disable root login:
|
|
|
|
# log in as ci
|
|
|
|
$ sudo vi /etc/shadow
|
|
|
|
# overwrite and disable encrypted root password to disable root login:
|
|
|
|
root:*:14001:0:99999:7:::
|
|
|
|
|
|
|
|
* Change Hostname:
|
|
|
|
$ sudo vi /etc/hostname
|
2009-08-16 22:05:45 -04:00
|
|
|
change to correct hostname
|
2008-08-24 10:25:05 -04:00
|
|
|
$ sudo vi /etc/hosts
|
2009-08-16 22:05:45 -04:00
|
|
|
replace old hostname with the correct hostname
|
2008-08-24 10:25:05 -04:00
|
|
|
# reboot to use new hostname (and test reboot)
|
|
|
|
$ sudo shutdown -r now
|
|
|
|
|
|
|
|
* Update aptitude:
|
|
|
|
$ sudo aptitude update
|
|
|
|
|
2010-08-14 01:13:00 -04:00
|
|
|
* Use cinabox to perform rest of ruby/ccrb setup:
|
2011-03-06 16:18:32 -05:00
|
|
|
* https://github.com/thewoolleyman/cinabox/tree/master/README.txt
|
2008-08-24 10:25:05 -04:00
|
|
|
|
|
|
|
# This is not yet properly supported by RubyGems...
|
|
|
|
# * Configure RubyGems to not require root access for gem installation
|
|
|
|
# $ vi ~/.profile
|
|
|
|
# # add this line at bottom:
|
|
|
|
# PATH="$HOME/.gem/ruby/1.8/bin:$PATH"
|
|
|
|
# $ sudo vi /etc/init.d/cruise
|
|
|
|
# # edit the start_cruise line to source CRUISE_USER/.profile:
|
|
|
|
# start_cruise "cd #{CRUISE_HOME} && source /home/#{CRUISE_USER}/.profile && ./cruise start -d"
|
|
|
|
# $ vi ~/.gemrc
|
|
|
|
# # add these lines:
|
|
|
|
# ---
|
|
|
|
# gemhome: /home/ci/.gem/ruby/1.8
|
2010-08-14 01:13:00 -04:00
|
|
|
# gempath:
|
2008-08-24 10:25:05 -04:00
|
|
|
# - /home/ci/.gem/ruby/1.8
|
|
|
|
|
|
|
|
* If you did not configure no-root-gem installation via ~/.gemrc as shown above, then allow no-password sudo for gem installation:
|
|
|
|
$ sudo visudo
|
|
|
|
# add this line to bottom:
|
2009-05-19 06:50:26 -04:00
|
|
|
ci ALL=(ALL) NOPASSWD: ALL
|
2008-08-24 10:25:05 -04:00
|
|
|
|
|
|
|
* Start ccrb via init script and check for default homepage at port 3333
|
|
|
|
|
|
|
|
* Install/setup nginx:
|
|
|
|
$ sudo aptitude install nginx
|
|
|
|
$ sudo vi /etc/nginx/sites-available/default
|
2009-04-21 12:31:07 -04:00
|
|
|
# Add the following entry at the top of the file above the 'server {' line:
|
|
|
|
upstream mongrel {
|
|
|
|
server 127.0.0.1:3333;
|
|
|
|
}
|
|
|
|
|
2009-01-06 22:42:53 -05:00
|
|
|
# Change server_name entry to match server name
|
|
|
|
|
2009-04-21 12:31:07 -04:00
|
|
|
# replace the contents of the root 'location / {}' block with the following entries:
|
|
|
|
proxy_pass http://mongrel;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_set_header X-Client-Verify SUCCESS;
|
|
|
|
proxy_read_timeout 65;
|
2009-01-06 22:42:53 -05:00
|
|
|
|
|
|
|
# also comment default locations for /doc and /images
|
2008-08-24 10:25:05 -04:00
|
|
|
$ sudo /etc/init.d/nginx start
|
|
|
|
|
|
|
|
* Add project to cruise (It will still fail until everything is set up):
|
|
|
|
$ cd ~/ccrb
|
|
|
|
$ ./cruise add rails -s git -r git://github.com/rails/rails.git # or the URI of your branch
|
|
|
|
|
|
|
|
* Copy and configure cruise site config file:
|
|
|
|
$ cp ~/.cruise/projects/rails/work/ci/site_config.rb ~/.cruise/site_config.rb
|
|
|
|
# Edit ~/.cruise/site_config.rb as desired, for example:
|
|
|
|
ActionMailer::Base.smtp_settings = {
|
|
|
|
:address => "localhost",
|
|
|
|
:domain => "ci.yourdomain.com",
|
|
|
|
}
|
|
|
|
Configuration.dashboard_refresh_interval = 60.seconds
|
|
|
|
Configuration.dashboard_url = 'http://ci.yourdomain.com/'
|
|
|
|
Configuration.serialize_builds = true
|
|
|
|
Configuration.serialized_build_timeout = 1.hours
|
|
|
|
BuildReaper.number_of_builds_to_keep = 100
|
2010-08-14 01:13:00 -04:00
|
|
|
|
2008-08-24 10:25:05 -04:00
|
|
|
* Copy and configure cruise project config file
|
|
|
|
$ cp ~/.cruise/projects/rails/work/ci/cruise_config.rb ~/.cruise/projects/rails
|
|
|
|
$ vi ~/.cruise/projects/rails/cruise_config.rb:
|
|
|
|
# Edit ~/.cruise/projects/rails/cruise_config.rb as desired, for example:
|
|
|
|
Project.configure do |project|
|
|
|
|
project.build_command = 'ruby ci/ci_build.rb'
|
|
|
|
project.email_notifier.emails = ['recipient@yourdomain.com']
|
|
|
|
project.email_notifier.from = 'sender@yourdomain.com'
|
|
|
|
end
|
|
|
|
|
|
|
|
* Set up mysql
|
|
|
|
$ sudo aptitude install mysql-server-5.0 libmysqlclient-dev
|
|
|
|
# no password for mysql root user
|
|
|
|
|
2009-08-19 07:35:34 -04:00
|
|
|
* setup sqlite 3
|
|
|
|
$ sudo aptitude install sqlite3 libsqlite3-dev
|
2008-08-24 10:25:05 -04:00
|
|
|
# Note: there's some installation bugs with sqlite3-ruby 1.2.2 gem file permissions:
|
|
|
|
# http://www.icoretech.org/2008/07/06/no-such-file-to-load-sqlite3-database
|
|
|
|
# cd /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.2 && sudo find . -perm 0662 -exec chmod 664 {} \;
|
|
|
|
|
|
|
|
* setup postgres
|
|
|
|
$ sudo aptitude install postgresql postgresql-server-dev-8.3
|
|
|
|
$ sudo su - postgres -c 'createuser -s ci'
|
|
|
|
|
2009-01-06 22:42:53 -05:00
|
|
|
* Install fcgi libraries
|
|
|
|
$ sudo apt-get install libfcgi-dev
|
|
|
|
|
|
|
|
* Install memcached and start for first time (should start on reboot automatically)
|
|
|
|
$ sudo aptitude install memcached
|
|
|
|
$ sudo /etc/init.d/memcached start
|
|
|
|
|
2008-08-24 10:25:05 -04:00
|
|
|
* Install and run GemInstaller to get all dependency gems
|
|
|
|
$ sudo gem install geminstaller
|
|
|
|
$ cd ~/.cruise/projects/rails/work
|
|
|
|
$ sudo geminstaller --config=ci/geminstaller.yml # turn up debugging with these options: --geminstaller-output=all --rubygems-output=all
|
|
|
|
|
|
|
|
* Create ActiveRecord test databases for mysql
|
|
|
|
$ mysql -uroot -e 'grant all on *.* to rails@localhost;'
|
|
|
|
$ mysql -urails -e 'create database activerecord_unittest;'
|
|
|
|
$ mysql -urails -e 'create database activerecord_unittest2;'
|
|
|
|
|
|
|
|
* Create ActiveRecord test databases for postgres
|
|
|
|
# cd to rails activerecord dir
|
|
|
|
$ rake postgresql:build_databases
|
|
|
|
|
|
|
|
* Reboot and make sure everything is working
|
|
|
|
$ sudo shutdown -r now
|
2011-03-06 16:18:32 -05:00
|
|
|
$ http://ci.yourdomain.com
|