Question

Rails One-Click times out after a git pull containing four files. accessing my site is a 504: Gateway Timeout

So, made some small changes to some files, the largest of which was the creation of a new javascript file and moving an existing javascript function to it. Committed them locally, pushed them to my remote master, then did a pull from my DO droplet. Ever since then, my site will not load in a client browser. The browser attempts to load the page and then produces an nginx 504 Gateway timeout message.

Server is running and pings. I can ssh to it.

Output of sudo systemctl status unicorn: <^>unicorn.service - “DigitalOcean Rails One-Click Application” Loaded: loaded (/etc/systemd/system/unicorn.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2017-05-30 20:40:45 UTC; 6min ago Main PID: 29346 (bash) Tasks: 5 Memory: 68.4M CPU: 6min 53.943s CGroup: /system.slice/unicorn.service ├─ 6026 unicorn_rails worker[0] -E production -c ./config/unicorn.rb
├─29346 /bin/bash /home/rails/popEFX/.unicorn.sh └─29512 unicorn_rails master -E production -c ./config/unicorn.rb

May 30 20:40:45 popEFX-ruby-rails-2gb-nyc2-01 systemd[1]: Started “DigitalOcean Rails One-Click Application”. May 30 20:40:45 popEFX-ruby-rails-2gb-nyc2-01 DigitalOceanRailsOneClick[29346]: Using /usr/local/rvm/gems/ruby-2.4.0 <^>

Output of sudo tail /var/log/unicorn/unicorn.log is over two weeks old

I, [2017-05-14T22:33:20.394874 #2329] INFO – : reaped #<Process::Status: pid 2331 exit 0> worker=0 I, [2017-05-14T22:33:20.395933 #2329] INFO – : reaped #<Process::Status: pid 2334 exit 0> worker=1 I, [2017-05-14T22:33:20.396801 #2329] INFO – : reaped #<Process::Status: pid 2337 exit 0> worker=2 I, [2017-05-14T22:33:20.397624 #2329] INFO – : reaped #<Process::Status: pid 2340 exit 0> worker=3 Exception `Errno::ECHILD’ at /home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:399 - No child processes I, [2017-05-14T22:33:20.397810 #2329] INFO – : master complete

Output of sudo tail /var/log/nginx/error.log 2017/05/30 20:30:37 [notice] 2126#2126: signal process started 2017/05/30 20:32:05 [error] 2135#2135: *46 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 74.109.5.103, server: _, request: “GET / HTTP/1.1”, upstream: “http://unix:/run/DigitalOceanOneClick/unicorn.sock/”, host: “107.170.79.150” 2017/05/30 20:42:20 [error] 2135#2135: *51 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 74.109.5.103, server: _, request: “GET / HTTP/1.1”, upstream: “http://unix:/run/DigitalOceanOneClick/unicorn.sock/”, host: “107.170.79.150”

So all I know is that unicorn is not communicating with nginx. No idea why. This was working fine up until this most recent git pull.

Things I have tried that have not fixed the issue:

service unicorn restart service nginx reload

restarting my server

gem install bundle bundle install bundle update

manually removing the Gemfile.lock file and running bundle install again

rake assets:precompile

in unicorn.conf, Changing the line

listen "unix:/run/DigitalOceanOneClick/unicorn.sock"

to

listen "/run/DigitalOceanOneClick/unicorn.sock"

manually removing the unicorn.sock file and verifying it is regenerated with a unicorn restart.


What further can I do to troubleshoot this problem? Why did this happen? How can I fix it?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @jcspampinato

Without knowing a lot about Rails, you need to add some logging in your Unicorn configuration, since it seems like that’s where the issue is. https://stackoverflow.com/questions/41074666/how-to-check-logs-for-rails-application-on-unicorn-and-nginx http://help.papertrailapp.com/kb/configuration/unicorn/

Also, can you post you Nginx server block - and use the </> in the toolbar of the comment editor to display it as clean code.