Project

General

Profile

Redmine Installation / Ruby on Rails and FCGI

Added by Klaus Friese over 4 years ago

Hi,

I made a new installation of redmine on a managed server, I don't have root access. Redmine installation seemed to work, I now have problem with the integration in the Apache with FCGI.

This is what I see in the documentation of my provider:
https://wiki.hetzner.de/index.php/Installation_g%C3%A4ngiger_Software_(Managed_Server)/en#Ruby_over_FCGI

ruby_handler.fcgi

#!/bin/dash
export GEM_HOME="$HOME/.gem/ruby/2.3.0/" 
export GEM_PATH="$GEM_HOME:/var/lib/ruby/gems/1.8" 
exec /usr/bin/ruby /usr/www/users/<FTP-USER>/<PROJECT-DIRECTORY>/index.rb

.htaccess

FcgidWrapper /usr/www/users/<FTP-USER>/ruby_handler.fcgi .rb
  SetHandler fcgid-script

Problem: I don't have a index.rb in redmine, the dispatcher in the redmine documentation is completely different. And at the moment I get an 404 error when I try the dispatcher and htaccess from the wiki (http://www.redmine.org/projects/redmine/wiki/Install_Redmine_34_on_RHEL74)

How can I get redmine working on my system?

Thanks for any tipps
Klaus


Replies (6)

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Jens Kabisch almost 2 years ago

Hello Mr. Friese,

I am having the same problems right now. Did you get redmine working at Hetzner?

regards
Jens

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Klaus Friese almost 2 years ago

Hi,

Finally our solution was switching to a dedicated server with full root access. We didn't manage to get redmine running on a managed server, too many restrictions.

Regards
Klaus

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Jens Kabisch almost 2 years ago

Good news. We got redmine (4.2.6) finally working on the managed server with fastcgi. The problem was that the RAILS_ENV was not set to production. So we have to edit/create two files in the public folder:

.htaccess:

Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly." 

And the dispatch.fcgi:

#!/usr/bin/env ruby

ENV['RAILS_ENV'] = 'production'

require File.dirname(__FILE__) + '/../config/boot'
require File.dirname(__FILE__) + '/../config/environment'

class Rack::PathInfoRewriter
  def initialize(app)
    @app = app
  end

  def call(env)
    env.delete('SCRIPT_NAME')
    parts = env['REQUEST_URI'].split('?')
    env['PATH_INFO'] = parts[0]
    env['QUERY_STRING'] = parts[1].to_s
    @app.call(env)
  end
end

Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(RedmineApp::Application)

regards
Jens

RE: Redmine Installation / Ruby on Rails and FCGI - Added by Markus B 11 months ago

Dear Jens,

we have been using Redmine on Hetzner Managed Server scince 2018. Last week I tried to log in for the first time scince Hetzner upgraded to Debian 11 in November 2022. Without success as you can imagine.
So i upgraded from Redmine 4.1 to Redmine 4.2.10 / Ruby 2.7. But now everything ends up with a 500 internal server error. Htaccess und dispatch.fcgi as you described it (and it was so for the last 3 years).
I figured out, that the bootup of redmine crashes after dispatch.fcgi -> boot.rb -> bundler/setup.rb on line "Bundler.ui.silence { Bundler.setup }". Unfortunately there is no log entry until that moment and I can not access the original Apache/Passenger/Whatever-Logfiles.

Does your Redmine installation still work on Debian 11 with Apache?

Best regards, Rüdiger

P.S. The Redmine 4.2.10 installation works on the shell with webrick and lynx ... I've spend already days on this topic, including phone calls with Hetzner Support ...

RE: Redmine Installation / Ruby on Rails and FCGI - Hetzner Managed Server - Added by Markus B 11 months ago

I could fix the problem. I had to edit following files:

###################################################################################################

./config/boot.rb

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', FILE)
require_relative '../.gem/ruby/2.7.0/gems/bundler-2.4.12/lib/bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

###################################################################################################

./.bundle/config

BUNDLE_PATH: "/usr/home/XYZ/public_html/redmine-4.2.10/.gem/"
BUNDLE_WITHOUT: "development:test:rmagick"

###################################################################################################

./public/dispatch.fcgi
#!/usr/bin/ruby -w

ENV['RAILS_ENV'] = 'production'
ENV['GEM_HOME'] = '/usr/home/XYZ/.gem/ruby/2.7.0/'
ENV['GEM_PATH'] = '/usr/home/XYZ.gem/ruby/2.7.0/
ENV['PATH'] = '/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/home/XYZ/.gem/ruby/2.7.0/bin'
...

ENVIRONMENT:
- Hetzner Managed Server
- Debian 11
- Ruby 2.7.4
- Redmine 4.2.10

Regards Rüdiger

    (1-6/6)