Toadfarm::Plugin::Reload - Reload toadfarm with new code
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.
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.
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.
This is the path on disk to the local git repo.
$self->register($app, \%config);
See "SYNOPSIS" for %config parameters.
%config
Jan Henning Thorsen - jhthorsen@cpan.org
jhthorsen@cpan.org
To install Toadfarm, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Toadfarm
CPAN shell
perl -MCPAN -e shell install Toadfarm
For more information on module installation, please visit the detailed CPAN module installation guide.