GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TOADFARM::PLUGIN::RELOAD (3)

.ds Aq ’

NAME

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

CONTENTS

DESCRIPTION

This Mojolicious plugin allows the Toadfarm server to restart when a resource is hit with a special JSON payload. The payload needs to be compatible with the post-receive-hook <https://help.github.com/articles/post-receive-hooks> github use.

SETUP

o You need to set up a post receive hook on github to make this reloader work. Go to https://github.com/YOUR-USERNAME/YOUR-REPO/settings/hooks to set it up.
o The WebHook URL (e.g. http://yourserver.com/some/private/path), should not trigger any mounted apps. This can be achieved by simply using an IP address instead of a hostname or by exempting the GitHub-Hookshot User-Agent from the mount configuration:



  mount My::App => {
    "Host" => qr{^(www.)?yourserver.com$},
    "User-Agent" => qr{^(?:(?!GitHub-Hookshot).)*$},
  };



SYNOPSIS



  #!/usr/bin/env perl
  use Toadfarm -init;

  # mount applications, set up logging, ...

  plugin "Toadfarm::Plugin::Reload" => {
    path         => "/some/private/path",
    repositories => [
      {
        name   => "cool-repo",
        branch => "some-branch",
        path   => "/path/to/cool-repo",
        remote => "whatever",           # default="origin"
      },
    ],
  };

  start;



Configuration details:
o 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 public requests:



  perl -leprint join "/", "", "reload", (time.$$.rand(9999999)) =~ /(\w\w)/g



o repositories

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

The name of the branch on github that you push production code to.

Tip: Instead of using master, you might want to use production or release instead. The reason for this is that it will prevent the server from reloading each time you push to master:



  # Work
  $ git push origin master
  $ git push origin master
  $ git push origin master
  # Make a new release
  $ git tag 0.31
  $ git push origin release
  # This plugin will cause hypnotoad to hot deploy



Note: The local branch will have the name toadfarm_reload_branch. The reason for this is to avoid killing commits done manually in the local branch. This is of course a very bad workflow, and should be avoided.

o 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
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 TOADFARM::PLUGIN::RELOAD (3) 2016-02-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.