forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ci_setup_notes.txt
131 lines (108 loc) · 4.7 KB
/
ci_setup_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# 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
change to 'ci'
$ sudo vi /etc/hosts
replace old hostname with 'ci'
# reboot to use new hostname (and test reboot)
$ sudo shutdown -r now
* Update aptitude:
$ sudo aptitude update
* Use cinabox to perform rest of ruby/ccrb setup:
* http://github.com/thewoolleyman/cinabox/tree/master/README.txt
# 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
# gempath:
# - /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:
ci ALL=NOPASSWD: /usr/local/bin/geminstaller, /usr/local/bin/ruby, /usr/local/bin/gem
* 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
# Change server_name entry to match server name
# comment two lines and add one to proxy to ccrb:
# root /var/www/nginx-default;
# index index.html index.htm;
proxy_pass http://127.0.0.1:3333;
# also comment default locations for /doc and /images
$ 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
* 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 = ['[email protected]']
project.email_notifier.from = '[email protected]'
end
* Set up mysql
$ sudo aptitude install mysql-server-5.0 libmysqlclient-dev
# no password for mysql root user
* setup sqlite
$ sudo aptitude install sqlite sqlite3 libsqlite-dev libsqlite3-dev
# 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'
* 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
* 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
$ http://ci.yourdomain.com