Build Status

NAME

Plack::Middleware::ServerStatus::Availability - manually set server status

SYNOPSIS

use Plack::Builder;


builder {
    enable 'ServerStatus::Availability', (
        path => {
            status  => '/server/avail',
            control => '/server/control/avail',
        },
        allow => [ '127.0.0.1', '192.168.0.0/16', '10.0.0.0/8' ],
        file => '/tmp/server-up',
    );
    $app;
};

$ curl http://server:port/server/avail
503 Server is up but is under maintenance

$ curl -X POST http://server:port/server/control/avail?action=up
200 Done

$ curl http://server:port/server/avail
503 Server is up but is under maintenance

$ curl http://server:port/server/avail
200 OK

$ curl -X POST http://server:port/server/control/avail?action=down
200 Done

$ curl http://server:port/server/avail
503 Server is up but is under maintenance

DESCRIPTION

This middleware is intended to show a server status which is controllable by POST requests to the status control endpoint. This is useful when you want to manually make a server under maintenance and automatically detached from a load balancer.

CONFIGURATIONS

SEE ALSO

Plack::Middleware::ServerStatus::Lite

ACKNOWLEDGMENT

This middleware is ported from Karasuma::Config::ServerStatus to Plack::Middleware.

LICENSE

Copyright (C) INA Lintaro

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

INA Lintaro tarao.gnn@gmail.com