I’ve use the one click Ruby on Rails image to create a droplet. I’ve cloned my project in /home/rails/project-name and installed all dependancies and migrated the database. I’ve also created a virtual host configuration file in sites-available and added a symbolic link to sites enabled.
I’ve edited /etc/systemd/system/rails.service to changed the path. I’ve reloaded/refreshed the unit file and restarted the rails service and rebooted the server.
The problem I have is that my application won’t work unless I start puma manually (if I don’t nginx shows a 502 error).
If I start the puma server manually everything works fine but it shuts down as soon as I exit the terminal.
Please can someone help me figure out what the issue might be? This happens when both I listen on port 3000 and using a unix socket. It even happens for a fresh rails installation. The only difference in my app and the example app is that I use MySql instead of Postgres…
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!
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.
Click below to sign up and get $200 of credit to try our products over 60 days!
Try seeing the output of
Take a look if it shows: " Environment: development"… somewhere in the Puma output.
I was able to add any Environment Variable I needed in the file: /etc/systemd/system/rails.service using the format
I achieved removal the 5XX Server Error after affected services were restarted and
systemctl daemon-reloadused. So add-to-that:
systemctl restart nginx
systemctl restart rails(…if not a full reboot).
In actuality, mine config turned out to be more like:
Some more thoughts: A point of consumption for me is confusing ENV Vars, particularly if whether they are being set, or benignly stored in /root/.passwords.digitalocean.or.something
The /root/.dot-file location seems to indeed be benign, (but also a good place to copy the above-needed environment variables from.)
I will research if there is a more appropriate place for these environment settings I describe in this post. So, if you have info, please share.
I’ve ran into the same roadblock. I get 502 bad gateway and I can’t seem to get Puma to serve the app (even if I run it from the terminal and keep it running there). Any luck anyone, or @digitalocean ?
I’m facing the same issue with my server (same config as yours). While I haven’t found any solutions yet, I noticed that their original setup does not work either. When you create a new droplet and try accessing the url (droplet’s IP), it shows a NGINX page, not at all a Rails page. Also, if you take a look at their
/home/rails/exampleapp, it’s just an empty shell, there’s not even a view to be render. With Puma, NGINX should normally implement an
upstreamwhich is not present in
Is there a member of Digitalocean team that could help us understand this ? What’s the point of a one-click app if the setup is not working properly ? Not blaming you guys (you are doing an amazing work), just trying to understand.
I’ll keep you posted if I found any clues, will try to set this up as if the server was a fresh install without Rails/Ruby/Puma.