Laravel on Docker

Recently I've been looking at involving Docker containers into running a few Laravel applications - possibly removing provisioning and deployment scripts from the process completely. I'm going to record some notes on my learning here (work in progress).

Dokku

Dokku is an application that leverages Docker to provide a self-hosted Heroku-style PaaS system. If you haven't used Heroku, it allows you to use git to deploy your application by simply pushing to a Heroku remote. I've toyed with self-hosted variants of this before (bare repositories and post-receive hooks) but it's always been fairly temperamental and easier to use deployment scripts.

Out-of-the-box, Dokku will detect that what environment your application needs by looking for packaging files (e.g. composer.json tells it to install nginx and PHP). However, you may still need to do a bit of configuration. Fortunately, Dokku can use buildpacks (configuration scripts) built for Heroku - using the most popular PHP buildpack you can have a nice environment set up quickly. It feels quite handy to be able to configure your deployment environment from the composer file.

Small reporting application

(Todo) I have a small application that indexes uploaded log files reports their contents in a web application. Currently it's deployed using a few Capistrano tasks which will need to be ported. It also involves an MySQL and an FTP server (environment requirements) so this might need a custom Dokku plugin or buildpack.

Larger application

(Todo) I have a larger application with queues (Beanstalkd - plugin or ext. container?), externally hosted database (perhaps in a separate container?) and a bunch of dependencies to install. Will be interesting to see what deployment time is like.