I use Redmine to manage all of my project source code. It is very useful for version control, issue tracking and general project management. I highly recommend it to both individual developers and teams of developers. Recently, I upgraded from version 0.9.3 to version 1.1.2 so that I could  take advantage of several new features – specifically, the new API. Documented below is steps I took and issues I encountered.
First things first: MAKE A BACKUP. This is very important if you encounter issues. It also was very helpful in troubleshooting the issues I encountered. My install uses MySQL, so that is how this tutorial will proceed. I am backing up the entire Redmine root. The reason I am doing this is because I am moving from installing the snapshot that Redmine provided for 0.9.3 to installing from the Redmine repository. This will make upgrades in the future easier, as I’ll just have to issue an update command from SVN, instead of manually installing the entire package.

/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
mv -Rp <redmine_root> <backup_path>

Now, we are going to install Redmine Version 1.1.2 (latest stable as of this writing). This is revision 5032. This will take a few minutes to download.

cd <redmine_root_parent_path>
svn co -r 5032 http://redmine.rubyforge.org/svn/trunk <redmine_root>

We are going to set permissions on this new install and then restore a couple configuration settings from the backup. Do NOT overwrite the entire ‘config’ directory. We are only bringing in specific files.

chown -R <redmineUser>:<redmineGroup> <redmine_root>
cp -p <backup_path>/config/database.yml <redmine_root>/config/database.yml
cp -p <backup_path>/config/email.yml <redmine_root>/config/email.yml
cp -rp <backup_path>/files <redmine_root>

Now we are going to update our rails and rake gems to be the required version for Redmine 1.1.2. This will take a few minutes

gem install rails -v=2.3.11
gem install rack -v=1.1.0

Finally, we are ready to perform the actual update to Remine’s database.

rake generate_session_store
rake db:migrate RAILS_ENV=production
rake db:migrate_plugins RAILS_ENV=production
rake tmp:cache:clear
rake tmp:sessions:clear

NOTE: I encountered a problem with a missing gem during this block. It was solved by running this command and then rerunning the block above:

gem install -v=0.4.2 i18n

One more thing to do for my install. I had all of my SVN repositories under <redmine_root>, so I need to move those back. If your SVN repositories are not under your Redmine install, you don’t need to execute this command:

cp -rp <backup_path>/svn <redmine_root>

Lastly, we restart Redmine/Apache

service httpd restart

Troubleshooting Post Install

After installation, you should validate that everything is working. The Redmine we page loaded for me, but I did encounter a couple issues:

1.) The Issues Tab returned a ’500 Internal Server Error’ on any page that had issues. Projects that didn’t have any issues loaded fine. This was solved by running the following SQL query in the Redmine Database:

UPDATE issues SET root_id = id, lft = 1, rgt = 2 WHERE COALESCE(root_id, lft, rgt) IS NULL;

This is needed because, between 0.9.3 and 1.1.2, the Issues Tracker received an update. One of the updates is to allow parent issues and subissues.

2.) The Repository table returned a ‘The entry or revision was not found in the repository.’ error. This occurred on all repositories (even empty ones). The solution was to modify <redmine_root>config/configuration.yml

Change the line that reads:

scm_subversion_command:

TO

scm_subversion_command: /usr/bin/svn

3.) Accessing the repositories from my SVN client repeatedly prompted for a password. It would never accept the password.

locate Redmine.pm

This will return several results. You are looking for the one that is in the ‘perl’ path. In my case it was:  ‘/usr/lib/perl5/vendor_perl/5.10.0/Apache/Redmine.pm’

We need to replace that with the one from version 1.1.2. (Remember to make your back up)

cp /usr/lib/perl5/vendor_perl/5.10.0/Apache/Redmine.pm /usr/lib/perl5/vendor_perl/5.10.0/Apache/Redmine.pm.old

cp <redmine_root>/extra/svn/Redmine.pm /usr/lib/perl5/vendor_perl/5.10.0/Apache/

UPDATE: To upgrade to a newer version (1.1.3, for example) navigate to the root of your Redmine installation and simply perform and svn update to the new revision.


cd <redmine_root>
svn update -r 5594

Finally, upgrade your database and plugins

rake db:migrate RAILS_ENV=production
rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production
rake db:migrate_plugins RAILS_ENV=production

Then restart your web server.

UPDATE 2:

I received this error after upgrading to the 1.3.x branch.

no such file to load -- <redmine_root>/config/environment

The solution is to make sure everything is owned by the proper user. In my case, the svn update had changed ownership of this particular file (along with a few others). A simple ‘chmod’ command corrected all of this.