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

NAME

Toadfarm - One Mojolicious app to rule them all

VERSION

0.51

DESCRIPTION

Toadfarm is a module for configuring and starting your Mojolicious applications. You can either combine multiple applications in one script, or just use it as a init script.

Core features:

  • Wrapper around hypnotoad that makes your application Sys-V compatible.

  • Advanced routing and virtual host configuration. Also support routing from behind another web server, such as nginx. This feature is very much like Mojolicious::Plugin::Mount on steroids.

  • Hijacking log messages to a common log file. There's also plugin, Toadfarm::Plugin::AccessLog, that allow you to log the requests sent to your server.

SYNOPSIS

Script

Here is an example script that set up logging and mount some applications under different domains, as well as loading in some custom plugins.

See Toadfarm::Manual::DSL for more information about the different functions.

  #!/usr/bin/perl
  use Toadfarm -dsl;

  logging {
    combined => 1,
    file     => "/var/log/toadfarm/app.log",
    level    => "info",
  };

  mount "MyApp"        => {"Host" => "myapp.example.com"};
  mount "/path/to/app" => {"Host" => "example.com", mount_point => "/other"};
  mount "Catch::All::App";

  plugin "Toadfarm::Plugin::AccessLog";

  start; # need to be at the last line

Usage

You don't have to put "Script" in init.d, but it will work with standard start/stop actions.

  $ /etc/init.d/your-script reload
  $ /etc/init.d/your-script start
  $ /etc/init.d/your-script stop

You can also start the application with normal Mojolicious commands:

  $ morbo /etc/init.d/your-script
  $ /etc/init.d/your-script daemon

DOCUMENTATION INDEX

PLUGINS

COPYRIGHT AND LICENSE

Copyright (C) 2014, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org