ruby on rails - Openshift 500 internal server error -
after deployment rails application (the app works fine on local machine), getting 500 internal server error, not know wrong. ran rhc tail -a appname
generate following logs:
[ pid=422497 thr=12099720 file=utils.rb:176 time=2014-05-18 08:19:34.762 ]: *** exception runtimeerror in rack application object (missing `secret_key _base` 'production' environment, set value in `config/secrets.yml`) (process 422497, thread #<thread:0x00000001714110>): /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:4 40:in `validate_secret_key_config!' /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:1 95:in `env_config' /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/engine.rb:510:in `call' /var/lib/openshift/537858e95004463ce80005be/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/gems/railties-4.1.0/lib/rails/application.rb:1 44:in `call' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/request_handler.rb:97:in `process_request' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_request_handler.rb:521:in `accept_and_process_ne xt_request' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler ' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:79:in `block in spawn_applica tion' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/utils.rb:470:in `safe_fork' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/rack/application_spawner.rb:64:in `spawn_application' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:264:in `spawn_rack_application' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously' /opt/rh/ruby193/root/usr/share/gems/gems/passenger-3.0.21/helper-scripts/passenger-spawn-server:102:in `<main>' [sun may 18 08:19:34 2014] [error] [client 127.12.212.1] premature end of script headers: [ pid=422225 thr=140352120211424 file=ext/apache2/hooks.cpp:841 time=2014-05-18 08:19:34.762 ]: backend application (process 422497) did not send valid http response; instead, sent nothing @ all. possible has crashed; please check whether there crashing bugs in appli cation. 173.244.197.108 - - [18/may/2014:08:19:34 -0400] "get / http/1.1" 500 631 "-" "mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chr ome/34.0.1847.137 safari/537.36" 173.244.197.108 - - [18/may/2014:08:19:40 -0400] "get /favicon.ico http/1.1" 304 - "-" "mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, g ecko) chrome/34.0.1847.137 safari/537.36"
my .gitignore
file:
# see https://help.github.com/articles/ignoring-files more ignoring files. # # if find ignoring temporary files generated text editor # or operating system, want add global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' # ignore bundler config. /.bundle # ignore default sqlite database. /db/*.sqlite3 /db/*.sqlite3-journal # ignore logfiles , tempfiles. /log/*.log /tmp
secrets.yml
local file:
# sure restart server when modify file. # secret key used verifying integrity of signed cookies. # if change key, old signed cookies become invalid! # make sure secret @ least 30 characters , random, # no regular words or you'll exposed dictionary attacks. # can use `rake secret` generate secure secret key. # make sure secrets in file kept private # if you're sharing code publicly. development: secret_key_base: 374b50a3e7af4ac3c8805c7706a239c32e6885a9e0b4331ce0930e341f740c4a700b932166a473ff129cfdcfbbb156b2b75911fafac71 test: secret_key_base: 6bb2c6ac59f9857f5ed5bb11e42cfdacb29f91e8e80fd27362ff7eb06e0e53590be74a8f515ca7c3a6820904d75f55c56d12f2d4f1f7f2 # not keep production secrets in repository, # instead read values environment. production: secret_key_base: <%= env["secret_key_base"] %>
secrets.yml
file in server same except production empty.
try replacing following line in config/secrets.yml
:
secret_key_base: <%=env['secret_key_base']%>
with:
secret_key_base: <%=env['openshift_secret_token']%>
Comments
Post a Comment