0

それで、私はここ数週間、最初の (実際の) Rails アプリに取り組んでおり、昨日、Rubber gem を使用して Amazon EC2 にデプロイしようとしました。実際のプロジェクトを展開する前に、私は自分に言い聞かせました: 完全に新鮮で単純なプロジェクトでゴムを試してみて、それが機能するかどうかを確認してみましょう. この [railscast][1] の手順を実行した後、すべてが単純なプロジェクトで機能しました。そこで、以前と同じ手順を実行して実際のプロジェクトをデプロイしようとしました。Rubber はすべての Capistrano スクリプトを実行し、すべてがうまくいったように見えました。しかし、Web サイトにアクセスしようとすると、次のエラーが表示されます: 503 Service Unavailable

ラバーテンプレート「complete_passenger_postgresql」を使用しました。デプロイに成功した簡単なプロジェクトと実際のプロジェクトのラバー設定は基本的に同じです。違いは、アプリの実際のコンテンツにあります。

ログ ファイルを確認した後、次のエラーに遭遇しました。

Apache エラー ログ:

    [Thu Dec 13 14:24:02 2012] [notice] Apache/2.2.22 (Ubuntu) configured -- resuming normal operations
[Thu Dec 13 14:24:10 2012] [notice] Graceful restart requested, doing restart
[Thu Dec 13 14:24:10 2012] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 configured -- resuming normal operations
[Thu Dec 13 14:24:10 2012] [notice] caught SIGTERM, shutting down
[Thu Dec 13 14:24:12 2012] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Thu Dec 13 14:24:12 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Thu Dec 13 14:24:12 2012] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Thu Dec 13 14:24:51 2012] [notice] caught SIGTERM, shutting down
[Thu Dec 13 14:26:26 2012] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Thu Dec 13 14:26:26 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Thu Dec 13 14:26:26 2012] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Thu Dec 13 14:50:55 2012] [notice] caught SIGTERM, shutting down
[Thu Dec 13 14:51:50 2012] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Thu Dec 13 14:51:50 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Thu Dec 13 14:51:51 2012] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Thu Dec 13 14:54:49 2012] [notice] caught SIGTERM, shutting down
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] RSA server certificate CommonName (CN) `production.test.com' does NOT match server name!?
[Thu Dec 13 14:57:48 2012] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 13 14:57:48 2012] [warn] mod_wsgi: Compiled for Python/2.7.2+.
[Thu Dec 13 14:57:48 2012] [warn] mod_wsgi: Runtime using Python/2.7.3.
[Thu Dec 13 14:57:48 2012] [notice] Apache/2.2.22 (Ubuntu) proxy_html/3.0.1 mod_ssl/2.2.22 OpenSSL/1.0.1 mod_wsgi/3.3 Python/2.7.3 Phusion_Passenger/3.0.17 configured -- resuming normal operations
[Thu Dec 13 14:57:53 2012] [crit] [client XX.XXX.XXX.XX] (13)Permission denied: /mnt/test_core-production/releases/20121213133228/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Thu Dec 13 14:57:55 2012] [crit] [client XX.XXX.XXX.XX] (13)Permission denied: /mnt/test_core-production/releases/20121213133228/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Thu Dec 13 14:57:57 2012] [crit] [client XX.XXX.XXX.XX] (13)Permission denied: /mnt/test_core-production/releases/20121213133228/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
Last Line repeats like a 1000 times.

Cron-SH-バンドルのログ:

rubber:cron running ["bundle", "exec", "rake", "subscriptions:send"] at 2012-12-13 20:15:06 +0100
rake aborted!
uninitialized constant ActiveRecord
/mnt/test_core-production/shared/bundle/ruby/1.9.1/gems/ancestry-1.3.0/lib/ancestry/has_ancestry.rb:1:in `<top (required)>'
/mnt/test_core-production/shared/bundle/ruby/1.9.1/gems/ancestry-1.3.0/lib/ancestry.rb:4:in `require'
/mnt/test_core-production/shared/bundle/ruby/1.9.1/gems/ancestry-1.3.0/lib/ancestry.rb:4:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/usr/local/rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/usr/local/graylog2-web-interface-0.9.6p1/config/application.rb:16:in `<top (required)>'
/usr/local/graylog2-web-interface-0.9.6p1/Rakefile:4:in `require'
/usr/local/graylog2-web-interface-0.9.6p1/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

Rails プロダクション ログ

Connecting to database specified by database.yml
Compiled jquery.js  (2ms)  (pid 23834)
Compiled jquery-ui.js  (7ms)  (pid 23834)
...
Connecting to database specified by database.yml
Migrating to CreateUsers (20120903114829)
...
Connecting to database specified by database.yml
Connecting to database specified by database.yml
PG::Error: connection not open // <-- I think this happens while seeding data
: UPDATE "delayed_jobs" SET locked_by = null, locked_at = null WHERE (locked_by = 'delayed_job host:production.test.com pid:24702')

ジェム「Ancestry」がこの問題を引き起こしているのではないでしょうか? また、「許可が拒否されました」というエラーはどうですか?

助けてくれてどうもありがとう!

4

1 に答える 1

0

上記の問題を次の方法で解決できました。

まず、Rails プロジェクトのディレクトリとファイルに適切な権限を適用して付与しました

sudo chmod -R 777 ProjectDirectory

これにより、Apache パーミッション エラーが解決されました。この問題が発生した理由は、別の Windows および Linux マシンでプロジェクトを作成し、それを Mac にデプロイしようとしたためです。簡単なテスト プロジェクトは、デプロイしたのと同じマシンで作成したため、機能しました。

次に、次のコード行を see.rb ファイルに追加して、「uninitialized constant ActiveRecord」エラーを取り除きました。

require 'active_record'

これらの調整の後、ゴムを使用してすべてをもう一度展開しましたが、機能しています:-)

于 2012-12-14T10:42:09.597 に答える