Rails/Nginx: Routes work on dev not on prod - ruby-on-rails

My application works perfectly in my development environment, but routes don't work in my production server running nginx and Passenger, where I get:
404 Not Found
However, the index page does work as well as CSS and JavaScript.
I thought it was related to locale or i18n issues, but by changing routes.rb to remove :locale I got the same output.
Routes:
$ rake routes
Prefix Verb URI Pattern Controller#Action
GET /:locale(.:format) welcome#index
services GET /:locale/services(.:format) welcome#services
projects GET /:locale/projects(.:format) welcome#projects
contact GET /:locale/contact(.:format) welcome#contact
GET /:locale(.:format) welcome#index
root GET / welcome#index
rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show
rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show
update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
Nginx/site-enable:
server {
listen 80;
listen [::]:80;
root /var/www/test.com/public;
index index.html index.htm index.nginx-debian.html;
server_name test.com www.test.com;
# Turn on Passenger
passenger_enabled on;
passenger_ruby /home/ubuntu/.rbenv/versions/2.5.1/bin/ruby;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
I'm using:
- Ruby 2.5.1
- gem 'rails', '~> 5.2.0'
production.log shows the rendering of the Welcome page but not /en/services for example when trying to go there:
I, [2020-02-23T17:08:28.146331 #19532] INFO -- : [4cd74925-0637-4b92-92aa-12f693691ecb] Processing by WelcomeController#index as HTML
I, [2020-02-23T17:08:28.146998 #19532] INFO -- : [4cd74925-0637-4b92-92aa-12f693691ecb] Rendering welcome/index.html.erb within layouts/application
I, [2020-02-23T17:08:28.147227 #19532] INFO -- : [4cd74925-0637-4b92-92aa-12f693691ecb] Rendered welcome/index.html.erb within layouts/application (0.1ms)
I, [2020-02-23T17:08:28.148286 #19532] INFO -- : [4cd74925-0637-4b92-92aa-12f693691ecb] Completed 200 OK in 2ms (Views: 1.4ms)
nginx/error.log:
[ N 2020-02-23 17:13:07.1716 25594/T1 age/Wat/WatchdogMain.cpp:1373 ]: Starting Passenger watchdog...
[ N 2020-02-23 17:13:07.1994 25602/T1 age/Cor/CoreMain.cpp:1340 ]: Starting Passenger core...
[ N 2020-02-23 17:13:07.1995 25602/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2020-02-23 17:13:07.2058 25602/T1 age/Cor/CoreMain.cpp:1015 ]: Passenger core online, PID 25602
nginx/access.log:
[23/Feb/2020:17:14:23 +0000] "GET /favicon.ico HTTP/1.1" 200 0 "http://www.XXX.fr/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36"
[23/Feb/2020:17:14:28 +0000] "GET /en/services HTTP/1.1" 404 209 "http://www.XXX.fr/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36"
How do I fix this?

I would start by looking into log file of your application, 404 response could be caused by many elements of your stack.
When you open your application root page you should see a request logged to log/production.log file (assuming this is in production environment). If you don't see it, look up the stack at nginx error log (normally Passenger is using this one for stderr).

I resolved by commenting the "location" part of the nginx conf:
# location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
# try_files $uri $uri/ =404;
# }

Related

Duplicated request info log in Rails 5 server only app

I have a Rails 5.2.3 application with Ruby 2.4.5.
I found a weird issue that the request info are logged twice in stdout.
Here is the log config in config/environments/product.rb
config.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT))
config.log_tags = [ lambda {|req| "#{req.cookie_jar["_session_id"]}" }, :remote_ip, :uuid ]
Supposedly it will tag every log with the remote ip and request uuid, and it does for most of logs, except there is a weird additional log for the request. In following example, the last line is a duplicated log for the request without the tag:
[INFO] [2019-10-28 06:11:45 UTC] [127.0.0.1] [f6de1900-a7e5-4486-8b73-7095d0cacb35] Started GET "/api/v1/nodes?pageSize=20&pageNumber=1" for 127.0.0.1 at 2019-10-28 06:11:45 +0000
[INFO] [2019-10-28 06:11:45 UTC] [127.0.0.1] [f6de1900-a7e5-4486-8b73-7095d0cacb35] Processing by Api::V1::NodesController#index as XML
...
...
[INFO] [2019-10-28 06:20:02 UTC] [127.0.0.1] [993e0db4-3995-41ef-851a-bfea1bc25781] Completed 200 OK in 1084ms (Views: 341.9ms | ActiveRecord: 150.6ms)
127.0.0.1 - - [28/Oct/2019:06:20:02 +0000] "GET /api/v1/nodes?pageSize=20&pageNumber=1 HTTP/1.1" 200 - 1.1347
I checked configurations, there is no any other logger configured.
The consequence is that there is a timer in client side to check notification status by every 5 seconds. I added a log silencer to avoid log such request:
# config/application.rb
config.middleware.insert_before Rails::Rack::Logger, LogSilencer, silenced: /notification_messages/
# lib/log_silencer.rb
class LogSilencer
def initialize(app, opts = {})
#app = app
#silenced = opts.delete(:silenced)
end
def call(env)
if #silenced.match(env['PATH_INFO'])
Rails.logger.silence do
#app.call(env)
end
else
#app.call(env)
end
end
end
It does avoid logging from the tagged logger, but the duplicated request logs are still there, then the stdout is full of this request
127.0.0.1 - - [28/Oct/2019:07:04:21 +0000] "GET /api/v1/notification_messages/to_notify HTTP/1.1" 200 - 0.0118
127.0.0.1 - - [28/Oct/2019:07:04:26 +0000] "GET /api/v1/notification_messages/to_notify HTTP/1.1" 200 - 0.0140
127.0.0.1 - - [28/Oct/2019:07:04:31 +0000] "GET /api/v1/notification_messages/to_notify HTTP/1.1" 200 - 0.0137
127.0.0.1 - - [28/Oct/2019:07:04:36 +0000] "GET /api/v1/notification_messages/to_notify HTTP/1.1" 200 - 0.0149
...
Spent a whole day try to find out who generated this log, but no any clue...
Would like to ask for help on how to turn off this log so make the log data clear...
Thanks!
Seems the logs come from the web server used when up the Rails app.
When use WEBrick, the log is like
=> Booting WEBrick
=> Rails 5.2.3 application starting in development on http://localhost:4000
=> Run `rails server -h` for more startup options
[2019-10-30 07:01:13] INFO WEBrick 1.3.1
[2019-10-30 07:01:13] INFO ruby 2.4.5 (2018-10-18) [x86_64-linux]
[2019-10-30 07:01:13] INFO WEBrick::HTTPServer#start: pid=5812 port=4000
127.0.0.1 - - [30/Oct/2019:07:01:17 UTC] "GET /test HTTP/1.1" 304 0
- -> /test
When use unicorn, the log is like:
I, [2019-10-30T07:02:47.626962 #5956] INFO -- : Refreshing Gem list
I, [2019-10-30T07:02:48.289373 #5956] INFO -- : listening on addr=0.0.0.0:4000 fd=17
I, [2019-10-30T07:02:48.393598 #5956] INFO -- : master process ready
I, [2019-10-30T07:02:48.394853 #5965] INFO -- : worker=0 ready
I, [2019-10-30T07:02:48.399878 #5968] INFO -- : worker=1 ready
127.0.0.1 - - [30/Oct/2019:07:02:52 +0000] "GET /test HTTP/1.1" 304 - 0.0724
I can find that the request log format is a bit different (the time zone info, the time consumed etc).
I use Unicorn, its logger by default uses stderr, but seems the logger configuration does not work
logger Logger.new("#{rails_root}/log/unicorn.log")
so I have to set the stderr path
stderr_path "#{rails_root}/log/unicorn.stderr.log
Then the request logs are in the unicorn.stderr.log file, and STDOUT are the rails app logs.
But still dont know how to turn it off since it is a kind of duplicated and useless log...

Ubuntu - Apache: Passenger not launching Rails app at all

I'm working on Ubuntu 16.04 with Apache. I try to start my rails application with Phusion Passeger. But the application is not started at all, I get HTML 403 "You don't have permission to access /kainji/ on this server" if I enter the URL: http://poyry.wo.local/kainji and the only log in other_vhosts_access.log:
poyry.wo.local:80 127.0.0.1 - - [13/Dec/2018:15:19:28 +0100] "GET /kainji/ HTTP/1.1" 403 513 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36" 2265
I have the following file in sites-available directory linked into sites-enabled directory:
<VirtualHost *:80>
ServerName poyry.wo.local
DocumentRoot /var/www/html/dev/rails
<Directory /var/www/html/dev/rails>
Options -Indexes
Allow from all
</Directory>
PassengerBaseURI /kainji
<Directory /var/www/html/dev/rails/v2p0-kanji/public>
RailsEnv development
Options -MultiViews
</Directory>
</VirtualHost>
If I remove the link I get HTML 404: "The requested URL /kainji was not found on this server." what is correct.
In Apache error log I see, that Passenger was started:
[ 2018-12-12 14:17:41.8778 4321/7efdbb745780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2018-12-12 14:17:41.8885 4324/7f0b49b28780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2018-12-12 14:17:41.8886 4324/7f0b49b28780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2018-12-12 14:17:41.8908 4324/7f0b49b28780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 4324
[ 2018-12-12 14:17:41.9045 4356/7fd543c3b780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2018-12-12 14:17:41.9051 4356/7fd543c3b780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 4356
[Wed Dec 12 14:17:42.201857 2018] [ssl:warn] [pid 4318] AH01909: centos1.tibi1959.hu:443:0 server certificate does NOT include an ID which matches the server name
[Wed Dec 12 14:17:42.209447 2018] [mpm_prefork:notice] [pid 4318] AH00163: Apache/2.4.18 (Ubuntu) Phusion_Passenger/5.0.29 OpenSSL/1.0.2g configured -- resuming normal operations
[Wed Dec 12 14:17:42.209484 2018] [core:notice] [pid 4318] AH00094: Command line: '/usr/sbin/apache2'
Also the validating of the passenger installation is OK:
$ /usr/bin/passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'
⬢ Passenger itself
‣ ⬢ Apache
-------------------------------------------------------------------------
Checking whether there are multiple Apache installations...
Only a single installation detected. This is good.
-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
* Checking whether Apache is installed... ✓
* Checking whether the Passenger module is correctly configured in Apache... ✓
Everything looks good. :-)
What is wrong?
From a first look, I would guess that the issue is caused by the static file service overriding the application.
The 403 error is due to the fact that directory listings are disabled and there's no index.html file to display.
You might want to change the way you set up the static file service, so the url requires the "public" folder name. This way, you could set the application server to route to the /kainji path.
Maybe something like:
```
ServerName poyry.wo.local
DocumentRoot /var/www/html/dev/rails/kainji/public
PassengerBaseURI /kainji
RailsEnv development
Options -MultiViews
```

Rails 5.1.5 - 500 Errors Without Info In Logs

I am running a Rails 5.1.5 app with webpacker 3.2.2, postgres 9.4, apache2, and passenger. I am not sure what other info is relevant here but can edit as necessary.
My app works locally in development. After I deploy to the server, it will work but eventually gives a 500 error on certain pages from 2 different model/controller actions.
Here is the access log that does not give much info:
71.143.443.562 - - [28/Feb/2018:19:15:11 -0700] "GET /posts/jewelry-appraisals-got-even-easier HTTP/1.1" 500 497 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML,$
I am not sure why and do not know how to reproduce the error (or where to find it). Any ideas? Thank you!
Update -
Here is the apache2 error.log
[ N 2018-02-28 15:56:07.0526 1243/T3 age/Cor/CoreMain.cpp:917 ]: Checking whether to disconnect long-running connections for process 1416, application /var/www/sellmyjewelry/current (productio$
here is my rails production.log:
I, [2018-03-01T02:59:04.227988 #6241] INFO -- : [a45553e8-7b89-45ad-ba05-dade585c17d4] Completed 401 Unauthorized in 2ms (ActiveRecord: 0.4ms)
F, [2018-03-01T02:59:04.228965 #6241] FATAL -- : [a45553e8-7b89-45ad-ba05-dade585c17d4]
F, [2018-03-01T02:59:04.229058 #6241] FATAL -- : [a45553e8-7b89-45ad-ba05-dade585c17d4] NoMethodError (To respond to a custom format, register it as a MIME type first: http://guides.rubyonrails.org$
F, [2018-03-01T02:59:04.229093 #6241] FATAL -- : [a45553e8-7b89-45ad-ba05-dade585c17d4]
F, [2018-03-01T02:59:04.229149 #6241] FATAL -- : [a45553e8-7b89-45ad-ba05-dade585c17d4] actionpack (5.1.5) lib/abstract_controller/collector.rb:26:in `method_missing
'
Update #2
I made it so all the errors are local. I get a "Mime-Type" error on pages that use the method .html_safe on longer pieces of content. I added mime types in the initialize file but still get the error.
Here is a screenshot of the error I get:
Thanks for the help.

nginx redirects POST requests to GET request

I have Rails 4.1 application with runs on puma web server. I use nginx as a proxy server. Several days ago everything worked very well. I updated my application, and suddenly some POST requests started to redirected to same url but as GET request. I've tried rollback to previous working versions, no success.
I found very interesting behaviour. I tested my API with curl.
If I did POST request to the url
http://myapp.com/tasks/easy_task/calculate/ it redirects to same url
but as GET request.
Then I did POSTrequest to http://myapp.com/, returned 404
Then I did POSTrequest to http://myapp.com/tasks, returned 404
Then I did POSTrequest to http://myapp.com/tasks/easy_task, returned 404
Then I did POSTrequest to http://myapp.com/tasks/easy_task/calculate, returned 200. YAY!
Same thing happened when I used chrome's app Postman. First it redirected, but after previous steps it works well.
I use this app in my other application. I use RestClient to make http requests. When I try to make POST request it raises an exception RestClient::MovedPermanently (301 Moved Permanently).
I reinstalled nginx to 1.7.3.
Restarted server (virtual machine)
re deployed my app, deployed previous versions
no success :(
I found similar questions on stackoverflow, but non of them gave me clue to fix this issue. I hope you can help me to solve this problem. Thanks in advance!
Similar questions:
- POST request turns into GET request
- POST request mysteriously turn into GET request
nginx config:
$ cat /etc/nginx/sites-enabled/myapp.com.conf
# The file generated by Chef for mycompany
upstream myapp_mycompany_com {
server unix:/tmp/myapp.com-puma.sock;
}
server {
server_name myapp.com;
listen 80;
access_log /var/log/nginx/myapp.com-access.log;
error_log /var/log/nginx/myapp.com-error.log;
root /home/projects/mycompany/myapp.com/current/public;
gzip on;
gzip_types text/plain text/xml application/xml application/xml+rss
text/css text/javascript application/javascript application/json;
error_page 551 =503 #maintenance;
location #maintenance {
rewrite ^(.*)$ /system/maintenance.html break;
}
set $maintenance 0;
if (-f $document_root/system/maintenance.html) {
set $maintenance 1;
}
if ($request_uri = /favicon.ico) {
# Browsers will try to get favicon if it's not returned with 200ok status
set $maintenance 0;
}
if ($maintenance) {
# There can be several reasons for 503 error. We custom return 551 error
# to ensure maintenance.html is only shown when it's really maintenance
return 551;
}
rewrite ^/(.*)/$ /$1 permanent; # Truncate trailing slashes
try_files $uri #rails;
expires -1;
location = /favicon.ico {
try_files $uri =204;
access_log off;
log_not_found off;
}
location #rails {
proxy_pass http://myapp_mycompany_com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_intercept_errors on;
expires -1;
}
error_page 500 502 503 504 /500.html;
error_page 403 /403.html;
error_page 404 /404.html;
client_max_body_size 50M;
keepalive_timeout 10;
}
Puma
$ bundle exec puma -d -e production -b unix:///tmp/myapp.com-puma.sock --pidfile /home/projects/mycompany/myapp.com/shared/tmp/pids/puma.pid
$
Example of access.log
123.123.123.123 - - [11/Jul/2014:05:44:17 +0000] "POST /tasks/easy_task/calculate/ HTTP/1.1" 301 184 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
123.123.123.123 - - [11/Jul/2014:05:44:17 +0000] "GET /tasks/easy_task/calculate HTTP/1.1" 404 713 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
...
123.123.123.123 - - [11/Jul/2014:06:04:17 +0000] "POST / HTTP/1.1" 404 713 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
123.123.123.123 - - [11/Jul/2014:06:04:26 +0000] "POST /tasks HTTP/1.1" 404 713 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
123.123.123.123 - - [11/Jul/2014:06:04:36 +0000] "POST /tasks/easy_task HTTP/1.1" 404 713 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
123.123.123.123 - - [11/Jul/2014:06:04:42 +0000] "POST /tasks/easy_task/calculate HTTP/1.1" 200 104 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2073.0 Safari/537.36"
TL;DR
If you want to completely redirect to a new resource and method and body of the requests should not be changed use 308 instead of 301 or 302.
301 is permanent redirect but 302 is temporary so search engines don't change urls associated with that website when 302 is used.
301 and 302 indicated method and body should not be altered, but not all user agents align with that. Read this explanation from Mozilla:
The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location header. A browser redirects to this page but search engines don't update their links to the resource (in 'SEO-speak', it is said that the 'link-juice' is not sent to the new URL). Even if the specification requires the method (and the body) not to be altered when the redirection is performed, not all user-agents conform here - you can still find this type of bugged software out there. It is therefore recommended to set the 302 code only as a response for GET or HEAD methods and to use 307 Temporary Redirect instead, as the method change is explicitly prohibited in that case. In the cases where you want the method used to be changed to GET, use 303 See Other instead. This is useful when you want to give a response to a PUT method that is not the uploaded resource but a confirmation message such as: 'you successfully uploaded XYZ'.
308 and 307 both permanently redirect to a new resource but they guarantee body and method of request won't be altered. the difference is that 308 is permanent and 307 is temporary, so 308 will signal search engines to change urls. see this:
The only difference between 307 and 302 is that 307 guarantees that the method and the body will not be changed when the redirected request is made. With 302, some old clients were incorrectly changing the method to GET: the behavior with non-GET methods and 302 is then unpredictable on the Web, whereas the behavior with 307 is predictable. For GET requests, their behavior is identical.
I've found solution. When I did POST request, I used url which ends with slash, like http://myapp.com/tasks/easy_task/calculate/
When I used url without slash in the end, like http://myapp.com/tasks/easy_task/calculate everything works perfectly!
I think it is because of this rule
rewrite ^/(.*)/$ /$1 permanent; # Truncate trailing slashes
I am closing this issue. Tomorrow.
In my case, the redirect meant if I POST to http://... the proxy_pass is converted to a GET.
Change the URL to an https://... and it is passed on as a POST as intended.
location /dc1 {
proxy_pass http://localhost:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host www.example.com;
}

How to debug Ruby On Rails on AWS OpsWorks?

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
In the web console,we can get deploy log.
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
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.

Resources