Bye
Bye

Reputation: 768

Rails: use Capistrano to deploy, how to check log when error happens?

I am deploying a rails add using Capistrano on remote Ubuntu 14.04 server.

Finally when I restart nginx, web page shows an error

We're sorry, but something went wrong.

I hope to know what cause the error, what command can I use to see log from remote server enter image description here

Upvotes: 1

Views: 5200

Answers (1)

omair azam
omair azam

Reputation: 580

try

bundle exec tail -f log/production.log

if no error is seen there then first check your nginx logs at

tail -f /var/log/nginx/access.log
or
tail -f /var/log/nginx/error.log

if you see some request logging there then that means request is coming to server and its not passing to puma server.

There can be two reasons about why request is not being passed to puma, either your address of puma process is not correct in nginx file or puma server is not running or there was some error and puma was shutdown when request reached it.

to see puma process use this command

ps aux | grep puma

it should print one line out of many lines

app      22528  0.1  0.5 296532 23912 ?        Ssl  16:42   0:00 puma 2.11.1 (tcp://0.0.0.0:8080) [20180110213633]

now using this information I can map address like this in nginx

upstream app {
     # Path to Puma SOCK file, as defined previously

    server 0.0.0.0:8080;

 }

here I bind the puma local ip with port to nginx process.

Make sure your puma.rb binds properly to puma.sock file as for one of my project I am doing like this in config/puma.rb

 bind "unix:///Users/Apple/RAILS_PROJECTS/tracker/tmp/sockets/puma.sock"

Upvotes: 5

Related Questions