++ed by:
JNBEK NEYASOV AWNCORP

3 PAUSE user(s)
2 non-PAUSE user(s).

Jan Henning Thorsen

NAME

Toadfarm::Plugin::Reload - Reload toadfarm with new code

DESCRIPTION

This Mojolicious plugin allow the "Toadfarm" server to restart when a resource is hit with a special JSON payload. The payload need to be compatible with the post-receive-hook github use.

SETUP

  • You need to set up a post receive hook on github to make this reloader work. Go to "https://github.com/jhthorsen/YOUR-REPO/settings/hooks" to set it up.

  • The WebHook URL need to be "http://yourserver.com/some/secret/path". See CONFIG below for details.

CONFIG

This is a config template for Toadfarm:

  {
    apps => [...],
    plugins => [
      Reload => {
        path => '/some/secret/path',
        repositories => [
          {
            name => 'cool-repo',
            branch => 'some-branch',
            path => '/path/to/cool-repo',
            remote => 'whatever', # defaults to "origin"
          },
        ],
      },
      # ...
    ],
  }

Details:

  • path

    This should be the path part of the URL to POST data to reload the server. Make this something semi secret to avoid random requests:

      perl -le'print join "/", "", "reload", (time.$$.rand(9999999)) =~ /(\w\w)/g'
  • repositories

    This should contain a mapping between github repository names and local settings:

    • branch

      This need to match the branch which you push to github. It should be something like "production", and not "master" - unless you want every push to master to reload the server.

    • path

      This is the path on disk to the local git repo.

METHODS

register

  $self->register($app, \%config);

See "SYNOPSIS" for %config parameters.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org