在Dreamhost共享主机上安装Redmine版本2.0.2

时间:2012-06-19 06:18:57

标签: ruby-on-rails ruby redmine dreamhost

我尝试了dreamhost documentation(适用于Redmine 1.x,最后一次编辑大约一年前)和redmine install documentation

我正在尝试安装我使用

删除的版本2.0.2
hg clone --updaterev 2.0-stable https://bitbucket.org/redmine/redmine-all

我使用rvm来获取Ruby 1.9.3的本地版本,以便安装适当的依赖项。在我到达必须在浏览器中加载它的最后一步之前,它似乎进展顺利。我从Passenger那里得到一个错误,说明应用程序无法启动。它写着:

  

应用程序已在启动期间退出(即在评估期间退出)   config / environment.rb)。可能已写入错误消息   Web服务器的日志文件。请检查Web服务器的日志文件   (即不是(Rails)应用程序的日志文件)找出原因   申请退出。如果这没有帮助,那么请使用   回溯下面来调试问题。

我在日志中找不到任何有用的东西(甚至找不到错误的地方 - 也许我在找错了地方?/home/username/logs/my.site.com/http

回溯看起来像是一个依赖性错误,但它看起来非常通用。

我用来安装正确宝石的命令是:(我使用mysql)

$ bundle install --without development test postgresql sqlite rmagick

在我的网络目录中运行bundle show给我这个:

~/my.site.com$ bundle show
Gems included by the bundle:
  * actionmailer (3.2.5)
  * actionpack (3.2.5)
  * activemodel (3.2.5)
  * activerecord (3.2.5)
  * activeresource (3.2.5)
  * activesupport (3.2.5)
  * arel (3.0.2)
  * builder (3.0.0)
  * bundler (1.1.4)
  * coderay (1.0.6)
  * erubis (2.7.0)
  * hike (1.2.1)
  * i18n (0.6.0)
  * journey (1.0.4)
  * json (1.7.3)
  * mail (2.4.4)
  * mime-types (1.18)
  * multi_json (1.3.6)
  * mysql2 (0.3.11)
  * net-ldap (0.3.1)
  * polyglot (0.3.3)
  * prototype-rails (3.2.1)
  * rack (1.4.1)
  * rack-cache (1.2)
  * rack-openid (1.3.1)
  * rack-ssl (1.3.2)
  * rack-test (0.6.1)
  * rails (3.2.5)
  * railties (3.2.5)
  * rake (0.9.2.2)
  * rdoc (3.12)
  * ruby-openid (2.1.8)
  * sprockets (2.1.3)
  * thor (0.15.2)
  * tilt (1.3.3)
  * treetop (1.4.10)
  * tzinfo (0.3.33)

以下是我的可执行版本:

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
$ rails -v
Rails 3.2.5
$ bundle -v
Bundler version 1.1.4
$ gem -v
1.8.24

任何帮助都将不胜感激。

编辑: 这是回溯。

#   File    Line    Location
0   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb  10  in `exit'
1   /usr/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/setup.rb  10  
2   /usr/lib/ruby/1.8/rubygems/custom_require.rb    36  in `gem_original_require'
3   /usr/lib/ruby/1.8/rubygems/custom_require.rb    36  in `require'
4   /home/username/site.com/config/boot.rb  6   
5   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
6   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
7   /home/username/site.com/config/application.rb   1   
8   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
9   /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
10  /home/username/site.com/config/environment.rb   2   
11  /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `gem_original_require'
12  /usr/lib/ruby/1.8/rubygems/custom_require.rb    31  in `require'
13  config.ru   3   
14  /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb  46  in `instance_eval'
15  /usr/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/builder.rb  46  in `initialize'
16  config.ru   1   in `new'
17  config.ru

1 个答案:

答案 0 :(得分:1)

尝试使用系统的ruby 1.8而不是使用rvm和ruby 1.9。

不要在Dreamhost上使用乘客。 Dreamhost的乘客是旧的(v2.2.9),只会加载旧版本的机架,并会随机擦除环境变量,导致您的网站偶尔无法加载。

请改用FCGI。将fcgi gem添加到您的Gemfile

gem "fcgi"

dispatch.fcgi创建~/foo.yourdomain.com/public/dispatch.fcgi文件:

#!/usr/bin/env ruby

# Set necessary environment variables
ENV['HOME'] ||= `echo ~`.strip
ENV['GEM_HOME'] = File.expand_path('~/.gems')
ENV['GEM_PATH'] = File.expand_path('~/.gems') + ":" + '/usr/lib/ruby/gems/1.8'

#require File.dirname(__FILE__) + '/../config/boot'
#require File.dirname(__FILE__) + '/../config/environment'
require '/home/user/programs/redmine-2.0.3/config/boot'
require '/home/user/programs/redmine-2.0.3/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)

要重新启动您的应用,您必须手动终止dispatch.fcgi进程,否则您的更改将不会产生任何影响

pkill dispatch.fcgi