{"id":1692,"date":"2014-01-06T15:34:28","date_gmt":"2014-01-06T13:34:28","guid":{"rendered":"http:\/\/raftaman.net\/?p=1692"},"modified":"2021-05-15T11:46:37","modified_gmt":"2021-05-15T09:46:37","slug":"installing-openproject-3-0-on-fedora-20","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=1692","title":{"rendered":"Installing OpenProject 3.0 on Fedora 20"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.openproject.org\/\">OpenProject<\/a> is an open source project management software. It&#8217;s a web-based system that runs in your browser and is built on <a href=\"http:\/\/rubyonrails.org\/\">Ruby on Rails<\/a>. What makes it really worth-wile is a wide set of features and plugins and a very active and always helpful community.<br \/>\n<!--more--><\/p>\n<h2>0. Installation prerequisites<\/h2>\n<p>To run OpenProject, you&#8217;ll need a working <strong>Database<\/strong> (either MySQL 5.x or PostgreSQL 8.x) and a method of <strong>deploying a Ruby on Rails<\/strong> application. For example, this could be <a href=\"http:\/\/nginx.org\/\">nginx<\/a>, an <a href=\"http:\/\/httpd.apache.org\/\">Apache<\/a> server or the small web server named WEBrick that comes with Ruby. In this example, we&#8217;ll use Apache with <a href=\"https:\/\/www.phusionpassenger.com\/\">Phusion Passenger<\/a> and a MySQL database.<\/p>\n<p>So here&#8217;s a one-liner to install all required packages at once:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# yum install git mariadb-server httpd rubygem-bundler ruby-devel gcc \\\r\nlibxml2-devel libxslt-devel gcc-c++ mariadb-devel ruby-RMagick \\\r\nImageMagick-devel sqlite-devel libcurl-devel httpd-devel apr-devel \\\r\napr-util-devel\r\n<\/pre>\n<h2>1. Setting up the database<\/h2>\n<p>Let&#8217;s create a new database user called <code>openproject<\/code> and grant him all privileges on a new database also called <code>openproject<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ mysql --user=root --password\r\nEnter password: \r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 11\r\nServer version: 5.5.34-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2013, Oracle, Monty Program Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB &#x5B;(none)]&gt; CREATE USER 'openproject'@'localhost' IDENTIFIED BY 'password';\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\nMariaDB &#x5B;(none)]&gt; CREATE SCHEMA openproject CHARACTER SET utf8;\r\nQuery OK, 1 row affected (0.00 sec)\r\n\r\nMariaDB &#x5B;(none)]&gt; GRANT ALL PRIVILEGES ON openproject.* TO 'openproject'@'localhost';\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\nMariaDB &#x5B;(none)]&gt; FLUSH PRIVILEGES;\r\nQuery OK, 0 rows affected (0.00 sec)\r\n\r\nMariaDB &#x5B;(none)]&gt; quit\r\nBye\r\n<\/pre>\n<h2>2. Install and configure OpenProject<\/h2>\n<h2>Clone the OpenProject repository<\/h2>\n<p>Since OpenProject 3.0 is still in development, there&#8217;s no release tarball yet. We have to clone the git repository instead:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cd \/var\/www\/html\/\r\n# git clone https:\/\/github.com\/opf\/openproject.git\r\n   Cloning into 'openproject'...\r\n   remote: Reusing existing pack: 114407, done.\r\n   remote: Counting objects: 404, done.\r\n   remote: Compressing objects: 100% (268\/268), done.\r\n   remote: Total 114811 (delta 208), reused 315 (delta 119)\r\n   Receiving objects: 100% (114811\/114811), 34.69 MiB | 3.57 MiB\/s, done.\r\n   Resolving deltas: 100% (81636\/81636), done.\r\n   Checking connectivity... done\r\n# cd openproject\/\r\n<\/pre>\n<h2>Install gems<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cd \/var\/www\/html\/openproject\r\n# bundle install --without postgres\r\n<\/pre>\n<h2>Configure config\/database.yml<\/h2>\n<p>There&#8217;s a sample configuration file at <code>config\/database.yml.example<\/code> we can use. Simply make a copy and change the username and password:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cp config\/database.yml.example config\/database.yml\r\n<\/pre>\n<p>Open <code>config\/database.yml<\/code> with you favourite editor and change username and password:<\/p>\n<pre class=\"brush: plain; highlight: [6,7]; title: \/var\/www\/html\/openproject\/config\/database.yml; notranslate\" title=\"\/var\/www\/html\/openproject\/config\/database.yml\">\r\n&#x5B;...]\r\nproduction:\r\n  adapter: mysql2\r\n  database: openproject\r\n  host: localhost\r\n  username: openproject\r\n  password: password\r\n  encoding: utf8\r\n&#x5B;...]\r\n<\/pre>\n<h2>Configure config\/configuration.yml<\/h2>\n<p>Again, there&#8217;s a samle in the config folder.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cp config\/configuration.yml.example config\/configuration.yml\r\n<\/pre>\n<p>You don&#8217;t really have to make any changes to the sample configuration file but you might want to look into the section, that&#8217;s labelled <code>Outgoing emails configuration<\/code> to configure your smtp server for email notifications.<\/p>\n<p><strong>Optional:<\/strong><br \/>\nIt&#8217;s usually a good idea to enable <a href=\"http:\/\/memcached.org\/\">memchache<\/a>. Open the <code>config\/configuration.yml<\/code> and uncomment the <code>memcache<\/code> option.<\/p>\n<pre class=\"brush: plain; highlight: [3]; title: \/var\/www\/html\/openproject\/config\/configuration.yml; notranslate\" title=\"\/var\/www\/html\/openproject\/config\/configuration.yml\">\r\n&#x5B;...]\r\n  # use memcache for performance, memcached must be installed\r\n  rails_cache_store: :memcache\r\n&#x5B;...]\r\n<\/pre>\n<p>To install and enable <code>memcached<\/code> run<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# yum -y install memcached\r\n# systemctl enable memcached.service \r\nln -s '\/usr\/lib\/systemd\/system\/memcached.service' '\/etc\/systemd\/system\/multi-user.target.wants\/memcached.service'\r\n# systemctl start memcached.service\r\n<\/pre>\n<h2>Run database migrations and seeds<\/h2>\n<p>This will create the default database structure and create some initial data, like an admin user:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n$ RAILS_ENV=&quot;production&quot; bundle exec rake db:migrate db:seed\r\n&#x5B;...]\r\n<\/pre>\n<h2>Generate a secret token for the session store<\/h2>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# RAILS_ENV=&quot;production&quot; bundle exec rake generate_secret_token\r\nrequire 'rails\/all'... 0.750s\r\nBundler.require... 2.040s\r\n<\/pre>\n<h2>Precompile assets<\/h2>\n<p>Because Rails usually reloads most of the OpenProject codebase at every request and compiles the corresponding asset, page requests are answered very slowly in the development environment. In a production environment though, we can precompile all assets since the codebase rarely changes, which will speed up page requests significantly:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# RAILS_ENV=&quot;production&quot; bundle exec rake assets:precompile\r\n&#x5B;...]\r\n<\/pre>\n<h2>3. Deploy<\/h2>\n<p>Just a quick note: If you want to deply OpenProject via WEBrick you&#8217;ll have to enable Rails&#8217;s own static asset server, since this would normally be done by Apache or ngix<\/p>\n<pre class=\"brush: plain; highlight: [3]; title: \/var\/www\/html\/openproject\/config\/environments\/production.rb; notranslate\" title=\"\/var\/www\/html\/openproject\/config\/environments\/production.rb\">\r\n&#x5B;...]\r\n  # Disable Rails's static asset server (Apache or nginx will already do this)\r\n  config.serve_static_assets = true\r\n&#x5B;...]\r\n<\/pre>\n<p>If you deploy OpenProject via Apache or ngix, leave the static asset server disable (<code>config.serve_static_assets = false<\/code>).<\/p>\n<p>To start WEBrick, run<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# RAILS_ENV=&quot;production&quot; rails s\r\nrequire 'rails\/all'... 0.690s\r\nBundler.require... 2.140s\r\n=&gt; Booting Thin\r\n=&gt; Rails 3.2.16 application starting in production on http:\/\/0.0.0.0:3000\r\n=&gt; Call with -d to detach\r\n=&gt; Ctrl-C to shutdown server\r\n8.170s\r\n&gt;&gt; Thin web server (v1.5.1 codename Straight Razor)\r\n&gt;&gt; Maximum connections set to 1024\r\n&gt;&gt; Listening on 0.0.0.0:3000, CTRL+C to stop\r\n<\/pre>\n<h2>Deploying with Phusion Passenger<\/h2>\n<p>First, install the <strong>passenger<\/strong> gem:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# cd \/var\/www\/html\/openproject\r\n# gem install passenger\r\nFetching: daemon_controller-1.1.8.gem (100%)\r\nSuccessfully installed daemon_controller-1.1.8\r\nFetching: passenger-4.0.33.gem (100%)\r\nBuilding native extensions.  This could take a while...\r\nSuccessfully installed passenger-4.0.33\r\nParsing documentation for daemon_controller-1.1.8\r\nInstalling ri documentation for daemon_controller-1.1.8\r\nParsing documentation for passenger-4.0.33\r\nInstalling ri documentation for passenger-4.0.33\r\nDone installing documentation for daemon_controller, passenger after 27 seconds\r\n2 gems installed\r\n<\/pre>\n<p>After that&#8217;s done, run the <strong><code>passenger-install-apache2-module<\/code><\/strong> script, which will compile the passenger module.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# passenger-install-apache2-module\r\n&#x5B;...]\r\n<\/pre>\n<h2>Configure Apache<\/h2>\n<p>After the compilation is done, the script even tells us, how to install <strong><code>mod_passenger<\/code><\/strong> and how to set up the apache vhost:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n&#x5B;...]\r\nThe Apache 2 module was successfully installed.\r\n\r\nPlease edit your Apache configuration file, and add these lines:\r\n\r\n   LoadModule passenger_module \/usr\/local\/share\/gems\/gems\/passenger-4.0.33\/buildout\/apache2\/mod_passenger.so\r\n   PassengerRoot \/usr\/local\/share\/gems\/gems\/passenger-4.0.33\r\n   PassengerDefaultRuby \/usr\/bin\/ruby\r\n\r\nAfter you restart Apache, you are ready to deploy any number of web\r\napplications on Apache, with a minimum amount of configuration!\r\n\r\nPress ENTER to continue.\r\n\r\n\r\n--------------------------------------------\r\n\r\nDeploying a web application: an example\r\n\r\nSuppose you have a web application in \/somewhere. Add a virtual host to your\r\nApache configuration file and set its DocumentRoot to \/somewhere\/public:\r\n\r\n   &lt;VirtualHost *:80&gt;\r\n      ServerName www.yourhost.com\r\n      # !!! Be sure to point DocumentRoot to 'public'!\r\n      DocumentRoot \/somewhere\/public    \r\n      &lt;Directory \/somewhere\/public&gt;\r\n         # This relaxes Apache security settings.\r\n         AllowOverride all\r\n         # MultiViews must be turned off.\r\n         Options -MultiViews\r\n      &lt;\/Directory&gt;\r\n   &lt;\/VirtualHost&gt;\r\n\r\nAnd that's it! You may also want to check the Users Guide for security and\r\noptimization tips, troubleshooting and other useful information:\r\n\r\n  \/usr\/local\/share\/gems\/gems\/passenger-4.0.33\/doc\/Users guide Apache.html\r\n  http:\/\/www.modrails.com\/documentation\/Users%20guide%20Apache.html\r\n\r\nEnjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)\r\nhttps:\/\/www.phusionpassenger.com\r\n\r\nPhusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.\r\n<\/pre>\n<p>To install <code>mod_passenger<\/code> we create a file called <code>\/etc\/httpd\/conf.modules.d\/passenger.conf<\/code> with the following content:<\/p>\n<pre class=\"brush: plain; title: \/etc\/httpd\/conf.modules.d\/passenger.conf; notranslate\" title=\"\/etc\/httpd\/conf.modules.d\/passenger.conf\">\r\n   LoadModule passenger_module \/usr\/local\/share\/gems\/gems\/passenger-4.0.33\/buildout\/apache2\/mod_passenger.so\r\n   PassengerRoot \/usr\/local\/share\/gems\/gems\/passenger-4.0.33\r\n   PassengerDefaultRuby \/usr\/bin\/ruby\r\n<\/pre>\n<p>Before starting up Apache, we need a vhost for OpenProject<\/p>\n<pre class=\"brush: plain; title: \/etc\/httpd\/conf.d\/openproject.conf; notranslate\" title=\"\/etc\/httpd\/conf.d\/openproject.conf\">\r\n&lt;VirtualHost *:80&gt;\r\n    ServerName OpenProject\r\n    DocumentRoot \/var\/www\/html\/openproject\/public\r\n    RailsEnv production\r\n    PassengerDefaultUser root\r\n    &lt;Directory \/var\/www\/html\/openproject\/public&gt;\r\n       # This relaxes Apache security settings.\r\n       AllowOverride all\r\n       # MultiViews must be turned off.\r\n       Options -MultiViews\r\n    &lt;\/Directory&gt;\r\n&lt;\/VirtualHost&gt;\r\n<\/pre>\n<p>Start up Apache and point your webbrowser to <a href=\"http:\/\/OpenProject\">http:\/\/OpenProject<\/a>. <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# systemctl enable httpd.service \r\nln -s '\/usr\/lib\/systemd\/system\/httpd.service' '\/etc\/systemd\/system\/multi-user.target.wants\/httpd.service'\r\n# systemctl start httpd.service\r\n<\/pre>\n<p>The Default administrator account is<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nLogin: admin\r\nPassword: admin\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>OpenProject is an open source project management software. It&#8217;s a web-based system that runs in your browser and is built on Ruby on Rails. What makes it really worth-wile is a wide set of features and plugins and a very active and always helpful community.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7,65],"class_list":["post-1692","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-fedora","tag-ruby"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1692","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1692"}],"version-history":[{"count":24,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1692\/revisions"}],"predecessor-version":[{"id":1772,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/1692\/revisions\/1772"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}