Search code examples
ruby-on-railsrakespreeappfog

rake db:seed with Rails/Spree on AppFog


I'm testing a Rails/Spree app on appfog, but I can't get the DB to seed. I've followed these instructions to the T: https://docs.appfog.com/languages/ruby/rails But at the point where I run af tunnel and then open a new terminal window, then run RAILS_ENV=proxied-appfog rake db:seed I get the error

loading fixture /var/lib/gems/1.9.1/gems/spree_core-1.3.2/db/default/spree/countries.yml
rake aborted!
Mysql2::Error: closed MySQL connection: SET FOREIGN_KEY_CHECKS = 1

I'm using MySQL for the db. Any thoughts on why this is happening?

rake:db migrate runs with no errors.

rake:db reset fails with the same error.


Solution

  • Maybe you run af tunnel, but it is incomplete. You have to run some like af tunnel my-app-mysql-1234 and then select 1 option (none)

    Check my recent answer and change the RAILS_ENV=production rake db:migrate per some like RAILS_ENV=production rake db:seed

    App Fog Rails Migrate Database

    Its work fine for me.

    Good luck!