Perlbin - Imagebin service built upon the Perl Dancer Framework.

Foreword

gitweb repository - source code

This is a little project i've been working on since some days: it is a Perl based application, built upon the Dancer Framework, which allows users to upload images to a public server. It can be run standalone or behind a proxy (see notes below), requires some perl modules to be installed and some knowledge of the unix shell.

To develop this application i have been using an online Virtual Machine, powered by the kind folks at koding. The project is now hosted at my home server at this address.

Hope you like it; i had fun! :-)

How To Install

Perl Local Lib

We're going to install some perl modules locally to your user home directory. First of all let's install cpanminus.

curl -L http://cpanmin.us | perl - App::cpanminus

Now cpanm is installed in ~/perl5/bin/ but we do not have those binary in our path (still). To install the local lib we need to do this way:

./perl5/bin/cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

Now edit your ".bash_profile" and add this line to the end of it (touch a new ".bash_profile" if it's missing)

eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

Logout from your user and log back in (make sure it is a login shell) Test your local perl installation typing:

which cpanm

Subsequent modules can be installed with the following command:

cpanm Module::To::Be::Installed

Perlbin needs the following modules:

  • Dancer
  • Dancer::Plugin::DirectoryView
  • Dancer::Plugin::FlashMessage
  • Starman

Another module which we need is Perlmagick; in Debian and Debian-based distro it can be installed by apt:

apt-get install perlmagick

Otherwise follow this link

Perlbin

Once we have those modules installed we can clone the Perlbin repo.

git clone git://laltromondo.dynalias.net/git/perlbin.git
cd perlbin

And launch Starman.

plackup -E production -s Starman --workers=2 -l 0.0.0.0:3000 -a bin/app.pl

Your app should be ready to go at "http://your.domain.tld:3000"

To quit Starman simply do a ctrl-c.

To have it run daemonized add "-D" to the previous command, like:

plackup -E production -s Starman --workers=2 -l 0.0.0.0:3000 -D -a bin/app.pl

Moreover, in the perlbin directory you'll find a start-app.sh script: use that to start/stop/restart your app (it has to be edited to match your needs).

Notes

  • The Dancer::Plugin::DirectoryView comes with no default style sheet, so you'll have to write your own; it has to be stored under the following directory on your user's home:

    perl5/lib/perl5/auto/share/dist/Dancer-Plugin-DirectoryView/public/css/default/style.css

  • If you want to run Starman behind a proxy (Apache, nginx, you name it), follow the deployment guide:

    Deployment

and be aware that perlbin will require some modifications, like the use of Plack::Builder.

That's all, thanks for reading.

--

roughnecks