我已经在heroku上部署了我的应用程序几次,一切都很好。
现在我正在尝试部署我的应用程序并收到错误“我们很抱歉,但出了点问题”。我花了 1 天的时间来解决这个问题。我已经完成了 rake db:migrate RAILS_ENV=production 并且没有任何问题。config.assets.initialize_on_precompile = false 在我的 application.rb
我的 database.yml 可能有一些错误?
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 10000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 10000
production:
adapter: postgresql
encoding: unicode
database: db/production
pool: 5
username: root
password:
这是 git push heroku master 之后的日志:
-----> Ruby/Rails app detected
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
Running: bundle install --without development:test --path
vendor/bundle --binstubs vendor/bundle/bin --deployment
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Using atomic (1.1.13)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bcrypt-ruby (3.0.1)
Using sass (3.2.10)
Using bootstrap-sass (2.3.2.2)
Using will_paginate (3.0.4)
Using bootstrap-will_paginate (0.0.9)
Using coffee-script-source (1.6.3)
Using execjs (2.0.1)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using commonjs (0.2.7)
Using daemon_controller (1.1.5)
Using delayed_job (4.0.0)
Using delayed_job_active_record (4.0.0)
Using orm_adapter (0.4.0)
Using warden (1.2.3)
Using devise (3.0.3)
Using dotenv (0.9.0)
Using faker (1.2.0)
Using multipart-post (1.2.0)
Using faraday (0.8.8)
Using foreman (0.63.0)
Using tilt (1.4.1)
Using haml (4.0.3)
Using haml-rails (0.4)
Using hashie (2.0.5)
Using hike (1.2.3)
Using httpauth (0.2.0)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using jwt (0.1.8)
Using kgio (2.8.0)
Using less (2.4.0)
Using less-rails (2.4.2)
Using libv8 (3.11.8.17)
Using oauth2 (0.8.1)
Using omniauth (1.1.4)
Using omniauth-oauth2 (1.1.1)
Using omniauth-facebook (1.4.1)
Using omniauth-vkontakte (1.2.0)
Using paginate (3.0.0)
Using passenger (4.0.17)
Using pg (0.15.1)
Using bundler (1.3.2)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rails_serve_static_assets (0.0.1)
Using rails_stdout_logging (0.0.2)
Using rails_12factor (0.0.2)
Using raindrops (0.12.0)
Using rdoc (3.12.2)
Using ref (1.0.5)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using therubyracer (0.11.4)
Using turbolinks (1.3.0)
Using twitter-bootstrap-rails (2.2.8)
Using uglifier (2.2.1)
Using unicorn (4.6.3)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Detected manifest file, assuming assets were compiled locally
-----> Discovering process types
Procfile declares types -> web, worker
Default types for Ruby/Rails -> console, rake
-----> Compiled slug size: 63.2MB
-----> Launching... done, v9
http://infinite-tor-5194.herokuapp.com deployed to Heroku
To git@heroku.com:infinite-tor-5194.git
864973b..5cdfe38 master -> master
root@User1:/usr/src/rbpr/d23m# heroku open
Opening infinite-tor-5194... done
这是我的heroku日志:
root@User1:/usr/src/rbpr/d23m# heroku logs
2013-09-11T07:18:32.866061+00:00 app[web.1]: ^
2013-09-11T07:18:32.866337+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1
2013-09-11T07:18:32.867305+00:00 app[web.1]: Completed 500 Internal Server Error in 33ms
2013-09-11T07:18:32.867305+00:00 app[web.1]: Completed 500 Internal Server Error in 33ms
2013-09-11T07:18:32.920595+00:00 app[web.1]:
2013-09-11T07:18:32.920595+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "users" does not exist
2013-09-11T07:18:32.920595+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T07:18:32.920595+00:00 app[web.1]: ^
2013-09-11T07:18:32.920595+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1):
2013-09-11T07:18:32.920595+00:00 app[web.1]: app/helpers/sessions_helper.rb:20:in `current_user'
2013-09-11T07:18:32.920595+00:00 app[web.1]: app/helpers/sessions_helper.rb:11:in `signed_in?'
2013-09-11T07:18:32.920595+00:00 app[web.1]:
2013-09-11T07:18:32.920595+00:00 app[web.1]:
2013-09-11T07:18:32.920595+00:00 app[web.1]: app/controllers/static_pages_controller.rb:4:in `home'
2013-09-11T07:18:32.920899+00:00 app[web.1]:
2013-09-11T07:18:32.920899+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "users" does not exist
2013-09-11T07:18:32.920899+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T07:18:32.920899+00:00 app[web.1]: ^
2013-09-11T07:18:32.920899+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1):
2013-09-11T07:18:32.920899+00:00 app[web.1]: app/helpers/sessions_helper.rb:11:in `signed_in?'
2013-09-11T07:18:32.920899+00:00 app[web.1]:
2013-09-11T07:18:32.920899+00:00 app[web.1]: app/helpers/sessions_helper.rb:20:in `current_user'
2013-09-11T07:18:32.920899+00:00 app[web.1]: app/controllers/static_pages_controller.rb:4:in `home'
2013-09-11T07:18:32.920899+00:00 app[web.1]:
2013-09-11T07:18:32.923140+00:00 heroku[router]: at=info method=GET path=/ host=infinite-tor-5194.herokuapp.com fwd="89.169.49.29" dyno=web.1 connect=1ms service=226ms status=500 bytes=1266
2013-09-11T08:24:35.824290+00:00 heroku[web.1]: Idling
2013-09-11T08:24:40.013048+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-09-11T08:24:40.958893+00:00 app[web.1]: [2013-09-11 08:24:40] FATAL SignalException: SIGTERM
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:84:in `start'
2013-09-11T08:24:40.959070+00:00 app[web.1]: [2013-09-11 08:24:40] INFO WEBrick::HTTPServer#start done.
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
2013-09-11T08:24:40.959070+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
2013-09-11T08:24:40.959070+00:00 app[web.1]: bin/rails:4:in `require'
2013-09-11T08:24:40.959070+00:00 app[web.1]: bin/rails:4:in `<main>'
2013-09-11T08:24:40.959070+00:00 app[web.1]: Exiting
2013-09-11T08:24:40.959070+00:00 app[web.1]: [2013-09-11 08:24:40] INFO going to shutdown ...
2013-09-11T08:24:40.958893+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
2013-09-11T08:24:43.400338+00:00 heroku[web.1]: Process exited with status 143
2013-09-11T08:24:43.410429+00:00 heroku[web.1]: State changed from up to down
2013-09-11T10:18:56+00:00 heroku[slug-compiler]: Slug compilation started
2013-09-11T10:19:46.285001+00:00 heroku[api]: Deploy 5cdfe38 by davydenkov_m@mail.ru
2013-09-11T10:19:46.312851+00:00 heroku[api]: Release v9 created by davydenkov_m@mail.ru
2013-09-11T10:19:47+00:00 heroku[slug-compiler]: Slug compilation finished
2013-09-11T10:19:46.743756+00:00 heroku[web.1]: State changed from down to starting
2013-09-11T10:19:52.854779+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 18250`
2013-09-11T10:19:57.859418+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: already initialized constant #<Module:0x007f2890f30790>::AttrNames
2013-09-11T10:19:57.859418+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: previous definition of AttrNames was here
2013-09-11T10:19:57.869819+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: already initialized constant #<Module:0x007f28910e6cd8>::AttrNames
2013-09-11T10:19:57.867077+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: already initialized constant #<Module:0x007f289109fef0>::AttrNames
2013-09-11T10:19:57.867077+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: previous definition of AttrNames was here
2013-09-11T10:19:57.869819+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/core.rb:103: warning: previous definition of AttrNames was here
2013-09-11T10:19:57.931113+00:00 app[web.1]: [2013-09-11 10:19:57] INFO WEBrick 1.3.1
2013-09-11T10:19:57.931819+00:00 app[web.1]: [2013-09-11 10:19:57] INFO WEBrick::HTTPServer#start: pid=2 port=18250
2013-09-11T10:19:57.931113+00:00 app[web.1]: [2013-09-11 10:19:57] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux]
2013-09-11T10:19:58.535447+00:00 heroku[web.1]: State changed from starting to up
2013-09-11T10:28:10.560065+00:00 app[web.1]: => Booting WEBrick
2013-09-11T10:28:10.560065+00:00 app[web.1]: => Rails 4.0.0 application starting in production on http://0.0.0.0:18250
2013-09-11T10:28:10.560065+00:00 app[web.1]: => Run `rails server -h` for more startup options
2013-09-11T10:28:10.560065+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-09-11T10:28:10.560065+00:00 app[web.1]: Started GET "/" for 89.169.49.29 at 2013-09-11 10:28:10 +0000
2013-09-11T10:28:10.560065+00:00 app[web.1]: Started GET "/" for 89.169.49.29 at 2013-09-11 10:28:10 +0000
2013-09-11T10:28:10.630935+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-09-11T10:28:10.630935+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2013-09-11T10:28:10.664056+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1
2013-09-11T10:28:10.664056+00:00 app[web.1]: PG::Error: ERROR: relation "users" does not exist
2013-09-11T10:28:10.664056+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T10:28:10.664056+00:00 app[web.1]: ^
2013-09-11T10:28:10.665348+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T10:28:10.665348+00:00 app[web.1]: PG::Error: ERROR: relation "users" does not exist
2013-09-11T10:28:10.665348+00:00 app[web.1]: ^
2013-09-11T10:28:10.665935+00:00 app[web.1]: Completed 500 Internal Server Error in 35ms
2013-09-11T10:28:10.667812+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "users" does not exist
2013-09-11T10:28:10.667812+00:00 app[web.1]: ^
2013-09-11T10:28:10.667812+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T10:28:10.665348+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1
2013-09-11T10:28:10.665804+00:00 app[web.1]: Completed 500 Internal Server Error in 35ms
2013-09-11T10:28:10.667812+00:00 app[web.1]:
2013-09-11T10:28:10.667812+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1):
2013-09-11T10:28:10.667812+00:00 app[web.1]: app/helpers/sessions_helper.rb:11:in `signed_in?'
2013-09-11T10:28:10.667812+00:00 app[web.1]: app/controllers/static_pages_controller.rb:4:in `home'
2013-09-11T10:28:10.667812+00:00 app[web.1]:
2013-09-11T10:28:10.675509+00:00 app[web.1]:
2013-09-11T10:28:10.675509+00:00 app[web.1]: ^
2013-09-11T10:28:10.667812+00:00 app[web.1]: app/helpers/sessions_helper.rb:20:in `current_user'
2013-09-11T10:28:10.667812+00:00 app[web.1]:
2013-09-11T10:28:10.675509+00:00 app[web.1]: LINE 1: SELECT "users".* FROM "users" WHERE "users"."remember_toke...
2013-09-11T10:28:10.675509+00:00 app[web.1]: : SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' ORDER BY created_at DESC LIMIT 1):
2013-09-11T10:28:10.675509+00:00 app[web.1]: app/helpers/sessions_helper.rb:20:in `current_user'
2013-09-11T10:28:10.675509+00:00 app[web.1]: app/helpers/sessions_helper.rb:11:in `signed_in?'
2013-09-11T10:28:10.675509+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "users" does not exist
2013-09-11T10:28:10.679234+00:00 heroku[router]: at=info method=GET path=/ host=infinite-tor-5194.herokuapp.com fwd="89.169.49.29" dyno=web.1 connect=2ms service=124ms status=500 bytes=1266
2013-09-11T10:28:10.675509+00:00 app[web.1]: app/controllers/static_pages_controller.rb:4:in `home'
2013-09-11T10:28:10.675509+00:00 app[web.1]:
2013-09-11T10:28:10.675509+00:00 app[web.1]:
2013-09-11T10:28:11.377794+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=infinite-tor-5194.herokuapp.com fwd="89.169.49.29" dyno=web.1 connect=1ms service=6ms status=200 bytes=0
更新:
root@User1:/usr/src/rbpr/d23m# heroku run rake db:reset
Running `rake db:reset` attached to terminal... up, run.9279
FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.
...
Couldn't create database for {"adapter"=>"postgresql", "username"=>"acnvttimesbqxk",
"password"=>"xzwY-0W8-JkXPwFobd3-gE8syk", "port"=>5432, "database"=>"d6vpf68f9ersl9",
"host"=>"ec2-54-227-238-31.compute-1.amazonaws.com"}
-- create_table("delayed_jobs", {:force=>true})
rake aborted!
FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.