Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added Mojolicious::Lite scaling demo.

  • Loading branch information...
commit 7280fbddd5f531cd3490e58e591273ce03097e90 0 parents
Daniil Kulchenko authored

Showing 4 changed files with 97 additions and 0 deletions. Show diff stats Hide diff stats

  1. +87 0 app.pl
  2. +2 0  app.psgi
  3. +2 0  requirements.txt
  4. +6 0 stackato.yml
87 app.pl
... ... @@ -0,0 +1,87 @@
  1 +#!/usr/bin/env perl
  2 +
  3 +use Mojolicious::Lite;
  4 +use LWP::Simple;
  5 +use Sys::HostIP;
  6 +
  7 +any '/' => sub {
  8 + my $self = shift;
  9 + my $ip = Sys::HostIP->ip;
  10 +
  11 + $self->stash( ip => $ip, pid => $$ );
  12 +} => 'index';
  13 +
  14 +app->start;
  15 +
  16 +__DATA__
  17 +
  18 +@@ index.html.ep
  19 +
  20 +<!doctype html5>
  21 +<html>
  22 +<head>
  23 +<title>Stackato scaling test</title>
  24 +<style type="text/css">
  25 +body {
  26 + background: black;
  27 + font-family: Helvetica, sans-serif;
  28 + color: #EEEEEE;
  29 +}
  30 +
  31 +#prettybox {
  32 + background: #212121;
  33 +
  34 + margin-top: 5em;
  35 + padding-bottom: 1.5em;
  36 +
  37 + width: 30%;
  38 + margin-left: auto;
  39 + margin-right: auto;
  40 + text-align: center;
  41 +
  42 + -moz-border-radius: 5px;
  43 + border-radius: 5px;
  44 +}
  45 +
  46 +#stackato {
  47 + font-size: 2em;
  48 + padding-top: 0.5em;
  49 + padding-bottom: 1em;
  50 +}
  51 +
  52 +.labeltext {
  53 + padding-top: 1em;
  54 + color: #999999;
  55 +}
  56 +
  57 +.bigtext {
  58 + padding-top: 0.3em;
  59 + font-size: 3em;
  60 +}
  61 +
  62 +#ip {
  63 + color: #3D5AD1;
  64 +}
  65 +
  66 +#pid {
  67 + color: #128236;
  68 +}
  69 +
  70 +</style>
  71 +</head>
  72 +<body>
  73 +<div id="prettybox">
  74 + <div id="stackato">stackato scaling test</div>
  75 +
  76 + <div id="ipblock">
  77 + <div class="labeltext">the IP of this instance is:</div>
  78 + <div class="bigtext" id="ip"><%= $ip %></div>
  79 + </div>
  80 +
  81 + <div id="pidblock">
  82 + <div class="labeltext">the PID of this process is:</div>
  83 + <div class="bigtext" id="pid"><%= $pid %></div>
  84 + </div>
  85 +</div>
  86 +</body>
  87 +</html>
2  app.psgi
... ... @@ -0,0 +1,2 @@
  1 +$ENV{MOJO_MODE} = 'production';
  2 +require 'app.pl';
2  requirements.txt
... ... @@ -0,0 +1,2 @@
  1 +Mojolicious
  2 +Sys::HostIP
6 stackato.yml
... ... @@ -0,0 +1,6 @@
  1 +name: scaling
  2 +
  3 +framework:
  4 + type: perl
  5 +
  6 +mem: 64M

0 comments on commit 7280fbd

Please sign in to comment.
Something went wrong with that request. Please try again.