Rails3Tasks » History » Version 10
Chris Cannam, 2013-01-07 04:04 PM
1 | 1 | Chris Cannam | h1. Moving to Rails 3 |
---|---|---|---|
2 | 1 | Chris Cannam | |
3 | 1 | Chris Cannam | h2. Test environment |
4 | 1 | Chris Cannam | |
5 | 1 | Chris Cannam | We have a Redmine 2.2 pristine branch (redmine-2.2) and an integration branch (redmine-2.2-integration) in which to fix errors arising from merging our own changes back in to Redmine 2.2. |
6 | 1 | Chris Cannam | |
7 | 1 | Chris Cannam | For Rails 2, we have been using Ruby Enterprise Edition v1.8.7 with Phusion Passenger v3.0.1. |
8 | 1 | Chris Cannam | |
9 | 1 | Chris Cannam | For Rails 3 we want to use a more mainstream Ruby v1.9.3, with Phusion Passenger v3.0.18. |
10 | 2 | Chris Cannam | |
11 | 2 | Chris Cannam | Ubuntu 10.04 LTS only has Ruby 1.9.1, so we use the Brightbox packages. |
12 | 2 | Chris Cannam | |
13 | 2 | Chris Cannam | <pre> |
14 | 2 | Chris Cannam | $ sudo apt-add-repository ppa:brightbox/ruby-ng |
15 | 2 | Chris Cannam | $ sudo apt-get update |
16 | 2 | Chris Cannam | $ sudo apt-get install ruby1.9.3 |
17 | 2 | Chris Cannam | $ sudo gem1.9.3 install rails |
18 | 2 | Chris Cannam | $ sudo gem1.9.3 install passenger |
19 | 2 | Chris Cannam | $ sudo apt-get install libcurl4-openssl-dev |
20 | 2 | Chris Cannam | $ sudo passenger-install-apache2-module |
21 | 2 | Chris Cannam | </pre> |
22 | 3 | Chris Cannam | |
23 | 3 | Chris Cannam | The Passenger installer prints out: |
24 | 3 | Chris Cannam | |
25 | 3 | Chris Cannam | <pre> |
26 | 3 | Chris Cannam | Please edit your Apache configuration file, and add these lines: |
27 | 3 | Chris Cannam | |
28 | 3 | Chris Cannam | LoadModule passenger_module /var/lib/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so |
29 | 3 | Chris Cannam | PassengerRoot /var/lib/gems/1.9.1/gems/passenger-3.0.18 |
30 | 3 | Chris Cannam | PassengerRuby /usr/bin/ruby1.9.1 |
31 | 3 | Chris Cannam | </pre> |
32 | 3 | Chris Cannam | |
33 | 3 | Chris Cannam | (Note that the Brightbox PPA "Ruby 1.9.1" is in fact 1.9.3, unlike the Ubuntu repo package which is 1.9.1 -- confusing) |
34 | 4 | Chris Cannam | |
35 | 5 | Chris Cannam | Although the different versions of Ruby and Rails can coexist, the Passenger Apache module can be loaded once per Apache instance only, so introducing the new version will supersede entirely the old one. The Rails version is specified in each application config, but they will all get the same Ruby version. |
36 | 6 | Chris Cannam | |
37 | 6 | Chris Cannam | So, we make the above change (in @mods-available/passenger.load@) and the existing sites break with "Ruby on Rails version '2.3.14' not found" -- fair enough, it isn't installed for the new version of Ruby. Rather than fix this, let's keep the situation simpler to understand by blundering into the world of Rails 3 only. |
38 | 7 | Chris Cannam | |
39 | 8 | Chris Cannam | I'm also going to remove /usr/local/bin (i.e. REE) from the PATH: |
40 | 8 | Chris Cannam | |
41 | 8 | Chris Cannam | <pre>$ echo $PATH |
42 | 8 | Chris Cannam | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games |
43 | 8 | Chris Cannam | $ PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games |
44 | 8 | Chris Cannam | </pre> |
45 | 8 | Chris Cannam | |
46 | 9 | Chris Cannam | (@/usr/games@ ??) |
47 | 8 | Chris Cannam | |
48 | 10 | Chris Cannam | Now, to the web instance and @hg pull -u; hg update redmine-2.2-integration@. Then |
49 | 10 | Chris Cannam | |
50 | 10 | Chris Cannam | <pre> |
51 | 10 | Chris Cannam | $ RAILS_ENV=development rake1.9.3 db:migrate |
52 | 10 | Chris Cannam | Could not find gem 'mocha (= 0.12.3) ruby' in the gems available on this machine. |
53 | 10 | Chris Cannam | $ sudo gem1.9.3 install mocha -v0.12.3 |
54 | 10 | Chris Cannam | $ sudo gem1.9.3 install rmagick |
55 | 10 | Chris Cannam | $ sudo gem1.9.3 install jquery-rails -v2.0.2 |
56 | 10 | Chris Cannam | </pre> |