Question

Rails application root not working - Rails One-Click droplet

I have been trying to deploy my rails application for a good part of this week now and have tried many, many, many times to try and get this working. I either hit a 502 bad gateway, a 504 gateway timeout or the page simply cannot be reached.

I have done the following already:

  • cloned my application from BitBucket into /home/rails/my-app-name
  • changed my DNS records so that my domain points to my droplet IP (using my domain name works for the default “rails_project”
  • ran nano /etc/unicorn.conf and changed the value to working_directory "/home/rails/my-app-name"
  • ran nano /etc/nginx/sites-enabled/rails and changed the value to root /home/rails/my-app-name/public;
  • ran service nginx reload && service unicorn restart

My favicon loads and I see that but the rails application just doesn’t load. My rails app works in production on a free Heroku dyno so I’m confident it’s not that

Thank you for any help you can provide, it is greatly appreciated!

Running nginx -t outputs this:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

This is my error log: [error] 13744#13744: *19 upstream timed out (110: Connection timed out) while reading response header from upstream, client: [IP Address], server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/run/DigitalOceanOneClick/unicorn.sock/", host: "[My Domain Name]"


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.

Hello friend!

That is a tough one. Based on the steps you’ve described, the software stack should function. I just copied your steps with a sample app and confirmed that it did operate, just to be sure. While that doesn’t necessarily say there is something wrong with your app, that is the direction you are going to want to look in as we narrow it down. It could be something environmental that is different in this server than another, and that being something that your app requires to function properly, for example. Such a thing like that would be more likely to reveal itself on the app side rather than the web server side.

My first thought is check /var/log/unicorn/unicorn.log and see if you see any errors which may correlate to this. I suspect that you will. If not, however, you may want to build some kind of error logging into the application’s launch that might expose any errors that are not being seen elsewhere. I realize that’s a pretty vague and high level ask, but that is where my instinct is going.

Feel free to share any findings here. If I cannot interpret them in a helpful way, perhaps someone else can. I’m always happy to try :)

Kind Regards, Jarland Platform Support Lead