Rails Server Setting Up
This tutorial I wrote when was quitting my previous job, almost one year ago. But it’s still handy!
Abstract Rails application setup
First you need to set up Puma for your specific project. For this purpose, add this
line to the
[sudo] bundle install.
When you are done, you should be able to create a Puma config file at
More details here: https://github.com/puma/puma/blob/master/examples/config.rb
Now, add project root path to the
/etc/puma.conf file, e. g.:
Start Puma at boot
There is a specific utility, called Jungle. It manages your applications’ instances at startup.
First of all, create
/etc/init/puma.conf file and fill it with this:
/etc/init/puma-manager.conf and fill it with this:
And create a blank
/etc/puma.conf file. This will be filled for each application separately.
You need to customise
- Set the right user your app should be running on unless you want root to execute it!
- Look for
setuid apps and
setgid apps, uncomment those lines and replace
apps to whatever your deployment user is.
apps on the paths (or set the right paths to your user’s home) everywhere else.
- Uncomment the source lines for
rvm support unless you use a system wide installation of Ruby.
Now, start Jungle like this:
sudo start puma-manager.
And all your applications should be available when you reboot the machine.
More details at https://github.com/puma/puma/tree/master/tools/jungle/
Starting up and shutting down
To start up the application is easy enough. Just navigate yourself to project directory and run the following:
puma -C config/puma.rb.
If you want to shut down one, run this command in the project directory:
[sudo] pumactl -S tmp/pids/puma.state halt.