Cloud 66

Puma rack server

Run your Rack apps with Puma

Contents

About running apps with Puma

Puma is a light-weight Rack server built for speed and parallelism. Cloud 66 uses the following signals to control Puma:

Stop the web server

sudo bluepill cloud66_web_server stop

Start the web server

sudo bluepill cloud66_web_server quit
sudo bluepill load /etc/bluepill/autoload/cloud66_web_server.pill

Restart the web server (hot-restart)

sudo bluepill cloud66_web_server restart

kill -USR2 <pid>

Deploy with Puma

You need to choose your web server at the time of initial build of the stack. Changes to or from Passenger (the default web server) will not be applied after your stack has initially been analyzed. You can however change freely between other supported servers by simply updating your Gems and Procfile.

To run a Puma Rack server, add a line to your Procfile labeled as custom_web. Here is an example:

custom_web: bundle exec puma -e $RACK_ENV -b unix:///tmp/web_server.sock --pidfile /tmp/web_server.pid -d

Take note that Puma is running in Daemon mode with the -d parameter.

Warning

Should you have any issues, please ensure that you are using an up-to-date version of Puma with the correct configurations.

We recommend that you run Unicorn, as you may have to handle server restarts manually with Puma.

To solve the issue of manual restarts with Puma, you can use an after_rails deploy hook to manually run the following command in case you find that it is not responding to the SIGUSR2 that Cloud 66 issues.

bundle exec pumactl -P /tmp/web_server.pid restart