Sha256: 6cb43d87446c178d2521b8f695d8463c130385bf5b9efab1a5794edc37ebafba

Contents?: true

Size: 1.46 KB

Versions: 58

Compression:

Stored size: 1.46 KB

Contents

## Plugins

Puma 3.0 added support for plugins that can augment configuration and service
operations.

There are two canonical plugins to aid in the development of new plugins:

* [tmp\_restart](https://github.com/puma/puma/blob/master/lib/puma/plugin/tmp_restart.rb):
  Restarts the server if the file `tmp/restart.txt` is touched
* [heroku](https://github.com/puma/puma-heroku/blob/master/lib/puma/plugin/heroku.rb):
  Packages up the default configuration used by Puma on Heroku (being sunset
  with the release of Puma 5.0)

Plugins are activated in a Puma configuration file (such as `config/puma.rb'`)
by adding `plugin "name"`, such as `plugin "heroku"`.

Plugins are activated based on path requirements so, activating the `heroku`
plugin is much like `require "puma/plugin/heroku"`. This allows gems to provide
multiple plugins (as well as unrelated gems to provide Puma plugins).

The `tmp_restart` plugin comes with Puma, so it is always available.

To use the `heroku` plugin, add `puma-heroku` to your Gemfile or install it.

### API

## Server-wide hooks

Plugins can use a couple of hooks at the server level: `start` and `config`.

`start` runs when the server has started and allows the plugin to initiate other
functionality to augment Puma.

`config` runs when the server is being configured and receives a `Puma::DSL`
object that is useful for additional configuration.

Public methods in [`Puma::Plugin`](../lib/puma/plugin.rb) are treated as a
public API for plugins.

Version data entries

58 entries across 58 versions & 5 rubygems

Version Path
puma-6.5.0-java docs/plugins.md
puma-6.5.0 docs/plugins.md
jun-puma-1.0.1-java docs/plugins.md
jun-puma-1.0.0-java docs/plugins.md
puma-5.6.9-java docs/plugins.md
puma-6.4.3-java docs/plugins.md
puma-6.4.3 docs/plugins.md
puma-5.6.9 docs/plugins.md
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/puma-5.6.8/docs/plugins.md
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/puma-6.4.2/docs/plugins.md
puma-5.6.8-java docs/plugins.md
puma-5.6.8 docs/plugins.md
puma-6.4.2-java docs/plugins.md
puma-6.4.2 docs/plugins.md
puma-6.4.1-java docs/plugins.md
puma-6.4.1 docs/plugins.md
puma-6.4.0-java docs/plugins.md
puma-6.4.0 docs/plugins.md
puma-5.6.7-java docs/plugins.md
puma-5.6.7 docs/plugins.md