Save $$$ with Dokku
A lightning talk about the smallest PaaS you’ve ever seen. What Dokku is, when it’s all you need, and a real bill from a startup that paid for scale it never used.
dokku/ci-docker-image, and the official GitLab CI docs use it instead of ilyasemenov/gitlab-ci-git-push.What Dokku is
Dokku calls itself the smallest PaaS implementation you’ve ever seen. A PaaS, platform as a service, is the thing where you push code and the platform builds it, runs it and puts it on a URL. Dokku does that on your own server, with Docker underneath.
It works very much like Heroku: you git push to it and your app gets deployed. The difference is that it’s open source and you run it yourself, on a server you pay a flat price for.
Why I love Dokku
- Super easy zero-downtime deploys
- Scaling processes up and down
- Log management
- Networking between apps
- A good community
- Support for buildpacks, so many apps deploy without writing a Dockerfile
Deploying from CI is just another git push. This is the GitLab CI config I used, one job for production from master and one for staging:
deploy:production:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: production
url: https://easy.entry.do/
script:
- git-push dokku@apps.entry.do:dq
only:
- master
deploy:staging:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: staging
url: https://easy.entrydo-dev.com/
script:
- git-push dokku@apps.entry.do:dq-dev
The part after the colon, dq or dq-dev, is the name of the Dokku app. Two apps on the same server, two environments.
What it’s perfect for
- Side and hobby projects
- Startups
- Anything under about 200,000 requests a day
That’s more than it sounds like. One server from the talk was running all of this at once:
- 40 Dokku apps
- 4 MariaDB databases
- 2 RabbitMQ servers
- 30 RabbitMQ consumer processes
- a GitLab CI runner
The htop screenshot on the slide shows 4 CPU cores mostly idle, a load average of 0.10, 3.7 GB of 7.8 GB RAM in use, and 39 days of uptime.
A real example of wasting money
At Entrydo in 2018 and 2019 we ran 12 Node apps, one PHP app, one RabbitMQ server with 10 consumers, and one MariaDB server. Traffic was somewhere between 100 and 100,000 requests a day.
Startups live by “scale fast or die”, so we paid for hosting that was ready to grow. This is what it cost from September 2018 to October 2019:
Most months were around $300. On a Dokku server at $40 a month, the same 13 months would have cost $520. The difference: $3,440.















