Why?
I wanted to install OpenProject 3.x to Debian Wheezy. This was not an easy task since Wheesys Ruby Packages are way too old. Additionally all the User-Guides I found were only partly helpful. The user guide provided by OpenProject was considering an installation with a separate user and not in an more hosting-aware production environment – even though the headline of the guide stated different.
Hence, here is my approach on an Debian Wheesy ISPConfig 3.x server environment.
Caviats
I assume that you are familiar with MySQL, Apache and other server stuff. I will not provide commands that are obvious to administrators.
Installation
The installation is separated into different parts. You can follow them step by step and end up with OpenProject running and having rails updated to Version 2.1.x.
Ruby 2.1.x
Install required packages:
apt-get install git curl build-essential libxslt1-dev libxml2-dev libmysql-ruby libmysqlclient-dev libpq-dev libsqlite3-dev libyaml-0-2 libmagickwand-dev libmagickcore-dev libmagickcore5-extra libgraphviz-dev libgvc5 libmysqlclient-dev libsqlite3-dev libpq-dev
Install Ruby:
curl -L https://get.rvm.io | bash -s stable --ruby=2.1
source /usr/local/rvm/scripts/rvm
rvm autolibs disable
Check Ruby version, should be 2.1.x:
ruby -v
Install bundler. this might fail a few times. Than you are missing to have the correct -dev libs:
gem install bundler
Apache Mod Passenger
Since we do not use the build-in Ruby Webserver, we need to use Apache mod_passenger. This module is present in Wheesy, but I did not trust it to work properly with OpenProject. If you have knowledge about it, I am happy to hear from you.
Install Gem of passenger
gem install passenger
Compile Passenger Module
passenger-install-apache2-module
At the end of the compiling process you will be presented with the configuration lines for Apache. Put them in the file /etc/apache2/mods-available/mypassenger.load:
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-4.0.48 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby </IfModule>
Enable Mod Passenger
a2enmod mypassenger /etc/init.d/apache2 restart
MySQL
You can use many different SQL server, but I chose the pre-existing MySQL already installed as a standard.
- Create a user
- Create a DB with uft-8 encoding (best for all environments). It is probably enough to create on for the production environment.
OpenProject
As mentioned, I use ISPConfig on my Server. OpenProject was supposed to run on the root of the domain. Since it is not that easy to protect all files and directories but a few in combination with the passenger Mod of Apache, I chose to install OpenProject in the path “private“. This way, it is not directly accessible from the docroot.
git clone https://github.com/opf/openproject.git cd openproject git checkout stable
Change the database setup (config/database.yml)
cp config/database.yml.example config/database.yml
production: adapter: mysql2 database: openproject host: localhost username: openproject password: openproject encoding: utf8 development: adapter: mysql2 database: openproject_dev host: localhost username: openproject password: openproject encoding: utf8 test: adapter: mysql2 database: openproject_test host: localhost username: openproject password: openproject encoding: utf8
Setup SMTP settings
cp config/configuration.yml.example config/configuration.yml
development: #email_delivery_method: :letter_opener email_delivery_method: :smtp # Configuration for the test environment test: email_delivery_method: :test # specific configuration options for production environment production: session_store: :cache_store email_delivery_method: "smtp" #setting for default smtp_address: "localhost" #setting for default smtp_port: 25 smtp_domain: YOURHOSTNAME #smtp_user_name: ***@gmail.com #smtp_password: **** #smtp_enable_starttls_auto: true #smtp_authentication: plain
You can use the following setting for better performance. I have not tested it in my setup:
rails_cache_store: :memcache
You can now add plugins. I will handle them in a sub-section.
Install all bundle that are necessary to OpenProject.
bundle pack bundle install --path vendor/cache
Run the following commands to prepare and setup OpenProject
bundle exec rake generate_secret_token
# Not necessary, we done it ourself: bundle exec rake db:create:all
RAILS_ENV="production" bundle exec rake db:migrate
RAILS_ENV="production" bundle exec rake db:seed
RAILS_ENV="production" bundle exec rake assets:precompile
If you installed the software as root, do not forget to change the permissions.
chown webXX.clientXX -R * chown webXX.clientXX -R .[a-z]*
Set a symbolic link from the website docroot to the public folder
cd ../../web ln -s ../private/openproject/public public chown -h webXX.clientXX public
Website
In the Apache configuration of the website you need to add the following lines
#PassengerRuby /usr/local/rvm/gems/ruby-2.1.2/wrappers/ruby PassengerAppRoot /var/www/WEBSITEPATH/private/openproject RailsEnv production RailsBaseURI /
Plugins
Plugins are not installed using the web interface. You need to add them by editing the file Gemfile.plugins in the OpenProject root.
The following plugins are very useful:
# Required for each plug-in gem "openproject-plugins", :git => "https://github.com/opf/openproject-plugins.git", :branch => "stable" # Help-linksgem 'openproject-help_link', :git => 'https://github.com/finnlabs/openproject-help_link.git', :branch => 'stable'# Translationsgem 'openproject-translations', :git => 'https://github.com/opf/openproject-translations.git', :branch => 'stable'# Allows add-in documents to projects#gem 'openproject-documents', :git => 'https://github.com/opf/openproject-documents.git', :branch => 'stable'gem 'openproject-translations', :path => './vendor/openproject-translations' # Meetingsgem 'openproject-meeting', :git => 'https://github.com/finnlabs/openproject-meeting.git', :branch => 'stable'# PDF export is useful and required by backlogs gem "openproject-pdf_export", git: "https://github.com/finnlabs/openproject-pdf_export.git", :branch => "stable" # backlogs gem "openproject-backlogs", git: "https://github.com/finnlabs/openproject-backlogs.git", :branch => "stable"
Be aware: The translations plugin currently has some issues (11/08/2014). Therefor you need to fetch it yourself and change the .gemspec file.
cd vendor git clone https://github.com/opf/openproject-translations.git
Change the following line (vendor/openproject-translations/openproject-translations.gemspec)
s.add_dependency "openproject-plugins", "~> 3.0"
❗ You always need to run the install command afterwards.
source /usr/local/rvm/scripts/rvm #bundle pack bundle install --path vendor/cache RAILS_ENV="production" bundle exec rake assets:precompile
Tips
Here I list a few tips for OpenProject, actually they are also concerning Ruby on Rails.
Clear on any change
Whenever you change a configuration or similar, you need to execute the following commands to make them active:
RAILS_ENV="production" bundle exec rake tmp:cache:clear RAILS_ENV="production" bundle exec rake tmp:sessions:clear RAILS_ENV="production" bundle exec rake db:sessions:clear
❗ You always have to restart the entire web server.