Dokku commands: Heroku like deployment with support for docker

Initial setup

  • Use digital ocean image with Dokku pre-installed, set up ssh key through web.
  • apt update && apt full-upgrade to update packages.
  • dokku apps:create and add git remote add dokku
  • I used /etc/hosts to access the image from a hostname instead of IP.
  • More detailed setup in the various deploy with dokku guides I was following.


  • dokku plugin:install
  • dokku postgres:create somedatabasename
  • dokku postgres:link somedatabasename
  • Use DATABASE_URL from app


  • dokku git:set --global deploy-branch production
  • dokku git:set deploy-branch staging
  • dokku config:set MY_ENV_VAR=value
  • dokku config:unset MY_ENV_VAR


  • dokku domains:report lists domains used per app
  • dokku apps:list for a simple list
  • dokku report to get some detailed output
  • docker ps --all to see containers that have been running
  • dokku run 'whoami' runs shell commands in a container


Configure with the LetsEncrypt plugin:

  • dokku plugin:install
  • dokku config:set --no-restart DOKKU_LETSENCRYPT_EMAIL=your@e.mail
  • dokku letsencrypt
  • dokku letsencrypt:cron-job --add to set up auto-renewal

Ubuntu apt update vs upgrade vs dist-upgrade vs do-release-upgrade

  • apt update – gets an up to date list of packages that can be installed or updated
  • apt upgrade – updates packages it can, but never removes packages
  • apt full-upgrade – updates packages more aggressively, removing packages that block other updates
  • apt-get dist-upgrade an old name for full-upgrade
  • do-release-upgrade upgrades to the latest operating system version

These are all confusingly named, and could have been called sync, safe-update, force-update, and upgrade-os.

See also: man apt

Links: Deploy a Rails app with Docker and Dokku

Below are links I had open while learning how to use docker-compose with Rails, and using Dokku for deployments.

Dockerize Rails

Set up CI/CD


How to create App badges


  1. Find the app on the Play Store in a web browser
    E.g. The URL for the WordPress App is
  2. Enter the URL into Google’s Badge Maker


  1. Find the app either by searching Apple’s website or through a search engine.
  2. E.g. The URL for the WordPress App can be found at
  3. Use Apple’s Link Maker

Send email for a domain name for free

Many domain names come with free email forwarding, but sending so it appears to come from that domain name often requires a paid SMTP service that might cost £10/year. While searching I found Pobox that lets you set up multiple domains for a flat fee, which had the bonus of working via email forwarding that would let me keep my mail in Gmail.

But then I noticed that lots of email forwarding service were offering “Send mail using Gmail SMTP” for free! From ImprovMX, to ForwardEmail, all were using the same simple trick:

Gmail can be configured to send email to itself!

Step 0

Set up a email forwarder on your domain name, to ensure that any emails get forwarded you your Gmail. Verify that this is working as it’ll be used by Google to verify you own the domain.

Consider using an alternative service if your domain registrar will aggressively block emails with attachments as spam.

Step 1

Create an app password as if you were setting up a mail app on your phone or computer.

Set up 2FA first to get that option.

Step 2

Add a new email address from your Gmail account settings. Set your chosen as the email address, and untick ‘treat as an alias’.

Step 3

Configure Gmail to send with:

  • SMTP Server:
  • Username: address
  • Password: the new app password set up above in Step 1
  • Port 587 over TLS

Confirm and you’re done!

How to set Systemd DNS servers for Ubuntu

With many linux systems moving from /etc/resolv.conf to systemd I was unsure how to set my DNS servers.


Add the following to /etc/systemd/resolved.conf:


Then restart with:

sudo systemctl restart systemd-resolved

Check status

You can use systemd-resolve --status or sudo resolvectl status to see the current status and should see “DNS Servers” listed. Using systemd-resolve --status | grep 'Server' shows all DNS servers both global and local to a specific network, partly because more information is shown when piped, such as with systemd-resolve --status | cat. These might be

Man pages

Following the comments in resolv.conf suggests man systemd-resolved where the inner workings are described in more detail, but man resolved.conf is was more helpful in working out what to set:

A space-separated list of IPv4 and IPv6 addresses to use as system DNS servers.

A space-separated list of IPv4 and IPv6
addresses to use as the fallback DNS servers

A space-separated list of domains. These domains are used as search suffixes when resolving single-label host names (domain names which contain no dot), in order to qualify them into fully-qualified domain names (FQDNs).

I’m curious what Domains= does, so might investigate that later. Edit: These are search domains and are prepended if you lookup a domain/url without a dot in it. E.g. if I added, then I’d be able to enter today in my URL bar and have that take me to as a kind of online hosts file shortcut.


Using dig to check DNS records, such as with dig -t cname, can be traced by appending +trace to the command.

Caches can be flushed with sudo systemd-resolve --flush-caches or sudo service dns-clean start.

For more detailed diagnostics it is possible to set sytemd-resolved into debug mode and trace the lookups, but I didn’t end up needing to do this.

WordPress charge £240 to change a colour

Usually I set up sites on VPS services like DigitalOcean, but wanted to get better at producing quick minimum viable proof of concepts. This will mean I focus on creating value, in this case content, instead of having to spend time on one hundred and one other things.

In this instance I’ve chosen WordPress’s $48/year plan, as I’m used to the platform and willing to forego some of the niceties I’m used to like full control of the machine with SSH access, FTP to upload custom files, plugins and additional custom software.

I didn’t expect however that I’d be prevented from making minor adjustments to my site like changing the header colour, centring the site title, changing link colours or fixing spacing.

WordPress also prevent you from removing their “powered by WordPress” advert at the bottom of your site. Although I mind that less because it’s a generally good platform and I’d like to encourage other people to share things they learn, with WordPress remaining a great platform to start doing so.

Just don’t expect much control over how individual things look, or be ready to pay for their $300/year business plan to do so.