Migrating your Redmine instance to another machine

The following will be very useful information if you ever need to migrate your Redmine instance (along with existing data) to a different machine.

Some very useful links are:

This article is mostly a summary of the above mentioned articles, with some additional steps that I had to perform.

1. First you need to create backup of your current instance

  • Redmine services should be in started state
  • Verify that <bitnami>\mysql\my.ini has correct  user/password/port in [mysqladmin] group and that, if using non-standard port, it is set in the [mysqldump] group with a port=# setting. (Password should be same as that defined for admin user)
  • Open “use_redmine” console, and run the following commands:
1. scripts\setenv.bat
2. cd mysql\bin
3. mysqldump -u root -p bitnami_redmine > redmine_backup.sql

You will be asked to enter a password. Enter the password from my.ini (The same password that is for the admin user)

  • The database backup file ‘redmine_backup.sql’ will get created in the mysql\bin folder. Copy it into another location as the database  backup.

2. Also, keep a copy of all the files from <Installdir>\apps\redmine\files. This folder contains all the files that have been uploaded to Redmine by User as attachments.

In case you had installed any plugins, copy their folders from <Installdir>\apps\redmine\vendor\plugins location.

3. Stop and uninstall previous Bitnami Redmine Stack services. Then, Uninstall the entire existing Bitnami Redmine stack

4. As a Backup, copy/move the <Installdir> to another location, and remove from the previous location (to avoid confusion in future). I deleted the whole folder from my C:\Program Files location ( after copying it to a folder named “Redmine Backup”)

5. Install the new Bitnami Redmine. You need to install the new Bitnami Redmine stack in NEW location (i.e. You are not supposed to overwrite the previous instance. An entirely new folder should get created).

As I had already removed files of previous instance from the ‘Program Files’ location, I did not need to worry about this much. But, still I changed the name of the instance by removing the spaces in between. So, the new instance got installed in “C:\Program Files\BitnamiRedmine”

Other details you have to take care of in this step are:

  1. Download the new Redmine Stack for your platform.
  2. Keep username/password same as that for the admin user in previous instance. These will be used when restoring database.
  3. Do not enter email address, otherwise you may get “Email has already been taken” if you attempt to change account settings of a Redmine user that has same email address!
  4. Setup email settings now or later; old settings are in <old_bitnami>\apps\redmine\config\email.yml
  5. Allow redmine to start
  6. Confirm Redmine works (visit http://localhost:<apache_server_port>/redmine). You will get your <apache_server_port> value from the properties.ini file in the root folder.

6. Make sure you have downloaded all gems required for the plugins you want to install.

Then, install the gems in the machine using “gem install” command.

If internet is not available, install the required gems locally by first downloading them from http://rubygems.org/gems, and then running the following command from inside the folder that contains the .gem files

           gem install --local <gem_name>

7. Open a NEW “use_redmine” console for the NEW redmine and run the following commands (Points 7 to 13) (Make sure the stack services are in a started state at this point):

  1. scripts\setenv.bat
  2. cd mysql\bin

8. Create proper database schema to receive old database.

cmd> mysql -u root -p
Enter password: ********   <password will be same as that for admin user>
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 10
Server version: 5.0.83-community-log MySQL Community Edition (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
mysql> show grants;
| Grants for root@localhost                                |
1 row in set (0.00 sec)
mysql> drop database bitnami_redmine;
Query OK, 47 rows affected (0.28 sec)
mysql> create database bitnami_redmine;
Query OK, 1 row affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON bitnami_redmine.* TO 'root'@'localhost' IDENTIFIED 
BY PASSWORD '<see below note to know what to enter here as BITNAMI_USER_PASSWORD>';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;

Note – 1) The BITNAMI_USER_PASSWORD should match the String after ‘IDENTIFIED BY PASSWORD’ when the command ‘show grants’ is run in the previous step.
2) Some useful in below link regarding mysql user creation:
9. Restore old Database into new

mysql -u root -p bitnami_redmine < redmine_backup.sql

If the redmine_backup file is not available in the ‘mysql\bin’ folder where you are executing the query, the absolute address of the file should be specified (in double quotes) instead of just the file name. Otherwise, you can just give the name of the file (as shown above), and the command will work

10. Merge settings from old (C:\Program Files\BitNami Redmine Stack\apps\redmine\config) into new (C:\Program Files\BitNamiRedmine\apps\redmine\config). This involves three files:

  • settings.yml: I found that no lines had changed; only new lines added so left the new version untouched.
  • database.yml: left the new version untouched; note: the username is bitnami, rather than the one you selected at installation time; the password is randomly generated by installation tool, it is not a hash.
  • email.yml: if you didn’t setup at installation time, copy file from old stack.

11. Copy the plugins you wish installed into the <Bitnami>\apps\redmine\vendor\plugins location.

12. Migrate the data imported to the new schema:
$ cd <installdir>\apps\redmine\vendor\plugins
$ rake db:migrate RAILS_ENV=production
$ rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production
$ rake db:migrate_plugins RAILS_ENV=production

13. Clear caches:

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

14. Copy all files from previous backup of <Installdir>\apps\redmine\files to the new <Installdir>\apps\redmine\files folder

15. Start new stack

16. Verify that your New Redmine is working fine, and that the data looks ok : issues, wiki, attachments, projects hierarchy, users

Once again, I would like to thank the author of http://schollii2.wordpress.com. His article was a great help to me, and most of the steps I have written above are lines from his article.

I hope my article will help someone…Took me hours to gather all this information.


3 thoughts on “Migrating your Redmine instance to another machine

  1. mcmpm says:

    Great summary, but I think your step #9 has a cut-n-paste typo (you say mysqldump when I believe you mean mysql)…so, I believe it should read:

    9. Restore old Database into new

    mysql -u root -p bitnami_redmine < redmine_backup.sql

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s