前提・実現したいこと
rails4の開発環境で作成したアプリを本番環境にデプロイしたいです。
実施手順としては下記になります。
①railsの本番環境構築時に動作確認として/public/index.htmlの内容が表示されることを確認し、動作確認完了
②DB作成し、開発環境と同じ構成でモデル、テーブルを作成
③開発環境のファイルを本番環境にコピー
④動作確認
トップページアクセス(http://<サーバIP>)した際に/public/index.htmlの内容が表示されます。
アクセスしたいのはview/<コントローラ名>/index.htmlになります。
おそらく、rails側の設定で本番環境を利用する場合の手順が足りないと思っているのですが、
capistranoというgemを利用した手順しか見当たらず、困っています。
デプロイに関しては上記のgemの利用が必須ということでしょうか。
発生している問題・エラーメッセージ
/public/index.htmlをリネームした際に発生
⇒public配下のindex.htmlの読み込みがview内のindex.htmlより、優先されて可能性を確認するため。
/var/log/httpd/error_log
[ W 2018-07-09 12:30:30.8573 1717/T7 age/Cor/Con/InternalUtils.cpp:96 ]: [Client 1-10] Sending 502 response: application did not send a complete response App 2832 output: [ 2018-07-09 12:30:40.3155 2832/0x00007f09d28a2770(Worker 1) utils.rb ]: *** Exception RuntimeError in Rack application object (Missing `secret_token` and `secret_key_base` for 'production' environment, set these values in `config/secrets.yml`) (process 2832, thread 0x00007f09d28a2770(Worker 1)): App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:534:in `validate_secret_key_config!' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:246:in `env_config' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.9/lib/rails/engine.rb:514:in `call' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.9/lib/rails/application.rb:165:in `call' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.3.3/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.3.3/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.3.3/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.3.3/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads' App 2832 output: from /usr/local/lib/ruby/gems/2.3.0/gems/passenger-5.3.3/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception' [ W 2018-07-09 12:30:40.3159 1717/T7 age/Cor/Con/InternalUtils.cpp:96 ]: [Client 1-11] Sending 502 response: application did not send a complete response
試したこと
・rails routesでルーティングの設定は開発環境と同じように設定されていることを確認
・public/index.htmlをリネームし、view内のファイルを表示させようとしたところ、Incomplete response received from applicationと表示される。error_logに記載の通り、秘密鍵の設定ができていない旨のエラーですが、本番環境構築時の動作確認時に表示され、該当の設定したことで事象は解消され、public/index.htmlの表示がされることを確認しました。そのため、秘密鍵の設定は問題ないと思っています。
補足情報(FW/ツールのバージョンなど)
OS:Centos6.9
フレームワーク : Rails 4.2.9
Web:apache 2.2
DB : MySQL 5.6
ruby:2.3.7
Phusion Passenger: 5.3.3
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/09 04:49
2018/07/09 05:05
2018/07/09 07:37