1

I'm trying to push a Rails application to AppFog and I keep getting a 301 error.

It gets to Staging, so it shows up on my AppFog account, but refuses to activate. Trying to update it succeeds, but has the same problem where it won't activate and only shows a 404 error.

Here is the message text:

$ 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>'

My gemfile looks like:

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== Changed config.server_static_assets = false to

config.server_static_assets = true

and precompiled my assets?

bundle exec rake assets:precompile

but it still gives me the same error.

Changed

gem 'jquery-rails'

to

gem 'cloudfoundry-jquery-rails'

still no success

StoicJester
  • 364
  • 2
  • 12

2 Answers2

0

Did you change in your config/environments/production.rb

config.server_static_assets = false

to

config.server_static_assets = true

and precompiled your assets?

bundle exec rake assets:precompile

Also, for Ruby 1.9 AppFog requires a tweak to the jquery-rails gem. Remove or comment out gem 'jquery-rails' and add gem 'cloudfoundry-jquery-rails', like so:

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

Further documentation here.

Luís Ramalho
  • 10,018
  • 4
  • 52
  • 67
  • That didn't do it. I read through the documentation. I'm wondering if I should be including a cloudfoundry gem in my Gemfile, but the documentation didn't mention anything like that. – StoicJester Apr 01 '13 at 22:48
  • If you are using Ruby 1.9 you should include `gem 'cloudfoundry-jquery-rails'` and remove `gem 'jquery-rails'` – Luís Ramalho Apr 01 '13 at 22:54
0

Didn't really come up with a good solution for this problem. However, I created a brand new rails app and moved all of my files from the old one to the new one. Now it will push to AppFog.

I did a diff of the directory, but all the differences are just log files, the app name, and the readme file. Nothing really stands out as a possible cause of the error.

StoicJester
  • 364
  • 2
  • 12