puma

Configure puma servers for Ruby-on-Rails apps

Deversus Software Inc.

deversus

9,816 downloads

8,955 latest version

3.1 quality score

Version information

  • 0.1.9 (latest)
  • 0.1.7
  • 0.1.6
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
released Aug 12th 2014
This version is compatible with:
  • Debian, Ubuntu

Start using this module

Tags: puma, rails, rvm, nginx, ruby

Documentation

deversus/puma — version 0.1.9 Aug 12th 2014

puma

Overview

Configure puma servers for Ruby-on-Rails apps.

Installs the application as a system service (using upstart or good old sysv - upstart has the benefit of not requiring a supervisor for restarting rails).

Configurations for Debian-family systems included, patches welcome for other OSes.

For a more comprehensive Rails deployment recipe which makes use of this module, see deversus-rails.

Optional Dependencies

  • RVM support requires maestrodev-rvm (~> v1.5.5) .
  • NGINX support requires jfryman-nginx (~> v0.0.9).

Patches welcome for servers other than NGINX.

Usage

# Debian default values shown (except rvm, which defaults to false)
puma::app {'myapp':
    app_name           => 'myapp',
    app_root           => '/var/www/myapp/current',
    puma_user          => 'puma',
    www_user           => 'www-data',
    min_threads        => 1,
    max_threads        => 16,
    workers            => 1
    init_active_record => false,
    preload_app        => true,
    rails_env          => 'production',
    rvm_ruby           => 'ruby-2.0.0-p0,
}

This would install a service called myapp (in /etc/init if upstart is used, /etc/init.d otherwise). Socket and PID files will be put in /var/run/myapp/. Log files will be put in /var/log/myapp.puma.stdout.log etc.

An RVM ruby environment for ruby-2.0.0-p0 will be installed if needed and used to launch puma. (with rvm_ruby => false, system ruby will be used)

Configuring NGINX

A convenience resource for configuring NGINX for the above setup is provided:

# Debian default values shown
puma::nginxconfig {'myapp':
    server_name     => ['www.myapp.com'],
    public_root     => '/var/www/myapp/current/public',
}

This will create the necessary NGINX vhost and location configurations to serve a puma rails app.