Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
plack.workers.busy_workers >=0 | ||
plack.workers.idle_workers >=0 | ||
plack.req.requests >=0 | ||
plack.bytes.bytes_sent >=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/sh | ||
|
||
prog=$(basename "$0") | ||
if ! [ -S /var/run/docker.sock ] | ||
then | ||
echo "$prog: there are no running docker" >&2 | ||
exit 2 | ||
fi | ||
|
||
cd "$(dirname "$0")" || exit | ||
PATH=$(pwd):$PATH | ||
plugin=$(basename "$(pwd)") | ||
if ! which "$plugin" >/dev/null | ||
then | ||
echo "$prog: $plugin is not installed" >&2 | ||
exit 2 | ||
fi | ||
|
||
image=local/test-$plugin | ||
port=5000 | ||
|
||
docker build -t $image testdata/ | ||
|
||
docker run --name "test-$plugin" -p $port:5000 -d $image | ||
trap 'docker stop test-$plugin; docker rm test-$plugin; exit 1' 1 2 3 15 | ||
sleep 10 | ||
|
||
# to store previous value to calculate a diff of metrics | ||
$plugin -port $port >/dev/null 2>&1 | ||
sleep 1 | ||
|
||
$plugin -port $port | graphite-metric-test -f rule.txt | ||
status=$? | ||
|
||
docker stop "test-$plugin" | ||
docker rm "test-$plugin" | ||
exit $status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM perl:5.36 | ||
|
||
COPY . /usr/src/myapp | ||
WORKDIR /usr/src/myapp | ||
|
||
RUN cpm install -v | ||
|
||
EXPOSE 5000 | ||
|
||
ENV PERL5LIB /usr/src/myapp/local/lib/perl5 | ||
ENV PATH $PATH:/usr/src/myapp/local/bin/ | ||
|
||
CMD [ "plackup", "app.psgi" ] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use Plack::Builder; | ||
|
||
builder { | ||
enable "Plack::Middleware::ServerStatus::Lite", | ||
path => '/server-status', | ||
allow => [ '0.0.0.0/0' ], | ||
counter_file => '/tmp/counter_file', | ||
scoreboard => '/var/run/server'; | ||
|
||
sub { | ||
[200, ["Content-Type" => "text/plain"], "ok"]; | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
requires "Plack", ">= 1.0048"; | ||
requires "Plack::Middleware::ServerStatus::Lite", "0.36"; |