Difference between revisions of "Redmine"

From ArchWiki
Jump to: navigation, search
(Installation: Fix AUR installation style. See Help:Style.)
(Database Population)
Line 209: Line 209:
 
{{Warning|Generating a new secret token invalidates all existing sessions after restart.}}
 
{{Warning|Generating a new secret token invalidates all existing sessions after restart.}}
  
==Database Population==
+
==Database Structure Creation==
 
With the database created and the access configured for Redmine, now it's time to create the database structure. This is done by running the following command under the application root directory:
 
With the database created and the access configured for Redmine, now it's time to create the database structure. This is done by running the following command under the application root directory:
  
Line 216: Line 216:
  
 
These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.
 
These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.
 +
 +
==Database Population with Default Data==
 +
Now you may want to insert the default configuration data in database, like basic types of  task, task states, groups, etc. To do so execute the following:
 +
 +
# RAILS_ENV=production rake redmine:load_default_data
 +
 +
Redmine will prompt for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task:
 +
 +
# RAILS_ENV=production REDMINE_LANG=pt-BR rake redmine:load_default_data
 +
 +
{{Note|This step is not mandatory, but it certainly will save you a lot of work to start using Redmine. And for a first time it can be very instructive.
  
 
==Troubleshooting==
 
==Troubleshooting==

Revision as of 18:40, 15 March 2013

Summary help replacing me
This page gives guidelines for the installation and configuration of Redmine on Archlinux.
Related
Ruby on Rails
RVM
MariaDB

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: This wiki is under development, so it can contain errors or incomplete information. If you don't feel confident, please wait the wiki to be completed. (Discuss in Talk:Redmine#)


Redmine is a free and open source, web-based project management and bug-tracking tool. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. It handles multiple projects. Redmine provides integrated project management features, issue tracking, and support for various version control systems.

Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database.

Prerequisites

This document will guide you through the installation process of the Redmine and all of its prerequisites, including the optional ones. If desired, however, you may install Redmine and it's prerequisites separately, simply refering to the relevant sections below.

Although this guide will go through all the installation process, this isn't a one way path. So Redmine can use different versions of the other softwares (mariaDB, mySQL, postgreSQL, etc, as your database).

Note: At this time is important to note that this guide is an default suggestion, feel free to use other of the prerequisites mentioned on this wiki.

Ruby

Redmine version Supported Ruby versions Rails version used Supported RubyGems versions
2.2.3 ruby 1.8.7, 1.9.2, 1.9.3 Rails 3.2.12 RubyGems <= 1.8
jruby-1.6.7


There are two simple ways to install Ruby: installing the ruby package as described in ruby or installing RVM as described in RVM (recommended).

Note: If you use RVM, pay attention to the single and multiple user differences! If you are not creating a hosting service, the multiple user (available for all users on the machine) should be the choice for simpler debuging.

Database

MariaDB 5.0 or higher (recommended)

MariaDB is a drop-in replacement for MySQL, in fact it was a fork of it and maintain binarie compatibility.

To install mariadb simply refer to MariaDB.

And make sure to install the C bindings for Ruby that dramatically improve performance. You can get them by running:

# gem install mysql2

MySQL 5.0 or higher

To install mysql simply refer to MySQL.

And make sure to install the C bindings for Ruby that dramatically improve performance. You can get them by running:

# gem install mysql2

PostgreSQL 8.2 or higher

To install postgresql PostgreSQL simply refer to Postgresql.

Make sure your database datestyle is set to ISO (Postgresql default setting). You can set it using:

ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";
Note: Some bugs in PostgreSQL 8.4.0 and 8.4.1 affect Redmine behavior ([#4259], [#4314]), they are fixed in PostgreSQL 8.4.2

Microsoft SQL Server

Support is planned for 2.3.0 release (but is already available on trunk for early adopters).

SQLite 3

Not supported for multi-user production use. So, it will not be detailed how to install and configure it for use with Redmine.

Web Server

Phusion Passenger (recommended)

TODO

Apache

TODO

Mongrel

TODO

nginx

TODO

Apache Tomcat

TODO

Optional Prerequisites

SCM (Source Code Management)

TODO: list all scm supported and how to install them...

ImageMagick

TODO: to enable Gantt export to png image. link: http://www.imagemagick.org/

Ruby OpenID Library

TODO: to enable OpenID support (version 2 or greater is required). link: http://openidenabled.com/ruby-openid/

Installation

Build and Installation

Download the package redmineAUR from the AUR.

Note: Detailed build instructions at Arch User Repository#Build the package. It's HIGHLY recommended to read all the AUR page to understand what are you doing.

Gems Installation

Note: If you prefer, you can install all the gems as pacman packages. You have only to search for the gem package and install them as usual. As of using Ruby gem is simpler to mange and maintain up to date gems, this will be preferable and used as default bellow.

Redmine uses Bundler to manage gems dependencies. So, you need to install Bundler first:

# gem install bundler

Then you can install all the gems required by Redmine using the following command:

# cd /usr/share/webapps/redmine
# bundle install

To install without the ruby development and test environments use this instead of the last command:

# bundle install --without development test

To install only the gem of the database you are using (example, only using mariadb), use this command instead:

# bundle install --without development test postgresql sqlite
Note: You can include/exclude environments and databases using the above syntax.

Although it is highly recommend to enjoy all the features of Redmine, if you really does not want to use ImageMagick, you should skip the installation of the rmagick gem using:

# bundle install --without rmagick

Additional Gems

If you need to load gems that are not required by Redmine core (eg. Puma, fcgi), create a file named Gemfile.local at the root of your redmine directory. It will be loaded automatically when running bundle install:

# nano Gemfile.local
gem 'puma'

Database Configuration

Now, we will need to create the database that the Redmine will use to store your data. For now on, the database and its user will be named redmine. But this names can be changed to anything else.

Note: The configuration for MariaDB and MySQL will be the same since both are binary compatible.

To create the database, the user and set privileges (MariaDB and MySQL >= 5.0.2):

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';

For versions of MariaDB and MySQL prior to 5.0.2:

create database redmine character set utf8;
grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';

For PostgreSQL:

CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

Now you need to configure Redmine to access the database we just created. To do that you have to copy /usr/share/webapps/redmine/config/database.yml.example to database.yml:

# cd /usr/share/webapps/redmine/config
# cp database.yml.example database.yml

And then edit this file in order to configure your database settings for "production" environment (you can configure for the "development" and "test" environments too, just change the appropriate sections).

Example for MariaDB and MySQL database:

nano database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  port: 3307   #If your server is not running on the standard port (3306), set it here, otherwise this line is unnecessary.
  username: redmine
  password: my_password
Note: For ruby1.9 the "adapter" value must be set to mysql2, and for ruby1.8 or jruby, it must be set to mysql.

Example for PostgreSQL database:

nano database.yml
production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: my_password
  encoding: utf8
  schema_search_path: <database_schema> (default - public)

Session Store Secret Generation

Now you must generate a random key that will be used by Rails to encode cookies that stores session data thus preventing their tampering:

# rake generate_secret_token
Note: For Redmine prior to 2.x this step is done by executing # rake generate_session_store.
Warning: Generating a new secret token invalidates all existing sessions after restart.

Database Structure Creation

With the database created and the access configured for Redmine, now it's time to create the database structure. This is done by running the following command under the application root directory:

# cd /usr/share/webapps/redmine
# RAILS_ENV=production rake db:migrate

These command will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named admin.

Database Population with Default Data

Now you may want to insert the default configuration data in database, like basic types of task, task states, groups, etc. To do so execute the following:

# RAILS_ENV=production rake redmine:load_default_data

Redmine will prompt for the data set language that should be loaded; you can also define the REDMINE_LANG environment variable before running the command to a value which will be automatically and silently picked up by the task:

# RAILS_ENV=production REDMINE_LANG=pt-BR rake redmine:load_default_data

{{Note|This step is not mandatory, but it certainly will save you a lot of work to start using Redmine. And for a first time it can be very instructive.

Troubleshooting

User accounts

Add redmine user and append redmine2 to git group.

# useradd --user-group --shell /bin/bash --comment 'redmine2 system' --create-home --groups git redmine2

MySQL user and databases

Create redmine2 user in MySQL server.

# mysql -u root -p
CREATE USER 'redmine2'@'%' IDENTIFIED BY  'MY_PASSWORD';
GRANT USAGE ON *.* TO  'redmine2'@'%' IDENTIFIED BY  'MY_PASSWORD';
GRANT ALL PRIVILEGES ON  `redmine2\_%`.* TO 'redmine2'@'%';
create database redmine2 character set utf8;
create database redmine2_production character set utf8;
create database redmine2_development character set utf8;
create database redmine2_test character set utf8;


Install gems

This could take a while as it installs all required libraries.

# sudo -u redmine2 -H sh -c 'echo "export PATH=$(ruby -rubygems -e "puts Gem.user_dir")/bin:$PATH" >> /home/redmine2/.bash_profile'
# sudo -u redmine2 -H gem install bundler
# cd /home/redmine2/redmine-2.2
# source /home/redmine2/.bash_profile
# sudo -u redmine2 -H bundle install 
Note: In order to install ruby bundle, you may be need add user redmine2 for /etc/sudoers. Another option is to first do export GEM_HOME=/home/redmine2/.gem/.

Configure Redmine

Application Settings

Copy default configuration and adjust settings for your needs.

# cd /home/redmine2/redmine-2.2/config
# sudo -u redmine2 cp configuration.yml.example configuration.yml
# sudo -u redmine2 cp database.yml.example database.yml

Minimal configuration.yml

For rapid reference.

default:
  email_delivery:
    delivery_method: :sendmail

  attachments_storage_path:

  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure:

  scm_subversion_command:
  scm_mercurial_command:
  scm_git_command:
  scm_cvs_command:
  scm_bazaar_command:
  scm_darcs_command:

  database_cipher_key:

production:

development:

Minimal database.yml

For rapid reference. Remember to replace MY_PASSWORD for yours.

Note: Notice that adapter is mysql2 and not mysql.
production:
  adapter: mysql2
  database: redmine2_production
  host: localhost
  username: redmine2
  password: MY_PASSWORD
  encoding: utf8

development:
  adapter: mysql2
  database: redmine2_development
  host: localhost
  username: redmine2
  password: MY_PASSWORD
  encoding: utf8

test:
  adapter: mysql2
  database: redmine2_test
  host: localhost
  username: redmine2
  password: MY_PASSWORD
  encoding: utf8

Permissions

Set permissions for redmine directories.

# cd /home/redmine2/redmine-2.2
# mkdir -pv tmp tmp/pdf public/plugin/assets
# sudo chown -R redmine2:redmine2 files log tmp public/plugin/assets
# sudo chmod -R 755 files log tmp public/plugin/assets

Generate secret token

Generate new unique secret token

# sudo -u redmine2 rake generate_secret_token

Migrate/install database

Create/update database schemas

# sudo -u redmine2 RAILS_ENV=production rake db:migrate

Populate database with default data.

# sudo -u redmine2 RAILS_ENV=production rake redmine:load_default_data

Test server

Ruby on Rails embedded server

Using Ruby on Rails embedded server

# ruby script/rails server webrick -e production

Test it http://localhost:3000 Use login=admin and password=admin

Unicorn server

# sudo -u redmine2 unicorn -D -E production -c config/unicorn.rb

Start redmine on boot

Append follow command at end of your /etc/rc.local

# sudo -u redmine2 bash -c "source /home/redmine2/.bash_profile && cd /home/redmine2/redmine-2.2 && unicorn -D -E production -c config/unicorn.rb"

Resources