Plack::Middleware::ServerStatus::Availability - manually set server status
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
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.
path => { status => $status, control => $control, }
$status is a location to display the server status. $control is a location to POST actions. An action is specified by action query parameter. Its value up and down makes the server status to 'available' and 'unavailable' respectively.
$status
$control
POST
action
up
down
allow => '127.0.0.1' allow => [ '192.168.0.0/16', '10.0.0.0/8' ]
Host based access control of the server status and status control endpoints. Supports IPv6 address.
file => $file
Specifies a file to remember the availability. The server is indicated to be available if the file exist.
Plack::Middleware::ServerStatus::Lite
This middleware is ported from Karasuma::Config::ServerStatus to Plack::Middleware.
Plack::Middleware
Copyright (C) INA Lintaro
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
INA Lintaro <tarao.gnn@gmail.com>
To install Plack::Middleware::ServerStatus::Availability, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::ServerStatus::Availability
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::ServerStatus::Availability
For more information on module installation, please visit the detailed CPAN module installation guide.