Pages

Monday, January 14, 2013

Moving Redmine data to a different location

When using Redmine as an issue tracker, I used to make backups of the database manually. Then, later, I put the code to make backups into the script that starts Redmine. However, this is also not the best solution. A better way would be to have the database directly in a (dropbox) synchronized directory.
On Linux this is simple and all that is required is to put the full path to the database file. On Windows it is a bit more tricky but there is a simple and convenient way. Move the database to the synchronized directory and in db/ directory for Redmine, create a symbolic link:
mklink redmine.db [path to dropbox]\redmine.db
This will create a symbolic link to the file outside the Redmine directory and it can also be on a different partition or drive.
Using full file path in the config file did not work but using symlinks works around that limitation.

Moving Files

Windows

The same concept can be applied to other user-editable files. Whole directories can be redirected. The files users upload to Redmine are stored in "files" directory.
mklink /d files [path to dropbox]\files

On Linux

As Mercurial doesn't support symlinks, it is necessary to mount the "files" directory in Dropbox, to Redmine directory. So, in Redmine directory, rename the original 'files' to 'files.bak', and then create empty 'files' directory:
mkdir files
Then, mount the 'files' from Dropbox folder to the newly created mount point:
sudo mount --bind /path-to-Dropbox/redmine/files files

References:
Windows File Junctions, Symbolic Links and Hard Links (link)
MkLink (link)
Warning! Before removing links see this (link).
directory junction vs directory symbolic link? (link)

No comments: