1

我正在尝试将 Rails 应用程序推送到 AppFog 并且不断收到 301 错误。

它进入了 Staging,因此它显示在我的 AppFog 帐户中,但拒绝激活。尝试更新它成功,但有同样的问题,它不会激活并且只显示 404 错误。

这是消息文本:

$ af push RubyMongoGranny --runtime=ruby193
Would you like to deploy from the current directory? [Yn]: 
Pushing application 'RubyMongoGranny'...
Creating Application: OK
Binding Service [ruby_mongo_granny]: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (236K): OK   
Push Status: OK
Staging Application 'RubyMongoGranny': ..........Error 310: Staging failed: 'Staging task failed:
 Staging plugin failed: /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/gemfile_task.rb:325:in `log_and_raise_error': Error resolving Gemfile: Error parsing Gemfile: /tmp/d20130401-19438-h0d0st/Gemfile not found (RuntimeError)
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/gemfile_task.rb:50:in `specs'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/gemfile_task.rb:103:in `gem_info'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/gemfile_support.rb:86:in `gem_info'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/rails3/plugin.rb:188:in `rails_version'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/rails3/plugin.rb:199:in `precompile_assets'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/rails3/plugin.rb:85:in `block in stage_application'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/rails3/plugin.rb:76:in `chdir'
from /opt/cloudfoundry/vcap/staging/lib/vcap/staging/plugin/rails3/plugin.rb:76:in `stage_application'
from /opt/cloudfoundry/vcap/stager/bin/run_plugin:19:in `<main>'

我的 gemfile 看起来像:

source 'https://rubygems.org'

gem 'rails'
gem 'mongo_mapper'
gem 'bson_ext'


group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'


  gem 'uglifier', '>= 1.0.3'
end

gem 'cloudfoundry-jquery-rails

==UPDATE== 将 config.server_static_assets = false 更改为

config.server_static_assets = true

并预编译我的资产?

bundle exec rake assets:precompile

但它仍然给我同样的错误。

改变了

gem 'jquery-rails'

gem 'cloudfoundry-jquery-rails'

仍然没有成功

4

2 回答 2

0

你有没有改变你的config/environments/production.rb

config.server_static_assets = false

config.server_static_assets = true

并预编译您的资产?

bundle exec rake assets:precompile

此外,对于 Ruby 1.9,AppFog 需要对 jquery-rails gem 进行调整。删除或注释掉gem 'jquery-rails'并添加gem 'cloudfoundry-jquery-rails',如下所示:

# gem 'jquery-rails'
gem 'cloudfoundry-jquery-rails'

更多文档在这里

于 2013-04-01T22:23:06.913 回答
0

对于这个问题并没有真正想出一个好的解决方案。但是,我创建了一个全新的 Rails 应用程序,并将我的所有文件从旧的移动到新的。现在它将推送到 AppFog。

我做了目录的差异,但所有差异都只是日志文件、应用程序名称和自述文件。没有什么真正突出作为错误的可能原因。

于 2013-04-02T21:39:47.357 回答