2
votes

After Serval days testing for how to deploy my ROR project on AWS EC2. Rubber,eb,at last I decided to use OPSWORKS because of a video in youtube. But the deployment still hard.

  • OK,My question is:How to debug Ruby On Rails on AWS OpsWorks?

I've know

  1. In the web console,we can get deploy log.
  2. Via ssh,we can get [apptest].access.log,error.log,access.log in the path /var/log/nginx/(I test with nginx and Unicorn)

But all of below is log about deployment,and few logs/infos about access website. For example:(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"

while I got 500 .where can I found detail about this information? Here is error.log in nginx

 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"

you can find during 500 return ,error.log info is useless,and access.log is nothing to show.

  • Where Can I get detail Debug info while visit test website,like tomcat server Thanks a lot.

Here is something in unicorn.stderr.log,and production.log unicorn.stdout.log is nothing to show.even I set config.log_level = :debug in production.rb and restart the web server.

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
1

1 Answers

5
votes

You would need to do something like the following after logging in :

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

The files are stored under :

/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

NOTE : #{application_name} is whatever your shortcode is for the application.