Dokku One-Click Application

Finding a sane and easy way to deploy your finished product can present a significant hurdle in delivering an application. Dokku is a platform as a service (PaaS) solution that helps you more deploy and configure an application to a production environment on a separate server.

Dokku is similar to services like Heroku in that you can deploy to a remote server. The difference is that Dokku is built to deploy to a single, personally-managed server and is extremely lightweight. Dokku uses Docker, a Linux container system, to manage its deployments. The DigitalOcean One-Click application in turn makes it easy to set up a Dokku server.

Components

Droplets created using this One-Click have the following software components:

Component Version
Linux Ubuntu 18.04.1
Docker CE Latest from Docker stable channel
Dokku Latest from packagecloud

In addition to the package installation, the One-Click also:

  • Enables the UFW firewall to allow only SSH (port 22, rate limited), HTTP (port 80), HTTPS (port 443), and 2375/2376 for unencrypted/encrypted traffic to the Docker daemon, respectively.

Quickstart

After creating a Dokku One-Click Droplet, you need to visit the Droplet’s IP address in a browser to finish configuring Dokku. If you don’t, the Dokku instance will be vulnerable to anyone who finds the setup page and inserts their key.

When you visit the setup page, you’ll see three fields:

  • Public Key: If you uploaded an SSH key to the Droplet when you created it, this field will be pre-populated with your public key. If not, add an SSH public key here.

  • Hostname: You can either enter a domain name, if you’re using one, or add the IP address of the server if you do not.

  • Use virtualhost naming for apps: By default, Dokku will serve apps in the format http://your_domain:app_port_number, like https://example.com:12345. If you check this box, instead apps will be available using a virtualhost in the format http://app_name.your_domain, like http://my_app.example.com.

After you fill out these fields, click Finish Setup to complete the setup.

API Creation

In addition to creating a Droplet from the Dokku One-Click application using the control panel, you can also use the DigitalOcean API.

You can list all One-Click application images using the API. As an example, to create a 4GB Dokku Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your API access token to an environment variable or substitute it into the command below.

curl -X POST -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer '$TOKEN'' -d \
    '{"name":"choose_a_name","region":"sfo2","size":"4gb","image":"dokku-18-04"}' \
    "https://api.digitalocean.com/v2/droplets"

Next Steps

At this point, the Dokku Droplet will be configured and ready to use and you can deploy your first application with Dokku.