App-Foca

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    started: One is by obviously restarting it and the other one is via
    localhost send a HTTP request to localhost:yourport/reload.

Attributes
    commands_file
        YAML file with the supported commands.

    commands
        Hash reference with a list of supported commands. Basically the
        content of "commands_file".

    port
        Where to listen for requests?

    commands_timeout
        Global timeout for all commands. Default to 1min (60 seconds).

    tmp_dir
        Temporary directory, for cache.

    debug
        Debug/verbose mode, turned off by default.

    server
        App::Foca::Server::HTTP object.

    cache
        For mmap cache (so we can share cache across processes).

Methods
  run_server()
    Runs the HTTP::Daemon server. it forks on each request.

  prepare_status_response()
    Prepares a response (HTTP::Response) for the /status request. /status
    requests returns some stats about Foca server, such as: number of active
    connections, number of closed/zombie connections (user connected and
    left the connection open with a process that is no longer needed).

  prepare_foca_response($connection, $request)
    Prepares a response (HTTP::Response) for a given foca request
    (HTTP::Request).

  build_response($code, $body)
    Builds a HTTP response ("HTTP::Response") based on the given HTTP status
    code and optionally adds a body.

    Returns a "HTTP::Response" so it can be send via the opened connection.

  validate_request($command, $request)
    re-define this method if you want to add some extra security. By default
    all requests are valid at this point.

  run_cmd($connection, $name, $cmd, $params)
    Runs whatever the command is and sets a timeout to it. If it takes too
    long then it will try to kill the process.

    Depending on the settings given to the command it will return the STDOUT
    or STDERR or even both. The rules are:

    1. On success it will look for STDOUT, if nothing is there then it looks
    in STDERR. If nothing is foudn in STDERR and STDOUT then an empty string
    is returned.
    2. On error it will look for STDERR first, if nothing is there then it
    looks in STDOUT. If nothing is there then it returns an empty string.

    Both STDOUT and STDERR can be returned if the command is defined as
    follows:

        server_uptime:
            cmd: '/usr/bin/uptime'
            capture_all: 'y'

  load_commands()
    Load the commands YAML file and stores it in memory with Cache::FastMnap

COPYRIGHT
    Copyright (c) 2010-2012 Yahoo! Inc. All rights reserved.

LICENSE
    This program is free software. You may copy or redistribute it under the
    same terms as Perl itself. Please see the LICENSE file included with
    this project for the terms of the Artistic License under which this
    project is licensed.

AUTHORS
    Pablo Fischer (pablo@pablo.com.mx)



( run in 1.360 second using v1.01-cache-2.11-cpan-39bf76dae61 )