redmine
Upgrading Redmine from 0.9.x to 1.3.x
Today i was asked by a client to upgrade his Redmine setup from version 0.9.3 to the latest stable version. As his server is running Ubuntu 10.04 LTS and he installed Redmine using the Ubuntu repositories, this wasn’t the easiest or smoothest task i’ve ever done.
I suspected that upgrading from 0.9.3 directly to 1.3-stable would be a nightmare, so i was planning on upgrading to 1.0-stable, then to 1.1-stable, then 1.2-stable and finally 1.3-stable.
All looked well, and i started taking backups. Of course, the whole Redmine installation was setup using the Ubuntu repositories, so clearly, all of the ruby, rails, rake and rubygems packages were from Ubuntu 10.04. Which would cause a bit of a problem, as i needed newer versions of certain packages. So i ran the following commands (after taking backups of course.) to remove redmine and all it’s dependencies and reinstall whatever is necessary to run rubygems, rake and libapache2-mod-passenger.
1 2 |
aptitude remove redmine aptitude install rubygems rake libapache2-mod-passenger |
This made sure i had a basic setup. After that i used svn to get all the versions
1 2 3 4 |
svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0 svn co http://redmine.rubyforge.org/svn/branches/1.1-stable redmine-1.1 svn co http://redmine.rubyforge.org/svn/branches/1.2-stable redmine-1.2 svn co http://redmine.rubyforge.org/svn/branches/1.3-stable redmine-1.3 |
This gave me the opportunity to just go into the appropriate directory, follow the guide on Redmine.org on how to upgrade and do that for each major release. On occasion rake would throw me an exception stating i needed a gem installed or a newer version installed, but overall that wasn’t a real problem. Just make sure you run
1 |
gem install -v=<correct version> <gemname> |
This all went good until i got to the point of upgrading to 1.3. Apparently version 1.3 needs a later release off rubygems. Whenever i tried running rake to do the db migration, i ended up getting the following error:
1 2 |
rake aborted! super: no superclass method `requirement' for <rails::gemdependency:0x7f9e87ea7a18>; |
This is a little problematic as the Ubuntu 10.04 LTS repository does not allow for a newer version to be installed from it. My solution was to just get the package from a newer distribution using a backport available thanks to a Ubuntu PPA from Mackenzie Morgan (Thanks!):
1 2 3 |
add-apt-repository ppa:maco.m/ruby aptitude update aptitude install rubygems |
This installs a version which can be used by Redmine 1.3-stable. After that, everything looked great, i could log in, i checked the configuration and it worked!
Or i thought… Whenever i opened the issues list of the project, i would get a Server error (500), the log reflected this:
1 2 3 4 5 6 7 8 |
ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #28 of app/views/issues/_list.html.erb: 25: 26: < % previous_group = group %> 27: < % end %> 28: <tr id="issue-<%= issue.id %>" class="hascontextmenu < %= cycle('odd', 'even') %> < %= issue.css_classes %> < %= level > 0 ? "idnt idnt-#{level}" : nil %>"> 29: <td class="checkbox hide-when-print">< %= check_box_tag("ids[]", issue.id, false, :id => nil) %></td> 30: <td class="id">< %= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td> 31: < % query.columns.each do |column| %>< %= content_tag 'td', column_content(column, issue), :class => column.css_classes %>< % end %> |
Googling the error returned me to a bug report from version 1.0, which presented me with a simple solution, i just had to run a simple query on the database:
1 |
update issues set parent_id = NULL, root_id = id, lft = 1, rgt = 2; |