将我的应用程序部署到 Heroku 时遇到问题。我正在运行 ruby 2.0.0、rails'、'3.2.13' 和 'pg'、'0.15.1'。
我已经编译了我的资产并正在使用 figaro 加载环境变量。
我遇到的问题是我无法运行 heroku migrate 命令。
Jamies-MacBook-Air:accufly jamieturner$ rake db:reset
Couldn't drop accufly : #<PG::Error: FATAL: database "postgres" does not exist
>
Couldn't drop accufly : #<PG::Error: FATAL: database "postgres" does not exist
>
accufly already exists
accufly already exists
-- create_table("roles", {:force=>true})
-> 0.0456s
-- add_index("roles", ["name", "resource_type", "resource_id"], {:name=>"index_roles_on_name_and_resource_type_and_resource_id"})
-> 0.0071s
-- add_index("roles", ["name"], {:name=>"index_roles_on_name"})
-> 0.0053s
-- create_table("users", {:force=>true})
-> 0.0163s
-- add_index("users", ["email"], {:name=>"index_users_on_email", :unique=>true})
-> 0.0042s
-- add_index("users", ["reset_password_token"], {:name=>"index_users_on_reset_password_token", :unique=>true})
-> 0.0046s
-- create_table("users_roles", {:id=>false, :force=>true})
-> 0.0057s
-- add_index("users_roles", ["user_id", "role_id"], {:name=>"index_users_roles_on_user_id_and_role_id"})
-> 0.0037s
-- initialize_schema_migrations_table()
-> 0.0010s
-- assume_migrated_upto_version(20121017180539, ["/Users/jamieturner/Dropbox/Rails/accufly/db/migrate"])
-> 0.0016s
ROLES
role: admin
role: silver
role: gold
role: platinum
DEFAULT USERS
user: First User
Jamies-MacBook-Air:accufly jamieturner$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.8314
rake aborted!
cannot load such file -- teaspoon/console
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/app/lib/tasks/spec.rake:2:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:425:in `block in load_tasks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:425:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:425:in `load_tasks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:145:in `load_tasks'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/Rakefile:7:in `<top (required)>'
我的 Heroku 日志显示以下内容:
Jamies-MacBook-Air:accufly jamieturner$ heroku logs
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
2014-01-13T15:59:19.941147+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:42:in `call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
2014-01-13T15:59:19.941646+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
2014-01-13T15:59:19.941834+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__4277113149258428646__call__2252195022539720089__callbacks'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
2014-01-13T15:59:19.942275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
2014-01-13T15:59:19.942451+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
2014-01-13T15:59:19.943064+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in `call'
2014-01-13T15:59:19.943064+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
2014-01-13T15:59:19.943064+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
2014-01-13T15:59:19.942892+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2014-01-13T15:59:19.943064+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
2014-01-13T15:59:19.943064+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
2014-01-13T15:59:19.943064+00:00 app[web.1]:
2014-01-13T15:59:19.943064+00:00 app[web.1]:
2014-01-13T15:59:19.941791+00:00 heroku[router]: at=info method=GET path=/users/sign_in host=secret-badlands-6955.herokuapp.com fwd="213.133.142.4" dyno=web.1 connect=1ms service=81ms status=500 bytes=643
2014-01-13T15:59:48.932960+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by jamieturner84@hotmail.com
2014-01-13T15:59:54.568601+00:00 heroku[run.8314]: Awaiting client
2014-01-13T15:59:54.615082+00:00 heroku[run.8314]: Starting process with command `bundle exec rake db:migrate`
2014-01-13T16:00:01.203260+00:00 heroku[run.8314]: Process exited with status 1
2014-01-13T15:59:54.336249+00:00 heroku[run.8314]: State changed from starting to up
2014-01-13T16:00:14.160279+00:00 app[web.1]: Started GET "/" for 213.133.142.4 at 2014-01-13 16:00:14 +0000
2014-01-13T16:00:14.165052+00:00 app[web.1]: Processing by HomeController#index as HTML
2014-01-13T16:00:14.167083+00:00 app[web.1]: Rendered home/index.html.erb within layouts/application (1.3ms)
2014-01-13T16:00:14.169546+00:00 app[web.1]: Rendered layouts/_navigation.html.erb (0.8ms)
2014-01-13T16:00:14.169784+00:00 app[web.1]: Rendered layouts/_messages.html.erb (0.1ms)
2014-01-13T16:00:14.170019+00:00 app[web.1]: Completed 200 OK in 5ms (Views: 4.7ms | ActiveRecord: 0.0ms)
2014-01-13T15:59:17.268562+00:00 heroku[router]: at=info method=GET path=/assets/application-babb3bda98b37e0587ee7506be68cd38.js host=secret-badlands-6955.herokuapp.com fwd="213.133.142.4" dyno=web.1 connect=16ms service=17ms status=200 bytes=141306
2014-01-13T16:00:14.363847+00:00 heroku[router]: at=info method=GET path=/assets/application-2a320f8efcd905dd4ec269daf6e4a383.css host=secret-badlands-6955.herokuapp.com fwd="213.133.142.4" dyno=web.1 connect=3ms service=5ms status=304 bytes=0
2014-01-13T16:00:14.414538+00:00 heroku[router]: at=info method=GET path=/assets/application-babb3bda98b37e0587ee7506be68cd38.js host=secret-badlands-6955.herokuapp.com fwd="213.133.142.4" dyno=web.1 connect=6ms service=8ms status=304 bytes=0
2014-01-13T16:00:16.903364+00:00 app[web.1]: Started GET "/users/sign_up?plan=silver" for 213.133.142.4 at 2014-01-13 16:00:16 +0000
2014-01-13T16:00:16.908006+00:00 app[web.1]: Processing by RegistrationsController#new as HTML
2014-01-13T16:00:16.908006+00:00 app[web.1]: Parameters: {"plan"=>"silver"}
2014-01-13T16:00:16.910808+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2014-01-13T16:00:16.912570+00:00 app[web.1]:
2014-01-13T16:00:16.912570+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "users" does not exist
2014-01-13T16:00:16.912570+00:00 app[web.1]: LINE 5: WHERE a.attrelid = '"users"'::regclass
2014-01-13T16:00:16.912570+00:00 app[web.1]: ^
2014-01-13T16:00:16.912570+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2014-01-13T16:00:16.912570+00:00 app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2014-01-13T16:00:16.912570+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2014-01-13T16:00:16.912570+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2014-01-13T16:00:16.912570+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2014-01-13T16:00:16.912570+00:00 app[web.1]: WHERE a.attrelid = '"users"'::regclass
2014-01-13T16:00:16.912751+00:00 app[web.1]: ):
2014-01-13T16:00:16.912751+00:00 app[web.1]: app/controllers/registrations_controller.rb:6:in `new'
2014-01-13T16:00:16.912751+00:00 app[web.1]:
2014-01-13T16:00:16.912751+00:00 app[web.1]:
2014-01-13T16:00:16.912751+00:00 app[web.1]: ORDER BY a.attnum
2014-01-13T16:00:16.912751+00:00 app[web.1]: app/controllers/registrations_controller.rb:36:in `build_resource'
Jamies-MacBook-Air:accufly jamieturner$
任何关于我应该看的地方的帮助将不胜感激。
编辑:
我的 gem 文件如下所示:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'pg', '0.15.1'
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
group :development, :test do
#gem 'sqlite3'
end
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "rspec-rails", ">= 2.12.2", :group => [:development, :test]
gem "database_cleaner", ">= 1.0.0.RC1", :group => :test
gem "email_spec", ">= 1.4.0", :group => :test
gem "cucumber-rails", ">= 1.3.1", :group => :test, :require => false
gem "launchy", ">= 2.2.0", :group => :test
gem "capybara", ">= 2.0.3", :group => :test
gem "factory_girl_rails", ">= 4.2.0", :group => [:development, :test]
gem "teaspoon", ">= 0.7.4", :group => [:development, :test]
gem "bootstrap-sass", ">= 2.3.0.0"
gem "devise", ">= 2.2.3"
gem "cancan", ">= 1.6.9"
gem "rolify", ">= 3.2.0"
gem "simple_form", ">= 2.1.0"
gem "stripe", ">= 1.7.11"
gem "stripe_event", ">= 0.4.0"
gem "quiet_assets", ">= 1.0.2", :group => :development
gem "figaro", ">= 0.6.3"
gem "better_errors", ">= 0.7.2", :group => :development
gem "binding_of_caller", ">= 0.7.1", :group => :development, :platforms => [:mri_19, :rbx]