Contextefonctionne la version locale, mais la version de production ne
A l'origine, mon application fonctionnait correctement à la fois sur mon serveur local et de la production (Heroku). J'ai alors fait un changement que j'ai prématurément poussé à Heroku; le changement a cassé la version sur la production ayant pour résultat l'affichage de l'erreur "500". L'application fonctionnait toujours sur mon serveur local.
Pour résoudre ce problème, j'ai exécuté la commande heroku rollback
pour revenir à la version de travail antérieure en production. La version de production fonctionnait maintenant. Pour m'assurer que mes copies locales et de production étaient synchronisées avec les versions de travail, je pensais simplement exécuter la commande heroku git:clone -a myapp
afin de pouvoir remplacer ma copie locale par la copie de production en cours.
Problème
Après avoir remplacé ma copie locale avec la copie de travail de la production, je puis essayé de pousser à Heroku (pour vérifier que tout fonctionnait). Ma version locale fonctionne toujours correctement; Toutefois, la version de production affiche simplement l'erreur "505" et l'exécution heroku rollback
ne revient plus à la version de travail antérieure. Comment puis-je faire fonctionner la version de production?
Toutes mes excuses pour l'explication tortueuse. Toute aide serait grandement appréciée!
Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
# gem 'twitter-bootstrap-rails'
gem 'libv8', '~> 3.11.8'
gem 'less-rails'
gem 'therubyracer'
end
gem 'jquery-rails'
gem 'twitter-bootstrap-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
group :production do
gem 'pg', '0.12.2'
end
Sortie de course heroku logs
commande:
2013-06-05T21:54:39.324301+00:00 heroku[api]: Enable Logplex by [email protected]
2013-06-05T21:54:39.365512+00:00 heroku[api]: Release v2 created by [email protected]
2013-06-05T22:05:00.052911+00:00 heroku[slugc]: Slug compilation started
2013-06-05T22:07:13.861177+00:00 heroku[api]: Scale to web=1 by [email protected]
2013-06-05T22:07:14.437288+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_BROWN resource by [email protected]
2013-06-05T22:07:14.466434+00:00 heroku[api]: Release v3 created by [email protected]
2013-06-05T22:07:14.531348+00:00 heroku[api]: Add DATABASE_URL config by [email protected]
2013-06-05T22:07:14.562176+00:00 heroku[api]: Release v4 created by [email protected]
2013-06-05T22:07:14.615023+00:00 heroku[api]: Add config by [email protected]
2013-06-05T22:07:14.647163+00:00 heroku[api]: Release v5 created by [email protected]
2013-06-05T22:07:14.690706+00:00 heroku[api]: Deploy 0781b19 by [email protected]
2013-06-05T22:07:14.720746+00:00 heroku[api]: Release v6 created by [email protected]
2013-06-05T22:07:14.758968+00:00 heroku[api]: Deploy 0781b19 by [email protected]
2013-06-05T22:07:15.391452+00:00 heroku[slugc]: Slug compilation finished
2013-06-05T22:07:17.270346+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 24519`
2013-06-05T22:07:21.081962+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-05T22:07:21.081844+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-05T22:07:24.020299+00:00 app[web.1]: => Booting WEBrick
2013-06-05T22:07:24.020299+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-05T22:07:24.020299+00:00 app[web.1]: => Call with -d to detach
2013-06-05T22:07:24.020299+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:24519
2013-06-05T22:07:24.020299+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-06-05T22:07:24.195433+00:00 app[web.1]: [2013-06-05 22:07:24] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-06-05T22:07:24.197238+00:00 app[web.1]: [2013-06-05 22:07:24] INFO WEBrick::HTTPServer#start: pid=2 port=24519
2013-06-05T22:07:24.195268+00:00 app[web.1]: [2013-06-05 22:07:24] INFO WEBrick 1.3.1
2013-06-05T22:07:24.563524+00:00 heroku[web.1]: State changed from starting to up
2013-06-05T22:20:29.360706+00:00 app[web.1]: Started GET "/" for 108.94.165.104 at 2013-06-05 22:20:29 +0000
2013-06-05T22:20:29.573466+00:00 app[web.1]: Processing by StudentsController#index as HTML
2013-06-05T22:20:29.721672+00:00 app[web.1]: Completed 500 Internal Server Error in 148ms
2013-06-05T22:20:29.729040+00:00 app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-06-05T22:20:29.729040+00:00 app[web.1]: ^
2013-06-05T22:20:29.729040+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-06-05T22:20:29.729040+00:00 app[web.1]:
2013-06-05T22:20:29.729040+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-06-05T22:20:29.729040+00:00 app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: relation "students" does not exist
2013-06-05T22:20:29.729040+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-06-05T22:20:29.729040+00:00 app[web.1]: LINE 5: WHERE a.attrelid = '"students"'::regclass
2013-06-05T22:20:29.729040+00:00 app[web.1]: WHERE a.attrelid = '"students"'::regclass
2013-06-05T22:20:29.729327+00:00 app[web.1]: ORDER BY a.attnum
2013-06-05T22:20:29.729327+00:00 app[web.1]:
2013-06-05T22:20:29.729327+00:00 app[web.1]:):
2013-06-05T22:20:29.729327+00:00 app[web.1]: app/controllers/students_controller.rb:5:in `index'
2013-06-05T22:20:29.729040+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2013-06-05T22:20:29.729327+00:00 app[web.1]:
2013-06-05T22:20:29.732475+00:00 heroku[router]: at=info method=GET path=/ host=secret-brushlands-9122.herokuapp.com fwd="108.94.165.104" dyno=web.1 connect=7ms service=385ms status=500 bytes=643
2013-06-05T22:20:29.907973+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=secret-brushlands-9122.herokuapp.com fwd="108.94.165.104" dyno=web.1 connect=1ms service=11ms status=200 bytes=0
2013-06-05T22:29:58.144871+00:00 heroku[api]: Deploy 0403476 by [email protected]
2013-06-05T22:29:58.167804+00:00 heroku[api]: Release v7 created by [email protected]
2013-06-05T22:29:58.206118+00:00 heroku[api]: Deploy 0403476 by [email protected]
2013-06-05T22:29:58.376314+00:00 heroku[web.1]: State changed from up to starting
2013-06-05T22:30:01.539107+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 52191`
2013-06-05T22:30:01.701845+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-06-05T22:30:02.512228+00:00 app[web.1]: [2013-06-05 22:30:02] ERROR SignalException: SIGTERM
2013-06-05T22:30:02.512228+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-06-05T22:30:12.438954+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-06-05T22:30:12.439155+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-06-05T22:30:14.361060+00:00 heroku[web.1]: Process exited with status 137
2013-06-05T22:30:15.586713+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-05T22:30:15.586566+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-06-05T22:30:35.092923+00:00 app[web.1]: => Call with -d to detach
2013-06-05T22:30:35.092923+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-05T22:30:35.092923+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-06-05T22:30:35.092923+00:00 app[web.1]: => Booting WEBrick
2013-06-05T22:30:35.092923+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:52191
2013-06-05T22:30:35.594816+00:00 app[web.1]: [2013-06-05 22:30:35] INFO WEBrick 1.3.1
2013-06-05T22:30:35.594816+00:00 app[web.1]: [2013-06-05 22:30:35] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-06-05T22:30:35.595558+00:00 app[web.1]: [2013-06-05 22:30:35] INFO WEBrick::HTTPServer#start: pid=2 port=52191
2013-06-05T22:30:35.990236+00:00 heroku[web.1]: State changed from starting to up
2013-06-05T22:30:38.042484+00:00 app[web.1]: Started GET "/" for 108.94.165.104 at 2013-06-05 22:30:38 +0000
2013-06-05T22:30:38.423594+00:00 app[web.1]: Processing by StudentsController#index as HTML
2013-06-05T22:30:39.528941+00:00 heroku[router]: at=info method=GET path=/ host=secret-brushlands-9122.herokuapp.com fwd="108.94.165.104" dyno=web.1 connect=2ms service=1523ms status=500 bytes=643
2013-06-05T22:30:39.706864+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=secret-brushlands-9122.herokuapp.com fwd="108.94.165.104" dyno=web.1 connect=2ms service=24ms status=200 bytes=0
2013-06-05T22:30:39.512419+00:00 app[web.1]: Completed 500 Internal Server Error in 1088ms
2013-06-05T22:30:39.514250+00:00 app[web.1]:
2013-06-05T22:30:39.514250+00:00 app[web.1]: ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-06-05T22:30:39.514430+00:00 app[web.1]: app/controllers/students_controller.rb:5:in `index'
2013-06-05T22:30:39.514250+00:00 app[web.1]: AND a.attnum > 0 AND NOT a.attisdropped
2013-06-05T22:30:39.514430+00:00 app[web.1]: ORDER BY a.attnum
2013-06-05T22:30:39.514430+00:00 app[web.1]:):
2013-06-05T22:30:39.514250+00:00 app[web.1]: LINE 5: WHERE a.attrelid = '"students"'::regclass
2013-06-05T22:30:39.514250+00:00 app[web.1]: ^
2013-06-05T22:30:39.514250+00:00 app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR: relation "students" does not exist
2013-06-05T22:30:39.514250+00:00 app[web.1]: : SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-06-05T22:30:39.514250+00:00 app[web.1]: pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-06-05T22:30:39.514250+00:00 app[web.1]: FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-06-05T22:30:39.514250+00:00 app[web.1]: WHERE a.attrelid = '"students"'::regclass
2013-06-05T22:30:39.514430+00:00 app[web.1]:
2013-06-05T22:30:39.514430+00:00 app[web.1]:
MISE À JOUR:
J'étais curieux de savoir si la création d'une nouvelle télécommande Heroku résoudrait le problème si J'ai supprimé http://nameless-brook-8163.herokuapp.com/ et définir la nouvelle télécommande à http://secret-brushlands-9122.herokuapp.com/. Malheureusement, le problème persiste.
j'ai couru « heroku exécuter rake db: migrate » par une recommandation ci-dessous et a obtenu le résultat suivant:
heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.6596
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
rake aborted!
Invalid DATABASE_URL
(erb):9:in `rescue in <main>'
(erb):6:in `<main>'
/app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/configuration.rb:115:in `database_configuration'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/base.rb:720:in `<top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:25:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
Il semble que le pipeline d'actifs n'ait pas fonctionné lors du déploiement. il suffit de déclencher un nouveau déploiement sur heroku en poussant un nouveau commit. – phoet
Salut @phoet, comme vous l'avez suggéré, j'ai poussé un nouveau commit à Heroku. L'erreur 500 se pose toujours. J'ai mis à jour la sortie de l'exécution des 'journaux heroku'. Cela a attiré mon attention: '2013-06-05T22: 20: 29.729040 + 00: 00 app [web.1]: ActiveRecord :: StatementInvalid (PGError: ERREUR: relation "étudiants" n'existe pas.) Avez-vous une idée de la façon dont je devrais interpréter cela? Merci! –
heroku run db: migrate – phoet