This post explains how to set up Redmine - the packaged version in Debian, to be hosted by Unicorn server and to use apache load balancing module. This is a faster alternative to running Redmine with mod_passenger.
The idea is as follows: unicorn is starting X servers running Redmine, and Apache is load-balancing the requests between those servers. We have to start with installation of unicorn gem
Now, we have to creation Unicorn configuration file:
Before we try to start Redmine, we have to create a symlink to the logs directory:
Now, we can start Redmine and test if it works:
Note: Change the /redmine path to the path you want your Redmine should be visible at. This is needed for correct URL operations. If everything is running smoothly, you can start the server with su and add the line to /etc/rc.local:
This is starting Unicorn initially as www-data user. Apache 2 Balancer configuration In this step, we tell Apache how to route requests to Redmine between the workers. Firstly, let’s enable the appropriate modules:
Next, edit an appropriate VirtualHost configuration file. In the default configuration it would be /etc/apache2/sites-available/default and add the corresponding lines:
A little bit of description:
The SetEnv part is needed for Redmine Debianized configuration to choose the instance of Redmine Proxy section defines the balancing workers to be used, be sure to adjust this if you are starting less/more worker threads The Alias line is needed for some static files used by Redmine The Rewrite section eventually tells Apache to route all Redmine requests to the load balance by matching /redmine/ against $REQUEST_URI variable. The Location part is for the Redmine Web Service security. Adjust this to limit the access to the /redmine/sys/ only for the trusted servers.