This is one of my favourite pieces of knowledge I get to share today. Those clever people at heroku.com have made the business of publishing (modern) web applications exceedingly slick and easy. However, on the face of it (and I did hunt for a bit of time) they don’t support perl. Fret not; if you dig around under the bonnet it turns out they support any language/platform as long as someone provides a compatible ‘buildpack’. And it just so happens that Magnus Holm (a fine geek from Norway) has worked out the mechanics of getting your app publishable and provided a buildpack so it all happens behind the scenes.
(If you’re not writing your apps on Mojolicious your platform may not be modern enough — you’ll have to look at Magnus’s notes and code to see if you can become compatible. There are other buildpacks on the buildpack page.)
I will be deploying my web application from a debian server, so it made sense to create a chroot jail for it. Inside there I would be able to install third-party packages without worry of them invading my main diskspace. Wherever you deploy from, you’ll need to have root/superuser access so you can install the heroku tools.
mkdir -p /opt/jail/heroku debootstrap squeeze /opt/jail/heroku chroot /opt/jail/heroku adduser --ingroup www-data --disabled-password --gecos 'app,,,' app su - app
- First set up your account via the web page
- Sign up for free account
- Give email and password
- Acknowledge email
- Login and go to Dev Center (for reading later)
- Second install the heroku toolbelt
- Install ssh
- Install toolbelt
ssh-keygen wget -qO- https://toolbelt.heroku.com/install.sh >/tmp/toolbelt.sh view /tmp/toolbelt.sh sh /tmp/toolbelt.sh heroku login heroku apps:create myapp --stack cedar \ --buildpack http://github.com/judofyr/perloku.git
That works for debian and ubuntu — there are also installs for other platforms.
You can change the name later, but it’s slightly less trouble to get it right at the start.
(You can have multiple applications, just treat each one the same as the first.)
Application names need to be unique across heroku, so don’t be surprised if obvious names have already gone.
If you create an application without a buildpack (as I did) don’t worry, you can add a buildpack with
heroku config:add BUILDPACK_URL=http://github.com/judofyr/perloku.git
- Third set up your development directory
- Create a directory [in fact I created a chroot jail and a special user but that’s only if you want complete isolation] and go into it
mkdir myapp cd myapp git init
- Fourth create your initial files based on Magnus’s files
vi Perloku ... git add . git commit -m 'Initial' git push heroku master
- Fifth try out your new application