2

Serval 天后测试如何在 AWS EC2 上部署我的 ROR 项目。橡胶,eb,最后我决定使用 OPSWORKS,因为youtube 上有一个视频。但是部署还是很辛苦的。

  • 好的,我的问题是:如何在 AWS OpsWorks 上调试 Ruby On Rails?

我知道

  1. 在 Web 控制台中,我们可以获取部署日志。
  2. 通过ssh,我们可以在/var/log/nginx/路径下得到[apptest].access.log,error.log,access.log(我用nginx和Unicorn测试)

但下面所有的都是关于部署的日志,很少有关于访问网站的日志/信息。例如:(test.access.log

133.255.255.124 - - [25/Jun/2014:15:10:03 +0000] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.76.4 (KHTML, like Gecko) Version/7.0.4 Safari/537.76.4"
133.255.255.124 - - [25/Jun/2014:15:10:19 +0000] "GET / HTTP/1.1" 500 5 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.76.4 (KHTML, like Gecko) Version/7.0.4 Safari/537.76.4"

当我得到 500 时,我在哪里可以找到有关此信息的详细信息?这是nginx中的error.log

 1. 2014/06/25 13:35:59 [emerg] 5502#0: still could not bind()
 2. 2014/06/25 15:23:06 [crit] 11593#0: *2 connect() to
    unix:/srv/www/test/shared/sockets/unicorn.sock failed (2: No such
    file or directory) while connecting to upstream, client:
    133.255.255.124, server: test, request: "GET / HTTP/1.1", upstream: "http://unix:/srv/www/test/shared/sockets/unicorn.sock:/", host:
    "55.218.118.37"

你可以在 500 return 期​​间发现,error.log 信息是无用的,access.log也没什么可显示的。

  • 访问测试网站时,我在哪里可以获得详细的调试信息,例如 tomcat 服务器 非常感谢。

这是 unicorn.stderr.log 中的内容,而 production.log unicorn.stdout.log 没什么可显示的。即使我config.log_level = :debug在 production.rb 中设置并重新启动 Web 服务器。

I, [2014-06-25T23:45:18.172877 #6436]  INFO -- : executing ["/home/deploy/.bundler/test/ruby/2.0.0/bin/unicorn_rails", "--env", "production", "--daemonize", "-c", "/srv/www/test/shared/config/unicorn.conf", {10=>#<Kgio::UNIXServer:fd 10>}] (in /srv/www/test/releases/20140625234506)
I, [2014-06-25T23:45:19.196006 #6436]  INFO -- : inherited addr=/srv/www/test/shared/sockets/unicorn.sock fd=10
I, [2014-06-25T23:45:19.196505 #6436]  INFO -- : Refreshing Gem list
I, [2014-06-25T23:45:23.769647 #6449]  INFO -- : worker=0 ready
I, [2014-06-25T23:45:23.811102 #6436]  INFO -- : master process ready
I, [2014-06-25T23:45:23.848092 #6452]  INFO -- : worker=1 ready
I, [2014-06-25T23:45:24.129596 #5830]  INFO -- : reaped #<Process::Status: pid 5852 exit 0> worker=0
I, [2014-06-25T23:45:24.129878 #5830]  INFO -- : reaped #<Process::Status: pid 5855 exit 0> worker=1
I, [2014-06-25T23:45:24.129967 #5830]  INFO -- : master complete
4

1 回答 1

5

登录后您需要执行以下操作:

sudo su deploy
cd /srv/www/#{application_name}/shared/log/

这些文件存储在:

/srv/www/#{application_name}/shared/log
➜  log  ls -lsh *.log
 32K -rw-r--r-- 1 deploy www-data  32K Jun 25 20:45 cron-error.log
4.0K -rw-r--r-- 1 deploy www-data 1.6K Jun 25 20:30 cron.log
192K -rw-r--r-- 1 deploy www-data 188K Jun 25 20:45 newrelic_agent.log
 48M -rw-r--r-- 1 deploy www-data  47M Jun 25 20:55 staging.log
   0 -rw-r--r-- 1 deploy www-data    0 Jun 24 06:46 unicorn.stderr.log
4.0K -rw-r--r-- 1 deploy www-data 3.1K Jun 25 08:49 unicorn.stdout.log

注意:#{application_name} 是您的应用程序的简码。

于 2014-06-25T20:57:24.047 回答