Dokku, Docker and Perl

Jed Cunningham - Thousand Oaks Perl Mongers

February 21, 2017

Docker

software containerization platform

Dokku

The smallest PaaS implementation you've ever seen

Benefits

  • Your own, single server Paas
  • Deploy with git (Heroku buildpacks or Docker)
  • Plugins, plugins, plugins!

Install


$ wget https://raw.githubusercontent.com/dokku/dokku/v0.8.0/bootstrap.sh
$ sudo DOKKU_TAG=v0.8.0 bash bootstrap.sh
          

Dockerfile Deployments

  • Have app listen on 5000, or EXPOSE another port
  • Considered a "Power User" feature, potentially less plugin support

Paste App

Dockerfile


FROM perl:5.24

COPY cpanfile /app/cpanfile
COPY script/mojopaste /app/mojopaste

RUN cpanm --installdeps /app

ENV PASTE_DIR /app/pastes

CMD ["/app/mojopaste", "daemon", "-l", "http://*:5000"]
          

Dokku server


          $ dokku apps:create paste
          

git repo


          $ git remote add dokku dokku@<dokku-hostname>:paste
          $ git push dokku master
          # ...
          # =====> Application deployed:
          #        http://paste.<dokku-hostname>
          

Change something


          $ vim script/mojopaste
          # change title
          $ git add script/mojopaste && git commit -m 'tite'
          $ git push dokku master
          

Add Persistent Storage


$ mkdir -p /var/lib/dokku/data/storage/paste
$ chown -R 32767:32767 /var/lib/dokku/data/storage/paste/
$ dokku storage:mount paste /var/lib/dokku/data/storage/paste:/app/pastes
$ dokku ps:restart paste
          

Other options?

  • Zero downtime deployments
  • Scaling
  • SSL (even Letsencrypt via plugin)
  • Plugins

Questions