Dokku: Open source Heroku alternative

Dokku is a self-hosted open-source PaaS similar to Heroku.

Dokku: Open source Heroku alternative

My favorite hosting solution for several years. It's lightweight, open-source and really stable. There are two general modes of operation: Buildpacks (e.g. Herokuish) and Dockerfiles.

On a freshly installed Linux machine, after installing Dokku you can push to Git repos on the server, and a container will be build and started for your app, with Nginx as a reverse proxy running in front of everything.

Dokku - The smallest PaaS implementation you’ve ever seen

Installation

Linux

# download the installation script
wget -NP . https://dokku.com/bootstrap.sh

# run the installer
sudo DOKKU_TAG=v0.35.18 bash bootstrap.sh

Mac (Homebrew)

brew install dokku/repo/dokku

Plugins

GitHub - dokku/dokku-letsencrypt: Automatic Let’s Encrypt TLS Certificate installation for dokku
Automatic Let’s Encrypt TLS Certificate installation for dokku - dokku/dokku-letsencrypt
GitHub - dokku/dokku-mariadb: a mariadb plugin for dokku
a mariadb plugin for dokku. Contribute to dokku/dokku-mariadb development by creating an account on GitHub.
GitHub - dokku/dokku-postgres: a postgres plugin for dokku
a postgres plugin for dokku. Contribute to dokku/dokku-postgres development by creating an account on GitHub.
GitHub - dokku/dokku-redirect: A plugin for dokku that gives the ability to set simple redirects for an application
A plugin for dokku that gives the ability to set simple redirects for an application - dokku/dokku-redirect

General config settings

Change deploy branch

dokku git:set deploy-branch main

Timezone

dokku config:set TZ=Europe/Berlin

Nginx settings

Disable HSTS header

dokku nginx:set hsts false
dokku proxy:build-config

Max upload size

dokku nginx:set sitename client-max-body-size 25m

Ruby on Rails

Rails config

dokku config:set myrailsapp \
  SECRET_KEY_BASE=mysecret RAILS_ENV=production \
  RACK_ENV=production RAILS_LOG_TO_STDOUT=enabled \
  RAILS_SERVE_STATIC_FILES=enabled

Read next

Favorite CLI Tools

These CLI tools saved me lots of time and I find them generally a joy to work with. It's all about sharing the love and the magic, and maybe you'll find a new favorite or two.

Syncthing

As much I wanted it to work, iCloud file synchronization used to give me headaches. I work with two Macs - one Mini in the office, and a MacBook on the go. In addition, I'm using a large