A lot has changed in the world of cloud hosting since the last time i took a closer look at one of the providers. Almost all of them support Perl these days, directly or indirectly. One of the most prominent ones is Heroku, and today we are going to use their official tools and a custom buildpack to deploy a Mojolicious::Lite application into the cloud.
Only three files are required to make an application deployable to Heroku, the application script itself, a “Makefile.PL” containing a list of CPAN dependencies, and an executable “Perloku” script telling Heroku how to start the Mojolicious web server.
For our little experiment we will only be using a very minimalistic application.
And the only dependency is Mojolicious, but any CPAN module you specify can be installed automatically.
My favorite Heroku feature is that we are allowed to run our own web server, which enables many of those nifty real-time web features to just work. The port to be used for listening will simply be passed along via environment variable.
And those were all the preparations required, now we can just deploy our application withgit.
I’ve also heard rumors that Glen “tempire” Hinkle might be working on new Mojolicious commands to make the whole process even easier, but you’ll have to visit (or watch the live stream of) his talk at YAPC::NA 2012 to learn more about that. ;)