Blog of Raivo Laanemets

Stories about web development, freelancing and personal computers. upgrade progress

It's been taken a while since I started planning the upgrade. However, today I switched my IPs from the old machine to the new.


I installed Nginx from the official Debian Wheezy repository. Install went without any issue. I tweaked the main conf /etc/nginx/nginx.conf to match the number of worker processes with the number of available CPUs (8).

Feeds app

The second thing I installed was the Feeds App. I went with NodeJS 0.10. The sqlite3 package was fixed to work with 0.10 series. During the install I also decided to upgrade the app and implement some features I was missing. One of the features was the init script using forever as the process manager. I also tried out the mon process manager but it is not working well with the sudo command.


The next service I installed was my personal blog engine. This requires Swi-Prolog and I had forgotten how to install it. The right way was:

apt-get install libreadline6-dev
apt-get install libgmp-dev
make -j8
make install
cd sgml/
make install
cd ..
cd http/
make install

This installs Swi with necessary modules. However, to avoid some issues, one needs to run swipl as root and then run goal make to have the predicate autoimport index refresh itself.

Redmine tracker

I expected this to be the hardest upgrade task and it surely did not disappoint me in that regard. Rails is notorious for it's lack of backwards compatibility and gem hell.

I started by compiling ruby. Its configure script should report about essential missing libraries but it does not. Compilation process itself is incredibly slow, even with make -j8 on a 8-cpu machine. Anyway, I finally got it installed. The set of dependencies I had to install:

apt-get install libffi-dev libyaml-dev libssl-dev

Then I attempted to set up a thin cluster to run it. I preferred thin as the Passenger would have required recompilation of Nginx to support loadable modules. I created the configuration file for thin:

pid: /home/redmine/
wait: 30
timeout: 30
log: /home/redmine/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 4
daemonize: true
user: redmine
socket: /home/redmine/thin.sock
chdir: /home/redmine/redmine

When I tried to run it, I got the following error:

/home/redmine/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup':
You have already activated rack 1.5.2, but your Gemfile requires rack 1.4.5.
Using bundle exec may solve this. (Gem::LoadError)

As I wanted to avoid the bundle exec <long command> crap I figured that it's much easier to just remove rack 1.5.2 gem. The next error I got:

/home/redmine/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/connection.rb:31:in `post_init':
cannot load such file -- thin/request (LoadError)

Comes out that you have to add thin gem into the app's Gemfile. This was not in any of the official installation guides but Googling helped.

The next issue raised from the need of having the Redmine running on a sub-URI. This used to be easy with Passenger and earlier Redmine versions. Making Nginx proxy /redmine to Redmine was easy but I was not able to make Redmine generate links with the correct prefix. The official installation guide recommends:

Redmine::Utils::relative_url_root = "/redmine"

but it makes no difference. "Using Rails Features" below did not work either. Comes out it might be broken in latest versions of Redmine. However, the same issue gives solution that works (or works in my case only):

RedmineApp::Application.routes.default_scope =  { :path => '/redmine', :shallow_path => '/redmine' }

This makes Redmine generate correct URLs but also adds prefix redmine to all routes. This works with the following Nginx config:

location /redmine {
    try_files $uri @redmine;

location @redmine {
    proxy_pass http://redmine;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_redirect off;

For having correct URLs for static assets, I also needed:

config.asset_path = "/redmine%s"

in config/application.rb. Otherwise it would ignore the fact it's running on a sub-URI.

Redmine plugins

Redmine was now running fine but I also had to reinstall/upgrade plugins. Thankfully, when I did upgrade the last time, I had removed most of the plugins. This saved me from lots of pain.


The first plugin I upgraded was DMSF. It's a document management system that is a bit more powerful than the built-in Files section.

The first issue with this plugin was a conflicting dependency that bundler was unable to solve:

You cannot specify the same gem twice with different version requirements. 
You specified: nokogiri (< 1.6.0) and nokogiri (>= 1.4.2)

Looks like bundler is quite dumb and you cannot have two gems with different requirements even when there is a version that satisfies both requirements. I had to comment out nokogiri from Redmine's Gemfile. It was in the test section that was skipped anyway.

The second issue was a database migration that tries to move around your files. It tried but failed completely because in my old installation I had files in a different location. However, it does not abort the migration process and makes it harder to just rerun migrations, after the file location issue has been solved.

Changing the location was not easy. It's kept in the database in a text blob like this:

--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
dmsf_max_file_upload: '0'
dmsf_max_file_download: '0'
dmsf_max_email_filesize: ''
dmsf_storage_directory: /home/redmine/redmine/files/dmsf
dmsf_really_delete_files: 'true'
dmsf_default_notifications: ''
dmsf_zip_encoding: utf-8
dmsf_webdav: ''

Good luck modifying a piece of text inside it with the mysql command line utility. I figured it was easier to edit the database dump, reload it and rerun all previous migrations. This also solved the issue with the failed migration that tried to move the files.


After installing, I got

ActionView::Template::Error (undefined method `remote_function' for #<#<Class:0xb29691c>:0xb29cb14>):
20:     #{remote_function(

Comes out the plugin uses some JavaScript helpers that are long gone. There is a fix for that but that's not merged. Fortunately, the forked version where the pull request originates has no other changes.


Looks like it just does not work on Redmine >= 2.1.


Installs and works well.

SquirrelMail and friends

Installed SquirrelMail from the official source, not the system package. Also installed the other e-mail goodies with it: postfix and courier-imap. While I still have some email issues with my secondary domain, it's mostly working.


Still sending my logs to Logentries. Very good support from these guys.

The upgrade is not finished. Some smaller services are not yet migrated. I keep working on them.


No comments have been added so far.

Email is not displayed anywhere.
URLs (max 3) starting with http:// or https:// can be used. Use @Name to mention someone.