Andrew Killer's picture

Please see updated thread here

Intro

Here is a quick guide on upgrading the base TurnKey Redmine install to the latest version of Redmine (2.0.3 at this moment in time). I tried several methods including using the Redmine PPA but in the end couldn't get anything else to work and I don't have the knowledge (/patience) to fix it myself.

99% of this guide is from Adam Wu/babbomaria's posts, I'm just collating them to make it easier for everyone so pass the credit onto them :).

I was going to use the SVN Redmine version but it was giving me svn: REPORT of '/svn/!svn/vcc/default': Could not parse chunk size (http://redmine.rubyforge.org) errors during checkout so switched to Mercurial.

 

Go Go Go

Whatever you do, take a snapshot of your VM before you do this as I imagine it wouldn't be simple to revert back manually if it went wrong.

 

Update Rails

TurnKey Redmine ships with rails version 2.3.8, Redmine 2 needs 3.2.6 so update it with:

gem install rails

Test it worked with:

rails -v

 

Get Redmine

This is pretty much just a copy/paste of [1] mixed with some of the Redmine install notes for the later versions. Some commands will error but just ignore them. If you have rmagick installed remove it from step 11, I don't.

Copy/paste this into a script to make life easy:

  1. cd /var/www
  2. mv railsapp railsapp-old
  3. hg clone --updaterev 2.0-stable https://bitbucket.org/redmine/redmine-all railsapp
  4. cp railsapp-old/config/email.yml railsapp/config/configuration.yml
  5. cp railsapp-old/config/database.yml railsapp/config/database.yml
  6. cp -r railsapp-old/files/ railsapp/files/
  7. chown -R root:www-data /var/www/railsapp
  8. cd railsapp
  9. gem install bundler
  10. gem install test-unit
  11. bundle install --without development test rmagick
  12. mkdir public/plugin_assets
  13. rake generate_session_store
  14. rake db:migrate RAILS_ENV=production
  15. chown -R www-data:www-data files log tmp public/plugin_assets
  16. rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production
  17. rake db:migrate_plugins RAILS_ENV=production
  18. chmod -R 755 files log/ tmp/ public/plugin_assets
  19. rake tmp:cache:clear
  20. rake tmp:sessions:clear

Make sure you go to Admin -> Roles & permissions and assign new permissions. Manage related issues was added since the base version at least if not more.

 

Check it works

Run:

/var/www/railsapp/script/about

Hopefully you'll see something like this:

Environment  

Redmine version

2.0.3.stable

Ruby version

1.8.7 (i686-linux)

Rails version

3.2.6

Environment

production

Database adapter

MySQL
Redmine plugins:  

no plugin installed

 

 

Upgrading In The Future

By switching to using the Redmine Mercurial repository upgrades in the future should just require the following steps [4]:

  1. cd /var/www/railsapp
  2. rake generate_session_store
  3. hg pull
  4. hg update
  5. bundle install --without development test rmagick
  6. rake db:migrate RAILS_ENV=production
  7. rake redmine:plugins:migrate RAILS_ENV=production
  8. rake tmp:cache:clear
  9. rake tmp:sessions:clear

 

References

  1. http://www.turnkeylinux.org/forum/support/20100104/how-upgrade-redmine-0...
  2. http://www.turnkeylinux.org/forum/support/20100104/how-upgrade-redmine-0...
  3. http://www.redmine.org/projects/redmine/wiki/RedmineInstall
  4. http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

 

 

 

Enjoy!

Forum: 
Mario Luzeiro's picture

Thanks! I will try to follow it.

 

But I think that in the future, TKL Redmine should be updated and add more features. In Redmine there are lots of features that also need work in the distro (as the version control with login.. auto checkout out version folders.. make an easy upgradable plugins and redmine build.. ) may here the community should help to make a good featured distribution.

Jeremy Davis's picture

But some of your ideas sound interesting Mario. Perhaps flesh your ideas a bit more (with a few more specifics). Maybe lodge a Blueprint or start a new forum thread.

Todd Forsberg's picture

I followed your steps, but the railsapps folders have question marks at the end of the folder name and the system reports "No such file or directory"  Any ideas what I may have done wrong? 

-Todd Forsberg

Andrew Killer's picture

Hi Todd,

Can you post the output from:

ls -l /var/www/

I have no idea where the question marks came from unless it's some odd character encoding problem if you copied/pasted the steps from the forums.


Andrew Killer's picture

Strange. Can you rename it by running:

mv /var/www/railsapp? /var/www/railsapp

 

You should then be able to carry on if that works.


Todd Forsberg's picture

Yes, I can rename it.  I didn't think of trying that before.  I think you were correct about the chacter encoding.  I did copy/paste from the website.  I'm going to retype it and try again.

-Todd Forsberg

dnepr's picture

Redmine insatllation Ubuntu 12.10, Nginx, php-fpm, MySQL, thin

Andrew Killer's picture

It sounds like you have a later version of the Redmine TurnKey release than what I used.

Could you try all the steps within the redmine folder instead?


Andrew Killer's picture

No problem; glad you got it working :). I'm sure it wouldn't be too difficult to get it to work on the latest version of TurnKey if you needed any of the new things it has - now's the time before you start using it!

With a couple of people having the MySQL problem recently I wonder if there's been an update to one of the apt packages or something which is causing the new MySQL version to be installed.

Though saying that, my own install hasn't installed the other MySQL version. I've just pulled the latest Redmine version using my update script (see the commands in Upgrading In The Future) and it's still not installed.

Very odd!


Jeremy Davis's picture

Uses a package from the repo (rather than upstream). But I'm only guessing....

Todd Forsberg's picture

 I retyped the whole thing.  Same results. 

But, but just typing each line manually in the "Shell-in-box" console, it worked fine.   There are some depricated items in above listing (script), but Ruby provided the new methods to use.

-Todd Forsberg

Andrew Killer's picture

Hi John,

That's odd. I ran the whole upgrade procedure a couple of times on different VMs and never saw that error, maybe it was because I was upgrading from the stock version not 1.3.

The Redmine upgrade docs do list a different command to upgrade the plugins database, this may be worth a try instead:

rake redmine:plugins:migrate RAILS_ENV=production 

If you look at the Upgrading In The Future part of my original post that's actually the one I used in there. Try running the upgrade commands from there and see if it works too - I dropped them into a script which I can periodically run to kee it up to date.

Failing that, I would say as long as everything appears to work then just ignore it, it sounds like it's working fine!

Cheers,

Andrew.


Andrew Killer's picture

Hmm I'm not too sure. Did you definately run the below command with RAILS_ENV=production at the end?

rake db:migrate_plugins RAILS_ENV=production

 

Faililng that http://projects.andriylesyuk.com/issues/2056 seems to have a similar problem to you - look through the comments.

Apart from that I'd look to post on the official Redmine support forums - I don't know Ruby personally so wouldn't know where to begin.

 


L. Arnold's picture

I posted separately on TKL Forums a request for guidance on upgrading the Tracks Appliance which also runs on Rails:

http://www.turnkeylinux.org/forum/support/20120731/upgrading-tracks

It seems the subject is quite similar to this.  The new Debian Tracks will not upgrade with a simply TKLBAM-RESTORE so I assume I need to get my Tracks intsall up to 2.1 and then run a TKLBAM-RESTORE to jump into v 12 TKL (this was my method for Magento anyway). 

I am completely ohterwise out of my element with RAILS and would love some guidance.  These links tell me what to do, but I want to contextualize to a TKL install.

http://getontracks.org/manual/upgrading.html

http://getontracks.org/downloads/comments/tracks-21/

Any guidance someone could offer?

Thank you.

Andrew Killer's picture

Mine only shows as having mysql 2.8.1 installed so personally I'd try removing one of those versions and see what happens:

gem uninstall mysql --version 2.8.1
(and if that fails try 2.9.0 I guess)

Good luck!


Andrew Killer's picture

Glad you got it sorted!

Cheers for posting the solution. There's nothing worse than finding your exact problem from a Google search and someone doesn't tell you how they fixed it.


Don's picture

Error message:
undefined local variable or method `config' for main:Object
Exception class:
NameError
Application root:
/var/www/redmine-2.2.2 [Yes, I did change the directory. It's changed in the apache config of webmin, etc.]
Any ideas what this error is? I can't seem to track it down. Here is the full backtrace.
0 /var/www/redmine-2.2.2/plugins/engines/init.rb 3  
1 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 251 in `require'
2 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 251 in `require'
3 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 236 in `load_dependency'
4 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 251 in `require'
5 /var/www/redmine-2.2.2/lib/redmine/plugin.rb 130 in `load'
6 /var/www/redmine-2.2.2/lib/redmine/plugin.rb 121 in `each'
7 /var/www/redmine-2.2.2/lib/redmine/plugin.rb 121 in `load'
8 /var/www/redmine-2.2.2/config/initializers/30-redmine.rb 12  
9 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
10 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
11 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 236 in `load_dependency'
12 /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.11/lib/active_support/dependencies.rb 245 in `load'
13 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 588  
14 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 587 in `each'
15 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/engine.rb 587  
16 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 30 in `instance_exec'
17 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 30 in `run'
18 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 55 in `run_initializers'
19 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 54 in `each'
20 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/initializable.rb 54 in `run_initializers'
21 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/application.rb 136 in `initialize!'
22 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb 30 in `send'
23 /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/railtie/configurable.rb 30 in `method_missing'
24 /var/www/redmine-2.2.2/config/environment.rb 14  
25 config.ru 3 in `require'
26 config.ru 3  
27 /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb 51 in `instance_eval'
28 /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.4/lib/rack/builder.rb 51 in `initialize'
29 config.ru 1 in `new'
30 config.ru

Andrew Killer's picture

Looks like you're missing a config.ru file.

Have a look at https://github.com/37signals/pow/issues/98 which should get you going again.


Don's picture

But it wasn't.

Copied the config.ru from /var/www/railsapp/vendor/rails/railties/dispatches/config.ru as listed in your link above.

root@redmine www/redmine-2.2.2# locate config.ru
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.14/test/stub/rack/config.ru
/usr/local/lib/ruby/gems/1.8/gems/rack-1.4.4/test/rackup/config.ru
/usr/local/lib/ruby/gems/1.8/gems/rack-test-0.6.2/spec/fixtures/config.ru
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.14/dispatches/config.ru
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.8/dispatches/config.ru
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/guides/code/getting_started/config.ru
/usr/local/lib/ruby/gems/1.8/gems/railties-3.2.11/lib/rails/generators/rails/app/templates/config.ru
/var/www/railsapp/vendor/rails/railties/dispatches/config.ru
/var/www/redmine-2.2.2/config.ru
 

Contents of the config.ru file looks like the one in the link.

# Rack Dispatcher

# Require your environment file to bootstrap Rails
require File.dirname(__FILE__) + '/config/environment'

# Dispatch the request
run ActionController::Dispatcher.new

Still get the same error message.

The only other thing I've noticed ... when editing the files in vi, seems the EOL is showing as ^M - which from previous experince doesn't usually end well. Might it be worth my time to strip those out?

Andrew Killer's picture

I'm sure removing ^M wouldn't hurt it (apparently it's a DOS/Windows leftover).

I wonder, on my install my plugins directory is empty (bar the README file).

What happens if you clear out your plugins directory? Looking at it in a bit more detail it's throwing the exception trying to read from the plugin folder so that should be a good start.


Don's picture

I've got to learn how to dechiper those error messages better.

That was the issue. Up and running now. Odd part is I knew not to have plugins there, but I guess I never went back to make sure it was 100% cleared.

Andrew Killer's picture

Glad it's working :).

It's not the easiest stacktrace to read to be honest, but then again I don't know Ruby or how it works.


waspinator's picture

I tried following the instructions for option 2 here:

http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

and running

svn update

but it doesn't seem to do anything. just says

Skipped '.'

Bundle update runs and seems to do something, but I'm still on version 2.2.3

Trying 'option 1' in the guide gives me a 500 error page.

Thanks

Andrew Killer's picture

Is your current Redmine copy checked out from SVN? It sounds like it's not.

Option 1 from that guide may be better for you in that case.


waspinator's picture

not sure. whatever was included in the Turnkey 13.0 version.

I tried option 1 after trying option 2, so maybe that's what broke it.

Andrew Killer's picture

I've not updated it for a long time but it should still mostly work.

The only caveat is that you can't checkout past revision f0d7c701cd6f0e9e7bcdf021607c0445a158d13f (13102) without gettings lots of errors due to incorrect rails/rake versions (I forget which). These versions weren't available via apt so I gave up :).

Replacing the update command with hg update -r 13102 should work.

https://bitbucket.org/redmine/redmine-all/commits/f0d7c701cd6f0e9e7bcdf0...


Andrew Killer's picture

If you have to change any of the steps it would be worth posting what they were here so others may benefit.

We're still running this VM for all our source without issues though :).


dsudo's picture

Hey,

after 2 days of researching and error solving I finally updated the redmine from v1.4.4 to 2.6.0.

It took me a while to figure out what was missing and what needs to be updated in order to make it work.

I will work now on a detailled documentation including ruby/rails update with rvm, installing passenger and mysql2 and also editing files which essential to have a full working redmine. Once I finish the docu I will post it here.

Thanks for this guide though, it helped me out a lot.

With best regards

Dom

dsudo

Jeremy Davis's picture

This thread is getting pretty old (and lengthy) now so it may even be worth starting a new thread? Regardless, looking forward to your updated doc, it will be a great help to the community! Great work! :)

Add new comment