托管帮助 - DreamHost 上的自定义 Gems

发布于 2024-08-04 18:31:04 字数 1486 浏览 6 评论 0原文

我正在尝试使用 Passenger 将 RoR 应用程序部署到我的 DreamHost 托管帐户上,但在启动和运行它时遇到问题。

我的应用程序需要两个自定义 gem“amazon-ecs”和“nokogiri”。根据 DreamHost wiki (http://wiki.dreamhost.com/Freezing_Gems) 上的说明,我通过将 gems 编码到我的配置文件(config.gem“nokogiri”)中将它们冻结到供应商,然后使用 rake gems:unpack 命令将它们构建到供应商中。

然后我使用 rakerails:freeze:gems 冻结了 Rails Gems,并将其上传到我的子域。

我的回溯的最后七行如下:

0   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   336     in `abort'
1   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   336     in `check_gem_dependencies'
2   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   170     in `process'
3   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   113     in `send'
4   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   113     in `run'
5   ./config/environment.rb     9   
6   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb     31  in `gem_original_require'
7   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb     31  in `require'

我的配置文件如下所示:

RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
config.gem "nokogiri"
config.gem "amazon-ecs"
config.time_zone = 'UTC'
end

我错过了宝石的步骤吗?我走在正确的轨道上吗?

I am attempting to deploy a RoR app using Passenger onto my DreamHost hosting account, but am having trouble getting it up and running.

My application requires two custom gems 'amazon-ecs' and 'nokogiri.' As per the instructions on the DreamHost wiki (http://wiki.dreamhost.com/Freezing_Gems) I froze the gems to vendors by coding them into my config file (config.gem "nokogiri") and then used the rake gems:unpack command to build them into vendor.

I then froze the rails gems using rake rails:freeze:gems, and uploaded it to my subdomain.

The last seven lines of my backtrace go as follows:

0   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   336     in `abort'
1   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   336     in `check_gem_dependencies'
2   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   170     in `process'
3   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   113     in `send'
4   /home/rclosner/demo.spubooks.com/vendor/rails/railties/lib/initializer.rb   113     in `run'
5   ./config/environment.rb     9   
6   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb     31  in `gem_original_require'
7   /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb     31  in `require'

My config file looks like this:

RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
config.gem "nokogiri"
config.gem "amazon-ecs"
config.time_zone = 'UTC'
end

Did I miss a step with the gems? Am I on the right track?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

走过海棠暮 2024-08-11 18:31:04

任何具有本机扩展的 gem 都不能与您的应用程序一起提供,而且很有可能在 DH 上,config.gem 也无法正常工作。您必须安装自己的 ruby​​gems 并让您的应用程序使用它。我建议看看这个:

http://railstips。 org/2008/11/24/rubygems-yours-mine-and-ours

它提供了有关在 DH 上设置环境的详细说明。我上周在服务器升级后才必须这样做,它仍然适用。

Any gem that has native extensions can't be vendored with your app, and there's a good bet that on DH, config.gem won't work right either. You have to install your own rubygems and make your app use it. I recommend taking a look at this:

http://railstips.org/2008/11/24/rubygems-yours-mine-and-ours

It has great instructions for setting up your environment on DH. I just had to do this last week after a server upgrade, and it still applies.

在风中等你 2024-08-11 18:31:04

所以 /vendor/rails 和 /vendor/plugins/nokogiri 和 amazon-ecs 存在并且对你来说看起来不错吗?您可以再试一次,这次在您的配置中指定 gem 的确切版本,如下所示,

config.gem "nokogiri", :version => "1.0"

或者如果 gem 位于 Github 上,则

config.gem "tenderlove-nokogiri", :version => "1.0", :lib => "nokogiri", :source => "http://gems.github.com"

回溯看起来不太有帮助,到底发生了什么? :-)

so /vendor/rails and /vendor/plugins/nokogiri and amazon-ecs exist and look alright to you? You could try again and this time specifying the exact version of the gem in your config like this

config.gem "nokogiri", :version => "1.0"

or if the gem is on Github

config.gem "tenderlove-nokogiri", :version => "1.0", :lib => "nokogiri", :source => "http://gems.github.com"

The backtrace doesn't look very helpfull, what is going on exactly? :-)

对你再特殊 2024-08-11 18:31:04

我最近部署的应用程序得到了相同的回溯(在乘客错误页面上)。事实证明,它无法找到我所依赖的宝石之一(config.gem)......尽管事实上 rake gems 说它在那里([I] test-unit = 1.2.3)。

Dreamhost 支持建议我尝试冻结/解压我的宝石。这可能会起作用(找到我的任何其他宝石都没有问题,这些宝石被冻结了),但由于某种原因 rake gems:unpack 没有为我做任何事情,所以我最终只是注释掉了该配置.gem 行,因为我在生产中不需要它,而且这有效!

因此,如果其他人收到此错误,则强烈表明未找到您的宝石之一。尝试一次注释掉您的 config.gem 行,直到它开始工作或给出不同的错误?

I got the same backtrace (on a Passenger error page) with an app I deployed recently. It turned out that it wasn't able to find one of the gems I was depending on (config.gem)... despite the fact that rake gems said it was there ([I] test-unit = 1.2.3).

Dreamhost support suggested that I try freezing/unpacking my gems. That probably would have worked (it didn't have a problem finding any of my other gems, which were frozen), but for some reason rake gems:unpack wasn't doing anything for me, so I ended up just commenting out that config.gem line since I didn't need it in production anyway, and that worked!

So if anyone else is getting this error, it strongly indicates that one of your gems isn't being found. Try commenting out your config.gem lines, one at a time until it starts working or giving a different error?

只等公子 2024-08-11 18:31:04

上周我在 DreamHost 上遇到了一个问题,我正在运行的 Rails 应用程序由于缺少 gem 而突然停止运行。我联系了支持人员,他们的回复如下:

看来做了一些改变
到您的服务器和大多数
系统安装的 ruby​​gems 不是
像他们应该的那样重新安装
到过。我手动安装了sqlite3
宝石给你,但我们的管理员负责处理
这必须看看这个
找出为什么他们没有
安装。如果你还有几个
你看不工作我可以看看
可能将它们安装为停靠站
同时差距。

您可能也受到同样的事情的影响。尝试联系支持人员以找出答案。

I had an issue on DreamHost last week where my working Rails apps suddenly stopped working because of missing gems. I contacted support and here was their response:

It looks like some changes were made
to your server and most of the
system-installed rubygems were not
reinstalled like they should have
been. I manually installed the sqlite3
gem for you, but our admin who handles
this will have to take a look at this
to figure out why they weren't
installed. If you have a couple more
that you see not working I can look at
potentially installing them as a stop
gap in the mean time.

It's possible you're being affected by the same thing. Try contacting support to find out.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文