Recently I’ve migrated GOYELLO‘s Redmine installation to Gentoo Linux. I’ve used nginx as a load balancer and proxy to Mongrel Cluster. Read on to learn more about the installation process of this flexible and scalable setup.
I’ve chosen Gentoo Linux because it is a stable and lightweight operating system. Gentoo installation process is not in the scope of this post. To learn more about it read the official documentation. The tips you will find in here might be, however, useful for other Linux distributions as well. The main and the only difference should be software installation commands (which are distro specific).
Ruby On Rails
Redmine is built on top of Ruby On Rails framework (ROR). The required ROR and Ruby versions depend on Redmine release. My installation works with rails 2.2.3. I needed to force it as currently Gentoo would install it in 2.3.5 version:
In case you don’t need any specific release just use the latest:
USE="mysql fastcgi"emerge-av rails
USE environment variable declared before the command tells the compiler to include support for MySQL and fastcgi.
MySQL should be already installed as a dependency for rails. Still it requires configuration before we can start it:
You should be asked for the root user password. It’s a good idea to set it. Also, for security reasons, it is advised to use a dedicated user for Redmine connections. Run MySQL console with mysql -p and invoke following SQL queries to create the user and give him permissions for local host connections:
CREATE USER redmine identified by'my$ecret';
GRANT ALL ON *.*TO'redmine'@'localhost'IDENTIFIED BY'my$ecret';
In my case I already had Redmine installation running on a different machine. What I really did here was check out the files from repository and copy the database. I put the files into /var/www/redmine.goyello.com. If you’re starting your installation from scratch official installation guide is a decent reference.
Before you proceed to the next steps it is a good idea to verify if Redmine is correctly configured and is able to run. Following command should be invoked in the Redmine’s installation directory.
Press ctrl+c to stop WEBrick once you’ve tested Redmine in your browser.
This way nginx will proxy requests to three mongrel servers. The best thing is that load balancing works out of the box. We could define more mongrel servers in the upstream section. It really depends on our needs. To make it work I included all configuration files from /etc/nginx/sites directory in the main configuration file (/etc/nginx/nginx.conf):
Nginx is ready to start now:
Mongrel Cluster makes it easy to deploy web applications on the cluster of mongrel servers. In Gentoo it is not a stable package so we need to unmask it:
We chose to run three mongrel instances. The first one will listen on port 9000 and the others will get next ports available. Note that we used these ports in upstream section of nginx configuration.
Last thing we need to do is to set right permissions for Redmine files. Both nginx and mongrel will run as a nginx user:
Now we can start our mongrel servers with:
Finalising the setup
We should already be able to see Redmine in a browser and we are almost done with the installation. The only thing left to do is to include all the services in the boot process.
PHP development manager in GOYELLO, focusing on delivering high quality software with clean and easily maintainable code. Follows best programming practices and use the best Open Source solutions. Big fan of symfony framework.
We process cookies and make them available to Google Analytics (a service provided by Google, Inc.) to improve the performance of the website, to learn your preferences about using it and to tailor it to your needs. The data will be anonymised before being transmitted. If you do not agree to this, you may disable cookies in your browser. If you do not change your browser settings, you accept the fact that it saves cookies.