Skip to content
Browse files

Added Mojolicious::Lite scaling demo.

  • Loading branch information...
0 parents commit 7280fbddd5f531cd3490e58e591273ce03097e90 Daniil Kulchenko committed Aug 16, 2011
Showing with 97 additions and 0 deletions.
  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 @@
+#!/usr/bin/env perl
+
+use Mojolicious::Lite;
+use LWP::Simple;
+use Sys::HostIP;
+
+any '/' => sub {
+ my $self = shift;
+ my $ip = Sys::HostIP->ip;
+
+ $self->stash( ip => $ip, pid => $$ );
+} => 'index';
+
+app->start;
+
+__DATA__
+
+@@ index.html.ep
+
+<!doctype html5>
+<html>
+<head>
+<title>Stackato scaling test</title>
+<style type="text/css">
+body {
+ background: black;
+ font-family: Helvetica, sans-serif;
+ color: #EEEEEE;
+}
+
+#prettybox {
+ background: #212121;
+
+ margin-top: 5em;
+ padding-bottom: 1.5em;
+
+ width: 30%;
+ margin-left: auto;
+ margin-right: auto;
+ text-align: center;
+
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+
+#stackato {
+ font-size: 2em;
+ padding-top: 0.5em;
+ padding-bottom: 1em;
+}
+
+.labeltext {
+ padding-top: 1em;
+ color: #999999;
+}
+
+.bigtext {
+ padding-top: 0.3em;
+ font-size: 3em;
+}
+
+#ip {
+ color: #3D5AD1;
+}
+
+#pid {
+ color: #128236;
+}
+
+</style>
+</head>
+<body>
+<div id="prettybox">
+ <div id="stackato">stackato scaling test</div>
+
+ <div id="ipblock">
+ <div class="labeltext">the IP of this instance is:</div>
+ <div class="bigtext" id="ip"><%= $ip %></div>
+ </div>
+
+ <div id="pidblock">
+ <div class="labeltext">the PID of this process is:</div>
+ <div class="bigtext" id="pid"><%= $pid %></div>
+ </div>
+</div>
+</body>
+</html>
2 app.psgi
@@ -0,0 +1,2 @@
+$ENV{MOJO_MODE} = 'production';
+require 'app.pl';
2 requirements.txt
@@ -0,0 +1,2 @@
+Mojolicious
+Sys::HostIP
6 stackato.yml
@@ -0,0 +1,6 @@
+name: scaling
+
+framework:
+ type: perl
+
+mem: 64M

0 comments on commit 7280fbd

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