Daan Croon's picture

Hello,

Is upgrading an existing 'out of the box' Redmine server to the latest Turnkey 12 version usefull? And how can the upgrade be done without losing content?

Thx for your help!

Forum: 
Jeremy Davis's picture

If you run a TKLBAM backup of your existing server and then restore it to a new instance of the v12.0 appliance hopefully it'll just work. Having said that there may be some tweaking required (depends on the changes made to the software between the version included on v11.x and the version included on v12.0). Personally I wouldn't destroy your existing instance/appliance until you are sure all is well...

If it doesn't all work as expected then I would check for any Redmine docs on upgrading from the version in v11 to the version in v12 (check the TKL Redmine appliance page to see which versions are included in each).

I guess it's probably even better to do that homework first if you are keen (although it's not the way I usually do things! :D).

It'd be great if you document your experience (this thread is as good a place as any) even if it fails and you can't work out why or how to fix it, at least we'll know there is an issue and we can look at how to resolve it.

wags007's picture

I upgraded from 11.2 to 12.0.  I used TKLBAM.  I experienced the following problems with corresponding fixes:

Problem: SSH stopped working after the restore of the backup.

Cuase: When the restore was done and the packages were updated the old files in /etc from the restore were left untouched.  This is becuase the package intentionally doesn't upgrade these files if it thinks they have been modified.  The problem with that is that they were still the old files from Ubuntu.  So when you tried to start SSH it was looking for the upstart related files.  These are present on Squeeze by default.

Resolution:

cd /etc/ssh

tar -cvf * ~/ssh.backup.tar

sudo apt-get remove openssh-server openssh-client ssh

sudo dpkg --purge openssh-server openssh-client ssh

sudo apt-get install ssh

cd /etc/ssh

tar -xvf ~/ssh.backup.tar

This restored all of the files from the package.

 

Problem: redmine couldn't connect to the database

Cuase: The redmine user was not in the database

Resolution:

create the redmine user in the database with these instructions( http://dev.mysql.com/doc/refman/5.1/en/create-user.html )  making sure to create the user as 'redmine'@'localhost'

Set the users password ( http://dev.mysql.com/doc/refman/5.1/en/set-password.html )

Grant the user access to the databases( http://dev.mysql.com/doc/refman/5.1/en/grant.html )

After the restore there were 6 databases:

Old Databases from my restore

railsapp_development
railsapp_production
railsapp_test

New databases from the new versoin

redmine_development 
redmine_production  
redmine_test 

Edit /var/www/redmine/config/database.yml and change the password in all three places ( found an example here http://www.tutorialspoint.com/ruby-on-rails/rails-database-setup.htm )

Restart as needed

Problem: None of my old database was showing up in Redmine

Cuase: /var/www/redmine/config/database.yml was pointing to the wrong database

Resolution:

Changed redmine_* to railsapp_*

Problem:  Couldn't login after fixing all of the changes above

Cause: Not sure I undestand on this one but found a thread on the redmine forums that said to do the steps below.( http://www.redmine.org/boards/2/topics/24762 )

Resolution:

As root I did the following:

cd /var/www/redmine

rake db:migrate RAILS_ENV=production
rake db:migrate_plugins RAILS_ENV=production

I hope this helps someone else.

Check out what's happening on http://linuxinstall.net

Jeremy Davis's picture

Great work! :)

Jack's picture

Hi Wags,

Thanks for posting your steps. I'm trying to do the same (except I'm upgrading from v11.1 or the Redmine appliance). I seem to be experiencing the same problems as you but your procedure fails for me at the beginning. I can't seem to remove openssh-server. I get errors which seem to be caused by the removal or openssh-server

 

$dpkg --purge openssh-server

Removing openssh-server
exec: 34: /lib/init/upstart-job not found
invoke-rc.d: initscript ssh, action "stop" failed.
dpkg: error processing openssh-server (--purge):
 subprocess installed pre-removal script returned error exit status 2
Errors were encountered while processing:
 openssh-server

I can't seem to get passed this. Does it look familiar to you? Any advice would be greatly appreciated.

Thanks,

Jack

Jack's picture

Ok so a bit more narrowing down and I found the solution to my problem. From here:

In above openssh-server package is not getting removed because of script error. Mostly these are shell script written using /bin/sh. These scripts called with -e option which means if not interactive, exit immediately if any untested command fails.

Solution from above:

 

$ cd /var/lib/dpkg/info
 
Now find out files in following format:
$ ls openssh-server.*
 
Should output something like openssh-server.postinst openssh-server.preinst openssh-server.postrm openssh-server.prerm
 
Now open each file and find out line that read as follows:
 
#/bin/sh -e

(Replace with)

#/bin/sh
 
Save and close all the files. Now run apt-get / dpkg command again to remove package:
# apt-get --purge remove openssh-server
 
In my system only openssh-server.postinst, openssh-server.postrm and openssh-server.preinst had the '-e' flag in the line as above. Trying to remove ssh from there still didn't work but as the error message I was getting suggested it was a problem with the pre-removal script I opened the file 'openssh-server.prerm' and removed the line:
set -e
After this, removing worked and I was able to reinstall SSH and continue with Wags instructions above to get the system up and running.
 
Thanks Wags :)
Jack's picture

In the interests of future proofing this configuration, after you have migrated the database and get Redmine up and running, would it be a good idea to copy your data from the 'railsapp_*' databases, back into the 'redmine_*' databases, undo the changes to '/var/www/redmine/config/database.yml' and delete the old 'railsapp_* databases.

Or would it even matter?

Daan Croon's picture

Installing the latest version in Virtualbox and restoring the old server from the cloud didn't work in my case either:

There appears to be a database problem.

  • Your config/database.yml may not be written correctly. Please check it and fix any errors.
  • Your database schema may be out of date or nonexistant. Please run rake db:migrateto ensure that the database schema is up-to-date.
  • The database server may not be running. Please check whether it's running, and start it if it isn't.
     
    Anyway, you sollution doesn't really sound easy. If there is a 'full idiot proof' way to fix this, that would be great. If not, I'll give a try somewhere in the near future.
     
    Thanks again for you comment, Daan.

Add new comment