With this post I would like to start a series of articles on how we have adapted the Redmine task tracker to fit our needs.
About 2 years ago, I had to change the profile of my activity quite strongly, and from system administration to go into development on the Ruby on Rails framework. It was necessary to adapt Redmine to the needs of a fairly large IT department, and then to the needs of the company as a whole. Then, I ran into the relative non-simplicity of installing “Redmine”. And the comprehensive article for beginners really lacked!
There are several ways to install the ROR application, which is the “Redmine”. This article will discuss installing on the Apache web server using Passenger and RVM. As a database server, we still use “MySQL” (or rather, MariaDB), although we are thinking about moving to “PostgreSQL”.
')
Apache
Install the Apache web server:
The main reason for using “Apache” is the presence of a module for transparent authentication in the “Windows” domain. We initially wanted to simplify the use of Redmine. Not having to enter a password twice was a big plus.
Immediately configure the virtual hosts "Apache". First, we set up virtual hosts without Ruby support. Just to check that “Apache” works correctly and configure the transparent authentication module in the “Windows” domain.
Create a folder where the Redmine distribution will be located:
Create a link from the “/ var / www” directory (the directory in which the Apache websites are usually located) to the folder with our future Redmine distribution:
Create a virtual host file:
Fill the file with the following contents (configuring a virtual host):
<VirtualHost *:80> ServerName redmine.local ServerAdmin support@redmine.local DocumentRoot /var/www/srv-redmine/public Options Indexes ExecCGI FollowSymLinks <Directory /var/www/srv-redmine/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost>
The domain name "redmine.local" must be defined (resolved) on the network where you will use Redmine.
We include our site:
A package that implements the “a2ensite” command may not be installed in “Ubuntu”. In this case, a hint will appear in the console how to install it.
Restart apache:
To verify that the virtual host is configured correctly. Create a file “index.html” with arbitrary content in the virtual host directory.
Having opened the page “http: //redmine.local” in the browser, we should see the contents of our file.
Transparent Domain Authentication Module
Sadly, we didn’t find such a module under “ngix”. Probably for this reason, we still use “Apache”.
We swing the module, we unpack somewhere. I usually unpack to my home directory:
Install the package to compile the modules:
With this module there is subtlety. It does not authenticate too long logins. Therefore, if the company has employees with logins like “rimsky-korsakov”, then before compiling the module, you need to change the maximum login length in the file “ntlmssp.inc.c” by editing the line “define MAX_USERLEN 32”
Go to the unzipped directory. Compile the module:
During the compilation process errors may occur. This is normal.
In the virtual host settings, add directives that are responsible for authentication. The virtual host file should now look like this:
<VirtualHost *:80> ServerName redmine.local ServerAdmin support@redmine.local DocumentRoot /var/www/srv-redmine/public Options Indexes ExecCGI FollowSymLinks <Directory /var/www/srv-redmine/public> AllowOverride all Options -MultiViews </Directory> <LocationMatch "/login"> AuthType NTLM NTLMAuth on NTLMAuthoritative on NTLMDomain OUR_DOMAIN.LOCAL NTLMServer dc1.our_domain.local NTLMBackup dc2.our_domain.local require valid-user </Location> </VirtualHost>
During operation, it was observed that this module can significantly slow down the return of static data. Therefore, we configured the module so that it connects only on the authentication page in Redmine. The rest of the authentication work is implemented by our
transparent authentication plugin .
MySQL (MariaDB)
Install the database server "Mysql".
“MySQL” is a bit old, so it’s better to use its “MariaDB” fork. At some stage we moved from the first to the second, without any problems. In terms of installation and configuration for both database servers, everything is about the same.
Connect to the server with the password entered during the installation phase:
Create an empty database for Redmine and assign privileges:
create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'password_for_redmine_user'; grant all privileges on redmine.* to 'redmine'@'localhost'; exit;
RVM
In a nutshell, RVM allows you to install different versions of Ruby on the same computer. We constantly argue with my colleague, do we really need an “RVM” on a production server?
There is no direct need for it, but I love it because it allows you to greatly simplify the installation of "Ruby". Ubuntu doesn't always have the latest Ruby packages, but RVM has it! In general, we use "RVM".
To install "RVM" you need to install "Curl":
Then we exit the “root” user and then run as a normal user:
$curl -L https://get.rvm.io | bash -s stable
After installation, RVM will tell us which other packages need to be delivered to Ubuntu. At the time of this writing, these were the following packages:
Install "ruby-1.9.3", but first you need to put "ruby-1.8.7", otherwise nothing.
If the message “RVM is not a function, selecting rubies with 'rvm use ...' will not work”, then the command “/ bin / bash --login” should be executed. And then you can work with “RVM”:
$rvm install ruby-1.8.7-head $rvm use ruby-1.8.7-head $rvm install ruby-1.9.3-head $rvm use ruby 1.9.3-head --default $rvm gemset create rails3 $rvm use 1.9.3-head@rails3 --default
When I mastered RVM, this post really helped me:
http://habrahabr.ru/post/120504/ .
Passenger
Passenger is an Apache module that allows you to run Ruby applications. RVM allows you to compile Passenger for a particular jamset. After compilation, RVM will advise how to connect Passenger to Apache.
The version of “Passenger” is subject to change. Therefore, you need to make sure that the path is correct (in the 3rd team).
In the corresponding Apache directories, we create the module configuration files and the module download files:
Write the following content to the file:
LoadModule passenger_module /home/user/.rvm/gems/ruby-1.9.3-head@rails3/gems/passenger-4.0.8/buildout/apache2/mod_passenger.so
Configuration file:
The contents of the configuration file:
<IfModule mod_passenger.c> PassengerRoot /home/user/.rvm/gems/ruby-1.9.3-head@rails3/gems/passenger-4.0.8 PassengerDefaultRuby /home/user/.rvm/wrappers/ruby-1.9.3-head@rails3/ruby </IfModule>
After compiling Passenger, RVM will generate the correct contents of these files. You just need to create files and copy the contents.
We connect our module:
Immediately change the configuration file "Apache". Now we have Passenger:
<VirtualHost *:80> ServerName redmine.local ServerAdmin support@redmine.local DocumentRoot /var/www/srv-redmine/public Options Indexes ExecCGI FollowSymLinks PassengerResolveSymlinksInDocumentRoot on RailsEnv production RailsBaseURI / <Directory /var/www/srv-redmine/public> AllowOverride all Options -MultiViews </Directory> <LocationMatch "/login"> AuthType NTLM NTLMAuth on NTLMAuthoritative on NTLMDomain OUR_DOMAIN.LOCAL NTLMServer dc1.our_domain.local NTLMBackup dc2.our_domain.local require valid-user </Location> </VirtualHost>
Restart Apache:
Redmine
We take the latest version of Redmine from the SVN repository. SVN client may not be installed in Ubuntu. Then you need to install it.
The user is the user under whom we installed “RVM”.
Install “Rmagic” and the
package without which gem will not be installed.
or like this (depending on the version of "Ubuntu"):
Change the settings of the connection "Redmine" to the database. In our case, this is “MySQL”:
$cd /usr/share/srv-redmine/redmine-2.3/config
Change the database.yml file:
production: adapter: mysql2 database: redmine host: localhost username: redmine password: password_for_redmine_user encoding: utf8
At the same time, we are configuring the sending of mail messages from Redmine. File "configuration.yml":
production: email_delivery: delivery_method: :smtp smtp_settings: address: "smtp_server" port: 25 domain: "mail_domain_name" authentication: none
We have configured a mail server that does not require authentication within the network. Therefore, the file is. Your file may be different. Read more here:
http://www.redmine.org/projects/redmine/wiki/EmailConfigurationInstall all the jams that Redmine needs:
$cd /usr/share/srv-redmine/redmine-2.3 $bundle install --without development test
“Redmine” out of the box allows you to not transparently authenticate in the domain. For this, the “net-ldap” jam is used. This jam contains one very serious error.
You need to find this jam in jamset and handles to fix the file according to this
commit .
Otherwise, when certain data in Cyrillic is requested from “LDAP”, unexpected errors may occur.
Then everything according to
the installation instructions «Redmine» :
We generate the secret key:
rake generate_secret_token
We create labels in our database:
RAILS_ENV=production rake db:migrate
Fill the database with basic data:
RAILS_ENV=production REDMINE_LANG=ru rake redmine:load_default_data
Actually that's all. Restart Apache. Everything should work.
What other ways are there to install Redmine?
You can simply download
"Bitnami Stack" .
You can install “Redmine” from the repositories: “apt-get install redmine”. In Ubuntu, it is, but not always fresh.
I prefer to go through a more complicated installation path, but then, have a deeper understanding of my server.
I hope the article will be useful.