托管帮助 - DreamHost 上的自定义 Gems
我正在尝试使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
任何具有本机扩展的 gem 都不能与您的应用程序一起提供,而且很有可能在 DH 上,config.gem 也无法正常工作。您必须安装自己的 rubygems 并让您的应用程序使用它。我建议看看这个:
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.
所以 /vendor/rails 和 /vendor/plugins/nokogiri 和 amazon-ecs 存在并且对你来说看起来不错吗?您可以再试一次,这次在您的配置中指定 gem 的确切版本,如下所示,
或者如果 gem 位于 Github 上,则
回溯看起来不太有帮助,到底发生了什么? :-)
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
or if the gem is on Github
The backtrace doesn't look very helpfull, what is going on exactly? :-)
我最近部署的应用程序得到了相同的回溯(在乘客错误页面上)。事实证明,它无法找到我所依赖的宝石之一(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?
上周我在 DreamHost 上遇到了一个问题,我正在运行的 Rails 应用程序由于缺少 gem 而突然停止运行。我联系了支持人员,他们的回复如下:
您可能也受到同样的事情的影响。尝试联系支持人员以找出答案。
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's possible you're being affected by the same thing. Try contacting support to find out.