Posted on

Upgrading Redmine From 0.9.6 to 1.0.0

Much of this post is repeated in the Upgrading Redmine from 0.8 to 0.9.3 post we did a few months back.  Now with Redmine 1.0 RC out, the upgrade process is once again not as simple as doing a subversion update.  If you are downloading tarzips and installing “manually”, we recommend saving some time and learning basic subversion commands.  Subversion checkout and update is much faster and easier once you have the initial installation in place.

These are Cyber Sprocket’s notes from our upgrade. For more information you may want to visit the official documentation site.

Our Environment

The environment we were running before upgrading to Redmine 1.0(RC):

  • Redmine 0.9.6
  • Apache 2.2.7
  • MySQL 4.1.22*

* Note – we have had discussions with the Redmine development team regarding the MySQL version.  We are running MOST features with no problem on MySQL 4.1, however custom fields on the issue table that are anything but character type will break many reporting and sorting features.   According to some of the developers MySQL 5.X has been required since Redmine 0.8.X.   In reality Redmine works for MOST features on MySQL 4.1.22 though you will need to patch around some things if you want to use custom int fields in Redmine.  There are no guarantees as to what other things will creep into Redmine.     Also, it should be noted that on the official Redmine documentation site it states MySQL 4 is acceptable, even though there is some MySQL 5 only code buried deep within Redmine.

Preparation

The first thing we ALWAYS do before upgrading a system is to store a local copy of the database and the source code. In order to make the archives as small as possible we post a note on the system that Redmine will be offline and at the posted time remove all the session “crud” that has built up. The process includes a mysql data dump, a file removal, and a tarzip.

  • Go to the directory ABOVE the redmine root directory:
    cd /<redmine-root-dir>; cd ..;
  • Dump MySQL Redmine data:
    mysqldump –user=<your-redmine-db-username> -p <your-redmine-databasename> > redmine_backup.sql

    Note: getting an error doing the dump because of LOCK TABLES?   You can add the –lock-tables=false option to your dump command, but be 100% certain nobody else is going to be on your Redmine system when you do this or you will lose data.

  • Remove the session files:
    rm -rf <redmine-directory>/tmp/sessions/*
  • Tarzip:
    tar cvfz redmine-backup.tgz redmine_backup.sql ./<redmine-directory-name>

Setting Up 1.0

The instructions here are based on our installation where the live Redmine site is accessed via Apache and lives (according to apache) in a directory named redmine.

Setting Up Redmine 1.0 Summary

Go to the parent directory ABOVE the one where your current redmine install exists.  The process here is to pull down the new Redmine code, move the old system to an “offline” location, copy over the old version config files, symlink the old directory to the new name, then restart Apache.

cd <redmine parent directory>

# Get the 1.0 Redmine Code
svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0

# Copy the old config info
cd redmine-1.0/config
cp ../<old_redmine_version_directory>/config/database.yml .

# Upgrade the database

rake db:migrate RAILS_ENV=production

# Upgrade the data structures

cd ..

rake db:migrate RAILS_ENV=production

# Initialize the session store on the new redmine
rake config/initializers/session_store.rb

# Move the old directory

cd ..

rm -f redmine (this was a symlink to redmine-0.9.6)
# Hook up the new redmine

ln -s ./redmine-1.0 redmine
# Restart Apache

service httpd restart

Checking Logs

If you have problems check the log files in your Redmine installation directory, such as ./log/production.log. You may also want to check your Apache log files, assuming you’ve set those up. To log Apache messages you need to have an ErrorLog statement in your httpd.conf file that tells Apache where you want your log file written (normally /usr/local/apache/logs/redmine-error.log).

Our Customization

Once we got the basic 1.0 install in place we had to bring over our custom page headings and other tweaks.  Be sure to leave your old install available in an easily accessible place in case you need to do the same.  Some of the tweaks we need to do on our end:

  • copy over the public/.htaccess file
  • set our default environment to production in ./config/environment.rb
  • copy over the vendor/plugins/redmine-google-analytics-plugin/ plugin
  • copy over the vendor/plugins/redmine_my_menus plugin
  • copy over the public/themes/cyber1 theme
  • update ./config/locales/en.yml to change some menu wording
  • make these patches to get int custom fields working in 0.9X and higher
    • ./app/models/query.rb
    • ./app/models/custom_field.rb

Need Help With Redmine?

If you need help with your upgrade, give us a call.