The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Ubic::Service::Toadfarm - Ubic Toadfarm service class

DESCRIPTION

This class require Ubic which is not automatically installed by Toadfarm.

SYNOPSIS

Put the code below in a ubic service file:

  use Ubic::Service::Toadfarm;
  Ubic::Service::Toadfarm->new(
    log => {
      file => '/path/to/log/file', # required
      combined => 1,
    },

    # toadfarm config args
    secret => 'super secret',
    apps => [...],
    plugins => [...],
  );

Details

  • pid_file

    This file is created automatically. It will be stored in the "tmp" directory in your "ubic" data directory. This means that you do not have to specify the pid_file in the "hypnotoad" config section.

  • MOJO_CONFIG

    The Toadfarm application will be started with a config file generated by this service class. The config file will be stored in the "tmp" directory in your "ubic" data directory.

Hypnotoad starter

It is possible to use this module as a generic hypnotoad starter, instead of Ubic::Service::Hypnotoad, by setting the "HYPNOTOAD_APP" environment variable:

  use Ubic::Service::Toadfarm;
  Ubic::Service::Toadfarm->new(
    env => {
      HYPNOTOAD_APP => '/path/to/my-mojo-app',
    },
  );

METHODS

new

See "SYNOPSIS".

start_impl

This is called when you run ubic start. It will start toadfarm using hypnotoad after writing the toadfarm config and settings MOJO_CONFIG.

The config will be written to the "tmp" directory in ubic's data directory.

status_impl

This method will issue a HTTP "HEAD /ubic-status" request to the server. The response is not important, the important thing is that the server responds.

stop_impl

This method will kill the server pid found in "pid_file" with "TERM".

reload

This method will reload the server pid found in "pid_file" with "USR2".

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org