Code Monkey home page Code Monkey logo

perloku's Introduction

Perloku

Deploy Perl applications in seconds.

Step 1

Write an app:

#!/usr/bin/env perl
use Mojolicious::Lite;

get '/' => sub {
  my $self = shift;
  $self->render('index');
};

app->start;
__DATA__

@@ index.html.ep
% layout 'default';
% title 'Welcome';
Welcome to the Mojolicious real-time web framework!

@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
  <head><title><%= title %></title></head>
  <body><%= content %></body>
</html>

Step 2

Create a Makefile.PL with your dependencies:

use strict;
use warnings;

use ExtUtils::MakeMaker;

WriteMakefile(
  NAME         => 'app.pl',
  VERSION      => '1.0',
  AUTHOR       => 'Magnus Holm <[email protected]>',
  EXE_FILES    => ['app.pl'],
  PREREQ_PM    => {'Mojolicious' => '2.0'},
  test         => {TESTS => 't/*.t'}
);

Step 3

Create an executable file called Perloku which runs a server on the port given as an enviroment variable:

#!/bin/sh
./app.pl daemon --listen http://*:$PORT

Test that you can start the server:

chmod +x Perloku
PORT=3000 ./Perloku

Step 4

Deploy:

git init
git add .
git update-index --chmod=+x Perloku (only if using Windows)
git update-index --chmod=+x app.pl (only if using Windows)
git commit -m "Initial version"
heroku create -s cedar --buildpack http://github.com/judofyr/perloku.git
git push heroku master

Watch:

Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 808 bytes, done.
Total 5 (delta 0), reused 0 (delta 0)

-----> Heroku receiving push
-----> Fetching custom buildpack... done
-----> Perloku app detected
-----> Vendoring Perl
       Using Perl 5.16.2
-----> Installing dependencies
       --> Working on /tmp/build_19tm6pb8ch1qa
       Configuring /tmp/build_19tm6pb8ch1qa ... OK
       ==> Found dependencies: Mojolicious
       --> Working on Mojolicious
       Fetching http://search.cpan.org/CPAN/authors/id/T/TE/TEMPIRE/Mojolicious-2.48.tar.gz ... OK
       Configuring Mojolicious-2.48 ... OK
       Building Mojolicious-2.48 ... OK
       Successfully installed Mojolicious-2.48
       <== Installed dependencies for /tmp/build_19tm6pb8ch1qa. Finishing.
       1 distribution installed
       Dependencies installed
-----> Discovering process types
       Procfile declares types   -> (none)
       Default types for Perloku -> web
-----> Compiled slug size is 12.4MB
-----> Launching...gi done, v5
       http://perloku-example.herokuapp.com deployed to Heroku

To [email protected]:perloku-example.git
 * [new branch]      master -> master

Enjoy!

perloku's People

Contributors

judofyr avatar zsan avatar danielepiccone avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.