Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tarao/perl5-plack-middleware-serverstatus-availability
https://github.com/tarao/perl5-plack-middleware-serverstatus-availability
perl plack
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/tarao/perl5-plack-middleware-serverstatus-availability
- Owner: tarao
- License: other
- Created: 2015-03-10T03:55:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-10T04:45:53.000Z (almost 10 years ago)
- Last Synced: 2024-10-16T05:43:50.223Z (3 months ago)
- Topics: perl, plack
- Language: Perl
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/tarao/perl5-Plack-Middleware-ServerStatus-Availability.svg?branch=master)](https://travis-ci.org/tarao/perl5-Plack-Middleware-ServerStatus-Availability)
# NAMEPlack::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
- path
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.- allow
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 => $file
Specifies a file to remember the availability. The server is
indicated to be available if the file exist.# SEE ALSO
[Plack::Middleware::ServerStatus::Lite](https://metacpan.org/pod/Plack::Middleware::ServerStatus::Lite)
# ACKNOWLEDGMENT
This middleware is ported from [Karasuma::Config::ServerStatus](https://github.com/wakaba/karasuma-config/blob/master/lib/Karasuma/Config/ServerStatus.pm) 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