How to backup and update the BitNami Redmine Stack

Updated 2010-05-18 Added steps to upgrade the whole stack and other small updates related to Redmine 0.9.x

A lot of BitNami users have asked in our forums how to create a backup or update Redmine. We have compiled all questions and solutions in this post to facilitate this task for other BitNami users. Although this post is based on the BitNami Redmine Stack, some of these solutions are valid for other BitNami applications.

Throughout the article, we will use the installdir term to refer us to the installation directory. On Linux it is usually “/home/redmine-version” when installed as a regular user or “/opt/redmine-version” in the case of an installation as the root user. On OS X the installation directory is “/Applications/redmine-version” by default and on Windows is “C:\Program Files\BitNami Redmine Stack”.

All commands should be executed from the BitNami Redmine Stack console. On Linux or OS X you should only run the “use_redmine” script or the “rubyconsole” script:

$ cd <installdir>
$ ./use_redmine
$ mysql --version
/home/bitrock/redmine-0.8.4-1/mysql/bin/mysql.bin  Ver 14.12 Distrib 5.0.67,
for redhat-linux-gnu (i686) using readline 5.1

On Windows you have a specific “use_redmine” shortcut to launch the console.


HOW TO CREATE A BACKUP

There are different ways of creating a backup. If you are interested in a backup of only the database data, you can create a dump file using the “mysqldump” tool.

Remember that you should run this command from the BitNami Redmine Stack console.

$ mysqldump -u root -p bitnami_redmine > redmine_backup.sql

This operation could take some time depending on the data size. Once you have the backup file, you can restore it:

$ mysql -u root -p bitnami_redmine < redmine_backup.sql

If you want to restore the database and the database schema does not exist, it is necessary to first follow the steps described below. As a side note, you can find the value for BITNAMI_USER_PASSWORD below at “installdir/apps/redmine/config/database.yml” file.

$ mysql -u root -p
mysql> create database bitnami_redmine;
mysql> grant all privileges on bitnami_redmine.* to 'bitnami'@'localhost'
identified by 'BITNAMI_USER_PASSWORD';
mysql> flush privileges;
mysql> exit;
$ mysql -u root -p bitnami_redmine < redmine_backup.sql

Note that the steps previously described will only back up the state of your database. Other files that you should take into account when performing a backup are files that have been uploaded to the
application. These files are stored in the “installdir/apps/redmine/files” folder so you can copy this folder to have a backup of your uploaded files.

Another option for creating a backup is to copy the whole BitNami Stack installation. Because BitNami stacks are self-contained, the simplest option for performing your backups is to copy or compress the BitNami Redmine Stack installation directory. To do so in a safe manner, you will need to stop all servers, so this method may not be appropriate if you have people accessing the application continously.

$ cd <installdir>
$ ./ctlscript.sh stop
$ cp -r <installdir> redmine-backup

Or you can create a tarball:

$ tar -czvf redmine-backup.tar.gz <installdir>

To restore this backup you only need to uncompress the backup tarball in the same location. It is important to use the same path that was used when the stack was originally installed.

For example if you have a backup in a Red Hat machine, you can copy it to an Ubuntu Linux machine (a different distro!) in the same location. Then start the servers and that’s all.

$ cd <installdir>
$ ./ctlscript.sh start

On Windows, you should follow the same process. Stop the servers using the shortcuts and copy the whole installation directory. To restore the system, copy the directory to a different Windows machine in the same location and follow these steps from a command prompt:

$ cd <installdir>
$ serviceinstall.bat INSTALL

You can access your BitNami Redmine at the usual URL.


HOW TO UPDATE REDMINE

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.

If you want to upgrade Redmine and all Stack components Ruby, MySQL, Apache… You can follow the steps described in Updating to a new Redmine Stack.

In case you only want to upgrade the application code without modifying any other Stack components,
you should follow section: Updating Redmine code only.


Updating to a new Redmine Stack

First, you have to download the new Redmine Stack for your platform.

Stop and uninstall previous Redmine Stack services

$ cd <old_installdir>
$ ./ctlscript.sh stop

On Windows:

$ cd <old_installdir>
$ serviceinstall.bat REMOVE

Install new Redmine Stack on a different path.

Once it has been installed, you should recover the database from the backup. Remember to start the “use_redmine” script or the shortcut on Windows before typing the following commands.

$ mysql -u root -p bitnami_redmine < redmine_backup.sql

You should also copy any uploaded files and your email settings:

$ cp -r <old_installdir>/apps/redmine/files/* <installdir>/apps/redmine/files/
$ cp <old_installdir>/apps/redmine/config/email.yml <installdir>/apps/redmine/config/

If you installed additional redmine plugins, you should copy them to the new location. You can get the full list of installed plugins in Administration -> Plugins section.

$ cd <installdir>/apps/redmine
$ cp <old_installdir>/apps/redmine/vendor/plugins/<plugin_name> vendor/plugins/
 ...

Run the migrations:

$ cd <installdir>/apps/redmine
$ rake db:migrate RAILS_ENV=production
$ rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production
$ rake db:migrate_plugins RAILS_ENV=production

Finally you should clean the cache and the sessions:

$ rake tmp:cache:clear
$ rake tmp:sessions:clear

Restart the servers and you can access your new Redmine version:

$ cd <installdir>
$ ./ctlscript.sh restart

On Windows:

$ cd <installdir>
$ servicerun.bat STOP
$ servicerun.bat START


Updating Redmine code only

First, you have to download the new Redmine version. You can choose to download the latest stable version of Redmine from RubyForge or you can download the latest repository version. In that case, you can use the Subversion tool included in the Stack:

$ svn co svn://rubyforge.org/var/svn/redmine/trunk redmine

Once you have downloaded the newer Redmine version, you need to stop the servers and rename the old redmine folder:

$ cd <installdir>
$ ./ctlscript.sh stop
$ mv apps/redmine apps/redmine-old

On Windows:

$ cd <installdir>
$ servicerun.bat STOP
$ cd apps
$ rename redmine redmine-old

Move the new redmine version to the apps folder and name it “redmine” and then copy the following folders and files from the old copy to the new one: “scripts”, “conf” and “files” folders and all the yml files inside “config”. It is also necessary to create the “apps/redmine/tmp/pids” folder.

$ cd <installdir>/apps
$ cp -r redmine-old/scripts redmine-old/conf redmine-old/files redmine-old/files redmine/
$ cp redmine-old/config/email.yml redmine/config/
$ cp redmine-old/config/database.yml redmine/config/
$ mkdir redmine/tmp/pids

If you want to keep using the currently installed Rails version, you should comment out the following line in “redmine/config/environment.rb” file

RAILS_GEM_VERSION = 'x.x.x' unless defined? RAILS_GEM_VERSION


You also need to copy session store keys to the new redmine location:

$ cd <installdir>/apps
$ cp redmine-old/config/initializers/session_store.rb redmine/config/initializers

In case this file doesn’t exist in your old installation or you get an error message about session key, you may need to run this instead:
$ cd <installdir>/apps/redmine
$ rake config/initializers/session_store

It is also necessary to update the database to merge the changes in the new version. Remember to start the “use_redmine” script or the shortcut on Windows before typing the following commands:

$ cd <installdir>/apps/redmine
$ rake db:migrate RAILS_ENV="production"

If you have installed plugins you should also run these commands:

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

Finally you should clean the cache and the sessions:

$ rake tmp:cache:clear
$ rake tmp:sessions:clear

Restart the servers and you can access to your new Redmine.


Sep 14, 2009 | Tags: MySQL, Ruby on Rails, Bug Tracking, Version Control

Comments

Upgrade steps fail "Missing the Rails 2.3.4 gem."

It seems that when I follow the upgrade steps I get errors from Mongrel. Ex: Missing the Rails 2.3.4 gem. Please gem install -v=2.3.4 rails, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed. Now I have a broken redmine stack :( I wanted to upgrade from 0.8.4-0 to 0.8.6-0 and now have to resort to reinstalling the entire bitnami stack...grrr Any known issues with rails 2.3.4 gem? Chris

Forums

Please use the BitNami forums for your questions or suggestions. We are glad to help you.

mysql password not working

Hello, I have bitnami-redmine-0.9.2-0, I downloaded the vm, and the password for mysql isn't working - any help available? thanks Simon

How to backup and restore only one project in data

I want to backup one of the projects on redmine stack and restore it to another redmine stack. How to do it?

errata

from: http://www.redmine.org/wiki/redmine/RedmineUpgrade VERY IMPORTANT: do NOT overwrite config/settings.yml with the old one.

Error with: rake redmine:migrate_from_trac RAILS_E

I was going from 0.8.6 to latest and this command error'd with a comment that the table already existed. The solution is on Redmine forum: "Error about member_roles Simply rename the tables by logging into MySQL command line and executing the rename table command: mysql> rename table member_roles to member_roles_saved mysql> rename table groups_users to groups_users_saved " This worked fine. Regards, Basho

Thanks, Basho!

Thanks for sharing!

upgrading code only

I checked out 1.0.3 from SVN to ugprade from 1.0.0 and ran into the following issues 1) I had to copy the mongrel config over to the new directory as well. cp redmine-old/config/mongrel_cluster.yml redmine/config/ 2) I had to create file config/initializers/mongrel_cluster_with_rails_23_fix.rb with contents module ActionController class AbstractRequest < ActionController::Request def self.relative_url_root=(path) ActionController::Base.relative_url_root=(path) end def self.relative_url_root ActionController::Base.relative_url_root end end end As per http://bitnami.org/forums/forums/redmine/topics/redmine-fails-after-following-upgrade-guide-with-const_missing-mongrel-errors I think the next time I will try updating to a whole new stack, seems to be the more supported route.

After Upgrade 1.1.0 to 1.1.2 Apache problems

After following the instructions for upgrading an existing redmine 1.1.0 bitnami image. I get errors with apache being unable to connect to redmine. Is there something else that need to be modified in the apache config?

This application has failed to start because CORE_

When I tried to migrate the database I received the message above. I would thank help for this issue.

This application has failed to start because CORE_

RMagick is optional for Redmine. Edit the your_installdir/apps/redmine/scripts/mongrel_rails_envvars and remove it. We will be glad to help you in the forums http://bitnami.org/forums

Thanks, Beltran!

Thanks, Beltran. It was resolved. Next time I will use the forums.

Digg-icon Digg This Story    Reddit-icon Reddit!    Facebook-icon Join Our BitNami Group

Twitter-16x16 Follow Us On Twitter    Add to delicious    Stumbleupon-icon Stumble It!