Difference between revisions of "Redmine"

From Blue-IT.org Wiki

(Install Ruby, Rails and Redmine with rvm)
(Troubeshooting)
Line 483: Line 483:
  
 
= Troubeshooting =
 
= Troubeshooting =
 +
== Website won't come up ==
 +
Look at your apache logfile:
 +
tail -f /var/log/apache2/error.log
 +
 +
In my case I copied over the databae.yml, but did not pay attention to the rights:
 +
[!] There was an error parsing `Gemfile`: Permission denied @ rb_sysopen - /srv/www/projects.blue-it.org/config/database.yml. Bundler cannot continue.
 +
 +
chmod 644 /srv/www/redmine/config.yml
 +
 +
Thats it ...
 +
 
== Gemfile.lock - Site won't start ==
 
== Gemfile.lock - Site won't start ==
  

Revision as of 18:20, 25 October 2015

Redmine 2.x and Ubuntu 14.04

Install Ruby, Rails and Redmine with rvm

After having a lot of problems installing ruby and switching between versions, I decided to go with rvm:

I followd the instructions here:

Other helpful sites are:

Then I followed the installation instructions for installing redmine here from RedmineCRM but for apache2 and an actual version of redmine

Install the passenger gem. This might take up a lot of swap. So you should probably add a swapfile first!:

#> gem install passenger --no-ri --no-rdoc

The compilation script for the apache2 module tells you for everything you need to do (installing additional devs, the lines for the apache configuration file ...:

#> passenger-install-apache2-module

Add the corresponding lines from the compilation script output in your virtual server file:

  LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.21/buildout/apache2/mod_passenger.so
  <IfModule mod_passenger.c>
    PassengerRoot /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.21
    PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.3/wrappers/ruby
  </IfModule>

Then I altered the section for ruby at the beginning of my virtualhosts file to point to the right gems directory:

SetEnv GEM_HOME /usr/local/rvm/gems/ruby-2.2.3/

I installed the latest redmine version:

#> cd /srv/www
#> svn co http://svn.redmine.org/redmine/branches/3.1-stable redmine

Install all necessary dev-packages for compiling your database connection and e.g. rmagick (see later sections):

Now install configure the database.yml and then change to your redmine directory

#> cd /srv/www/redmine
#> bundle install

Migrate your database:

Install Ruby, Rails and Redmine the Ubuntu way (debs)

(Credits goto an excerpt from https://gist.github.com/subchen/9a78c399ec150544ac4d / THANKS)

[...]

see http://brightbox.com/docs/ruby/ubuntu/

ruby 1.9.3

sudo apt-get install ruby
sudo apt-get install ruby-dev # THIS IS IMPORTANT FOR SOME GEMS TO INSTALL !!!

ruby 2.1

sudo apt-get install python-software-properties
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.1 
sudo apt-get install ruby2.1-dev # THIS IS IMPORTANT FOR SOME GEMS TO INSTALL !!!

switch to 2.1

sudo update-alternatives --remove ruby /usr/bin/ruby2.1
sudo update-alternatives --remove irb /usr/bin/irb2.1
sudo update-alternatives --remove gem /usr/bin/gem2.1

OR (check your version of ruby, rdoc and gem!)

sudo update-alternatives --remove ruby /usr/bin/ruby1.9.1
sudo update-alternatives --remove ruby /usr/bin/rdoc1.9.1
sudo update-alternatives --remove gem /usr/bin/gem1.9.1

Then update the alternatives to ruby 2.1

sudo update-alternatives \
     --install /usr/bin/ruby ruby /usr/bin/ruby2.1 50 \
     --slave /usr/bin/irb irb /usr/bin/irb2.1 \
     --slave /usr/bin/rake rake /usr/bin/rake2.1 \
     --slave /usr/bin/gem gem /usr/bin/gem2.1 \
     --slave /usr/bin/rdoc rdoc /usr/bin/rdoc2.1 \
     --slave /usr/bin/testrb testrb /usr/bin/testrb2.1 \
     --slave /usr/bin/erb erb /usr/bin/erb2.1 \
     --slave /usr/bin/ri ri /usr/bin/ri2.1
update-alternatives --config ruby
update-alternatives --display ruby

[...]

If something goes wrong with your ruby version you can manually set the links for ruby:

ln -s /usr/bin/ruby2.1 /usr/bin/ruby
ln -s /usr/bin/irb2.1 /usr/bin/irb
ln -s /usr/bin/rake2.1  /usr/bin/rake
ln -s /usr/bin/gem2.1  /usr/bin/gem
ln -s /usr/bin/rdoc2.1  /usr/bin/rdoc
ln -s /usr/bin/testrb2.1  /usr/bin/testrb
ln -s /usr/bin/erb2.1  /usr/bin/erb
ln -s /usr/bin/ri2.1  /usr/bin/ri

Update your apache config

The virtual host file must point to the right ruby version:

see: Apache_2.4

Update and install your bundle

Then update and install your libs necessary to run redmine - this will update and install all neccesary dependencies:

sudo cd /usr/share/redmine

This is alway necessary if you switch to a new ruby version!:

sudo gem install bundler

Install all your bundles:

sudo bundle install


This might give you some faults, you have to resolve and google for!

e.g. an error for the rmagick gem, after googling I resolved that with:

apt-get install libmagickwand-dev

Then again to check, if everything is in place:

vim Gemfile.local

[...]
gem 'rmagick'
sudo bundle install

Probably you need to manually create a local Gemfile (see next section about Postgresql).

Postgres

If you are using postgresql for database server:

Install development files (gcc is needed for compiling pg) :

apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool

On a 64bit environment there could be come the following error:

/usr/include/ruby-2.0.0/ruby/ruby.h:24:25: fatal error: ruby/config.h: No such file or directory

Then you have to symlink the library path this way:

mkdir /usr/include/i386-linux-gnu/
ln -s /usr/include/ruby-2.0.0 /usr/include/i386-linux-gnu/ruby-2.0.0


Install the Postgres PPA for the development files:

http://www.postgresql.org/download/linux/ubuntu/

And the development files for your installed postgresql version:

apt-get install postgresql-server-dev-PG_VERSION
# e.g.: postgresql-server-dev-9.3
apt-get install libdbd-pg-ruby
apt-get install ruby2.0-dev:i386

Create a local Gemfile:

cd /usr/share/redmine
vim Gemfile.local

# Gemfile.local
gem 'activerecord-postgresql-adapter'
gem 'pg'

Then the add the following gems

cd /usr/share/redmine
gem install pg
gem install activerecord-postgresql-adapter
bundle install

Apache 2.4

In your virtual hosts section include this:


[...] 

ServerAlias projects.yourserver.com

#  If you updated to ruby 2.1.0 - also for others!
SetEnv GEM_HOME /usr/lib/ruby/gems/2.1.0
DocumentRoot /usr/share/redmine/public
 <Directory /usr/share/redmine/public>
   Options -MultiViews
   AllowOverride All
   Require all granted
</Directory>
 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn
 CustomLog /var/log/apache2/access.log combined
 ErrorLog /var/log/apache2/error.log
 ServerSignature Off

 [...]

Redmine 2.x and Ubuntu 12.04

Man problems mentioned are solved using a recent version of redmine.

Together with [Zentyal] you can use [LDAP] to authenticate users of a Samba4 domain.

[ UPDATE --Apos (talk) 15:54, 16 September 2015 (CEST) ] Do not use this ppa with Ubuntu 14.04 LTS because it updates Redmine from the stable 2.4.2 version to the 2.5.x which - my case - produced trouble, trouble, trouble.

Use the ppa for redmine on ubuntu 12.04 LTS:

Then use this guide:

Plugins

  1. Create the directory /usr/share/redmine/plugins
  2. Put plugins into this directory
  3. run the as explaned in http://www.redmine.org/projects/redmine/wiki/Plugins
rake redmine:plugins:migrate RAILS_ENV=production

LDAP with Zentyal

--Apos (talk) 10:27, 2 November 2013 (CET)

>>> See LDAP with Zentyal 3.2.

Redmine 1.x on Debian Squeeze (6.x)

Redmine Bugs

width of attached images

vim ./public/stylesheets/application.css +740
#content .wiki img {
           max-width: 98%;
}

Possible other solutions:

Fixing a bug using svn

vim /usr/share/redmine/lib/redmine/scm/adapters/subversion_adapter.rb
# SVN executable name
-        SVN_BIN = "svn"
+        SVN_BIN = "/usr/bin/svn"

Installation mit Postgresql und Apache2 mod_passenger

Prerequisites:

  • postgresql server (8.4) installation
  • apache2 with virtual hosts

Debian will configure database and permissions automatically! Be prepared to have an database password for postgres handy.

Redmine 1.1.x

apt-get install redmine redmine-pgsql ruby-git libapache2-mod-passenger librmagick-ruby

Update to the most recent version

aptitude -t squeeze-backports install redmine

Redmine 1.3.x

Or via testing:

root@server:~#  vim /etc/apt/sources.list.d/testing.list
deb http://yourmirror/debian/mirror/ testing main non-free contrib
deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free

and

root@server:~# vim /etc/apt/preferences.d/pinning 
Package: *
Pin: release n=squeeze
Pin-Priority: 900

Package: *
Pin: release a=testing
Pin-Priority: 80

then

root@server:~# apt-get update &&  aptitude -t testing install redmine redmine-pgsql ruby-git libapache2-mod-passenger librmagick-ruby


Trouble after install

Error with bundler

cd /usr/share/redmine
gem install bundler

Error with Gemfile.lock

Create the file:

cd /usr/share/redmine
touch Gemfile.lock
chmod 664 Gemfile.lock

And fill it with:

GEM
 remote: https://rubygems.org/
 specs:

PLATFORMS
 ruby

DEPENDENCIES

Anyway

Alter permissions.

This is NOT necessary in ubuntu 12.04 and redmine 2.x.

cd /usr/share/redmine/
mkdir files
chown -R www-data:www-data public
chown -R www-data:www-data files
chmod 777 files

Apache virtual host

SERVERIP="1.2.3.4"
MAIL="webmaster@mydomain.com"
DOMAIN="projects.example.com"
DOCPATH="/usr/share/redmine/public"
SSLPATH="/var/customers/ssl"
CUSTOMER="companyname"
CHAINFILE="/where/is/ssl/CAcert_chain.pem"

cat << EOF > ${DOMAIN}.conf
<VirtualHost ${SERVERIP}:443>
  ServerAdmin webmaster@${DOMAIN}
  ServerName  www.${DOMAIN}
  ServerAlias ${DOMAIN}

  DocumentRoot ${DOCPATH}
  <Directory ${DOCPATH}>
    Options -MultiViews
    allow from all
  </Directory>
  # Possible values include: debug, info, notice, warn, error, crit,
  # alert, emerg.
  LogLevel warn

  CustomLog /var/log/apache2/access.log combined
  ErrorLog /var/log/apache2/error.log

  ServerSignature Off

  SSLEngine on
  SSLCertificateFile ${SSLPATH}/${CUSTOMER}/${DOMAIN}.cert
  SSLCertificateKeyFile ${SSLPATH}/${CUSTOMER}/${DOMAIN}.key
  SSLCertificateChainFile ${CHAINFILE}

</VirtualHost>
EOF

Dealing with Plugins

Mylyn Connector for Eclipse and Redmine Plugin

1. Install the Redmine Mylin Connector using the update site:

http://redmin-mylyncon.sourceforge.net/update-site/N/ 

2. Install the Redmine Plugin

cd /usr/share/redmine
ruby script/plugin install git://redmin-mylyncon.git.sourceforge.net/gitroot/redmin-mylyncon/redmine-mylyn-connector
# Update
# ruby script/plugin install --force git://redmin-mylyncon.git.sourceforge.net/gitroot/redmin-mylyncon/redmine-mylyn-connector

Timesheet Extension

Download the files (searching the „Downloads“ link) onto the server with

links2 https://github.com/nicStuff/redmine_timesheet_extensions

AFTER installation of plugins

Update the database

cd /usr/share/redmine
rake db:migrate_plugins RAILS_ENV=production

If you have problems use

rake db:migrate_plugins RAILS_ENV=production --trace

Some Basic Plugins

RedmineCRM - open source and commercial plugins

This are absolute MUST-HAVE plugins which are partly free, all open source (!!!) and very pricy, when you will decide to buy some of them.

Support them, they give a lot back to the community through their development of free plugins!

This includes e.g.:

  • Contacts (CRM)
  • Finance (Invoices, Expenses)
  • Nice Themes
  • ...

Not pitfalls, no high prices, no contracts:

All commercial Plugins from easyredmine

Working for a company? Looking for a bigger scope? Probably for more than a couple of employees?

(If you are a stand alone man or woman, better stay with RedmineCRM - its much cheeper ...)

Attach Screenshot (2.x)

For Redmine 2.x (requires java 1.6++ on the client side!)

[UPDATE] Apos 12:28, 16 February 2014 (CET)

There are some problems with the new Java 1.7 security.

See my post from 2014-02-06 hoo to solve this by creating a special subfolder an link to the assets-folder and editing the security setting of java on your client computer:

The files can be loaded here - for easier working:

Close Button

* http://www.redmine.org/plugins/redmine_close_button

Ultraviolet Syntax Highlighting

* http://www.redmine.org/plugins/redmine_ultraviolet

DocPu, Document publishing plugin

* http://www.redmine.org/plugins/redmine_doc_pu

Requires:

gem install RedCloth
apt-get install tetex-base texlive-latex-extra

Hudson

* http://www.redmine.org/plugins/t-ando_redmine_hudson

Startpage (1.2.x)

* http://www.redmine.org/plugins/redmine_startpage

Books (1.2.x)

* http://www.redmine.org/plugins/redmine_wiki_books

Wiki Extensions (1.2.x)

* http://www.r-labs.org/projects/r-labs/wiki/Wiki_Extensions_en

SVN integration and https

See SVN integration with apache and https


Troubeshooting

Website won't come up

Look at your apache logfile:

tail -f /var/log/apache2/error.log

In my case I copied over the databae.yml, but did not pay attention to the rights:

[!] There was an error parsing `Gemfile`: Permission denied @ rb_sysopen - /srv/www/projects.blue-it.org/config/database.yml. Bundler cannot continue.
chmod 644 /srv/www/redmine/config.yml

Thats it ...

Gemfile.lock - Site won't start

Accessing the Webpage you will get:

There was an error while trying to write to Gemfile.lock. It is likely that 
you need to allow write permissions for the file at path: 

Solution:

sudo apt-get install bundler #Installs ruby-dev, which is ruby1.9-dev
sudo touch /usr/share/redmine/Gemfile.lock
sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock

dpkg-reconfigure redmine witch cache cleaning

dpkg-reconfigure -plow redmine

Migration of plugins

New in 2.0.0 the plugins/engines is removed in 2.0.0.

rake redmine:plugins:migrate RAILS_ENV=production --trace
rake db:migrate_plugins RAILS_ENV=production --trace

Mysql

If you get an error like

No such file or directory - connect(2) for /tmp/mysql.sock (Errno::ENOENT)

Or

database configuration specifies nonexistent mysql adapter (ActiveRecord::AdapterNotFound)

it is likely that your mysl connection cannot be established due to a gem error:

Install the development files for mysql

apt-get install libmysqlclient-dev

Uninstall any old mysql gems:

gem uninstall ruby-mysql
gem uninstall mysql
gem uninstall activerecord-mysql-adapter

Use the new mysql2 adapter:

gem install mysql2

and remove the lines from your Gemfile.local

Wrong version of active...

If using Redmine 2.x and

bundle show | grep active 

shows

activemodel 4.2.1

then you have to downgrade these:

vim Gemfile.local 

gem 'activerecord-mysql-adapter'
gem 'activemodel', '3.2.15'
gem 'actionpack', '3.2.15'
gem 'activesupport', '3.2.15'
gem 'ruby-mysql'

and e.g.

bundle update activemodel


Error:

gem install activemodel -v 3.2.14
gem install actionpack -v 3.2.14
gem install activeresource -v 3.2.14