Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
I responded on twitter, you would be much better served with using Capistrano. It’s 6 steps to get the server up and running and you get an easily automated deploy.
Hi, Nice tutorial, Can you make tutorial on How to install Ruby on Rails with nginx + unicorn + postgresql for Ubuntu? many thanks!
I have a question about the NginX’s default.conf file that you provide. In the line
root /root/my_app/public;
are we supposed to replace “/root/my_app” with the full path to the app or simply substitute “my_app” with the real name of our app (as in leave /root/ there)? I keep getting errors that have to do with that line.
I first followed the Initial server setup with ubuntu tutorial (https://www.digitalocean.com/community/articles/initial-server-setup-with-ubuntu-12-04) , which told me to create a second user and never log in as root. Now when I try to call “rails new test-app” here in the www directory, it doesn’t have permission to create subdirectories. It works if I give full access to everyone on the “www” folder, but that doesn’t seem very secure. What should I be doing to make this work?
I’ve followed this tutorial for a working rails app instead of generating a new one, but it doesn’t teach you how to properly set the nginx permissions to serve up files besides the standard index.html in public - how does one do that?
I this article and other article it is written that unicorn can server multiple concurrent requests by forking, and we should use 2 - 4 worker processes, as written here. So every time a request comes a new child process is forked and the request is full filled, I am interested in knowing how much concurrent request can the server fulfill ? Can it server 10,000 concurrent requests, C10K ?
A very nice article!
A few questions though.
# Unicorn socket
listen "/tmp/unicorn.[app name].sock"
listen "/tmp/unicorn.myapp.sock"
Is the line
listen "/tmp/unicorn.[app name].sock"
really necessary? Or should it be commented out only for example purpose? I did and it works for me.
When I put the unicorn.pid file directory under my application root path and run unicorn, an error occurs that says, “Unwritable file /path/to/my_app/unicorn.pid”. Although we may use sudo for workaround, I thought a better solution is to put the unicorn.pid under the tmp directory, just as the default WEBrick server does.
config/unicorn.rb is a Ruby file, that means we can define variables in it. So I think we should define the application root path and use that for the pid and log files, which is more “DRY”.
#application root path
app_root = "/var/www/my_app"
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory app_root
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "#{app_root}/tmp/pids/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "#{app_root}/log/unicorn.log"
stdout_path "#{app_root}/log/unicorn.log"
Thank you!
Great tutorial.
I happend to have written an entire ebook on more or less the exact same topic (setting up a server from scratch and deploying a sample application). It is intended to help you understand how the process works under the hood and covers a nginx/Unicorn/MySQL/rbenv setup.
You can get it here (it’s free for people on my mailing list).
This comment has been deleted