Thursday, 4 June 2009

Migrating to Redmine from Trac

I just managed to move a Trac database to Redmine on Ubuntu, but it had it's quirks. Installing Redmine was dead simple with Bitnami's stack (just download the stack bin, chmod 755 to it and run, couldn't be any easier). But to get the Trac database to Redmine was a bit more complicated, even more so because the db was sqlite3 and Bitmine's stack doesn't come with it. So, this is how I managed it:
  1. I copied the Trac db from the other machine to this (there apparently is some way of doing this remotely, but this was much easier).
  2. cd redmine-0.8.4-0
  3. ./use_redmine
  4. cd ruby/bin
  5. gem install sqlite3-ruby
  6. cd ../../apps/redmine
  7. rake redmine:migrate_from_trac RAILS_ENV="production"
Then I used the following values for the migration process:
Trac directory []: /var/trac/myproject
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Database encoding [UTF-8]:
Target project identifier []: myproject
And tadaa! When I opened Redmine in my browser all the tickets etc. are visible. Job done. Pretty much everything else was described on this page (and this for some ), but since I used Bitnami's stack, I had to do the "./use_redmine" thing to get the sqlite3 gem installed inside the stack.

EDIT: Damn! Wiki pages didn't transfer correctly, only one page and that one is wrongly formatted.

EDIT2: Damn damn. The Trac database used LDAP as the authentication method and Redmine doesn't support it. This is probably the reason why I can't log into the db, just view it.

EDIT3: Ah, things are looking up. The Wiki thing is no biggie, in this database there was just one page, so it's just a matter of fixing the formatting (mainly links). The password thing was much more complicated, this is what was required:
  1. cd redmine-0.8.4-0
  2. ./use_redmine
  3. cd apps/redmine
  4. RAILS_ENV=production script/runner 'user = User.find(:first, :conditions => {:admin => true}) ; user.password, user.password_confirmation = "my_password"; user.save!'
Now the password is set to "my_password" and with the default admin name is "redmine" and I can finally log in! If the admin name is something else you can find out it with this command:
  • RAILS_ENV=production script/runner 'puts User.find(:first, :conditions => {:admin => true}).login'

2 comments:

  1. RedMine has support for Ldap.

    ReplyDelete
  2. Yes, that was old info. I did get the LDAP support already last summer, so thanks for pointing out this omission in my article.

    ReplyDelete