How to Install Dokku on Debian 12, 11 or 10

Navigating the realm of application deployment is made significantly smoother with Dokku. This potent, lightweight, and extensible platform facilitates applications’ deployment, management, and scaling in a cloud environment. This guide is crafted to assist you as you install Dokku on Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster, utilizing the official Docker and Dokku APT repositories to ensure access to the latest software versions and dependencies.

Key Attributes of Dokku:

  • Lightweight Design: Dokku maintains a minimalistic design philosophy, prioritizing swift deployment and minimized overhead.
  • Docker Integration: The platform harnesses Docker’s capabilities, offering streamlined application containerization.
  • Extensibility: Dokku’s rich plugin ecosystem allows tailored customization to meet diverse deployment needs.
  • Open Source: Being open-source, Dokku thrives on the collective contributions of a dynamic developer community.

Choosing Debian as a Host for Dokku:

  • Stability: Debian is renowned for its stability, providing a reliable environment for Dokku and ensuring consistent application performance.
  • Long-Term Support: The long-term support provided with Debian’s LTS releases ensures sustained security and stability for your Dokku deployments.
  • Versatility: Dokku’s compatibility with various Debian versions allows users to select a release that best aligns with their infrastructural requirements.

With its lightweight nature, Docker-powered capabilities, and a wealth of plugins, Dokku emerges as a robust application deployment and management solution. Catering to seasoned developers and beginners alike, mastering Dokku deployment on Debian can notably elevate your application management and deployment prowess. Let’s explore the guide and the steps to get Dokku up and running on your Debian system.

Install Dokku on Debian 12, 11, or 10

Step 1: System Update for Debian Before Dokku Installation

To ensure a smooth installation process, it’s essential to keep your Debian system updated. This bolsters security and prevents potential conflicts with newer software installations. To update your system packages, execute the following commands:

sudo apt update
sudo apt upgrade

These commands refresh the list of available packages (apt update) and then upgrade the existing packages to their latest versions (apt upgrade).

Step 2: Preparing for Dokku Installation on Debian

Before proceeding with Dokku, it’s crucial to have Docker installed. If Docker isn’t already set up, consider referring to our own Docker installation guide tailored for Debian Linux. After Docker’s installation, the Docker Compose plugin becomes an essential component. Install it using:

sudo apt install docker-compose-plugin

Additionally, specific packages are indispensable for Dokku’s installation. These packages encompass utilities for software management, security certificates, and more. Install them with:

sudo apt install ca-certificates curl lsb-release dirmngr software-properties-common apt-transport-https -y

Step 3: Add Dokku APT Repository on Debian

To guarantee the installation of Dokku’s official version, integrate its APT repository. Begin by importing the GPG key:

curl -fSsL https://packagecloud.io/dokku/dokku/gpgkey | gpg --dearmor | sudo tee /usr/share/keyrings/dokku.gpg > /dev/null

This command retrieves the GPG key, converts it into a binary format, and saves it in the system’s keyring directory.

Next, incorporate the repository:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/dokku.gpg] https://packagecloud.io/dokku/dokku/debian $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/dokku.list

This command registers the Dokku repository with your APT sources, specifying the architecture and signing key for enhanced security.

Step 4: Refreshing the APT Cache After Dokku APT Repo Import

With the Dokku repository in place, refresh the APT cache:

sudo apt update

Step 5: Proceed to Install Dokku on Debian 12, 11 or 10

Now, install Dokku using the following command:

sudo apt install dokku

The Dokku installation is comprehensive, encompassing a series of prompts for tailoring the setup to your specific requirements.

Nginx Vhosts Plugin Activation

During the installation, the process will prompt you about the Nginx vhosts plugin. This essential plugin manages virtual hosts in the Nginx web server, which is crucial for operating multiple applications on a single server. Activating it enables each application to maintain its distinct subdomain.

Screenshot of Nginx Vhosts plugin installation prompt for Dokku on Debian Linux.
Nginx Vhosts plugin installation step for Dokku on Debian Linux.

Specifying IP Address or Hostname

When prompted, you’ll input the IP address or hostname for your Dokku instance. This determines how you’ll access your deployed applications. You might use a public IP, domain, or subdomain, depending on your configuration.

Screenshot of Dokku configuration for hostname or IP during Debian Linux installation.
Configuration of Dokku for either hostname or IP during Debian Linux setup.

Vhost-Based Deployments Decision

You’ll also decide on vhost-based deployments. If activated, every application deployed with Dokku will have its subdomain under the Dokku domain. This is beneficial for hosting multiple applications with distinct namespaces.

Screenshot of the option to enable Vhost-based deployments during Dokku installation on Debian Linux.
Selection screen for Vhost-based deployments during Dokku’s Debian Linux installation.

Initial User Keyfile Location

Lastly, specify the location for the initial user keyfile. Akin to an SSH key, this keyfile serves for user authentication during secure operations. Ensure you store it safely.

Screenshot of the root keyfile option for initial users in Dokku on Debian Linux.
Setting up the root keyfile for the primary user during Dokku’s Debian Linux installation.

Navigating through these prompts concludes Dokku’s installation. Your server now has a potent PaaS, optimizing your application deployment processes.

To verify the successful installation of Dokku, run the following:

dokku --version

This command reveals the Dokku version on your server, confirming its readiness for use.

Configure Dokku on Debian 12, 11, or 10

After successfully installing Dokku on your Debian Linux system, configuring it becomes the next crucial step. Proper configuration ensures that Dokku functions optimally and meets your specific requirements. This guide will clarify the essential configuration procedures.

Step 1: Initial Dokku Configuration

After installing Dokku, you must configure it immediately. Typically, you use Dokku’s web-based setup utility for this task. However, you must determine your server’s domain name or IP address before accessing this utility.

If you are operating on a public server and have its domain name or public IP address, you can set up Dokku with the following:

sudo dokku domains:set-global your-domain-name.com

Replace your-domain-name.com with your actual domain name or IP address. This command globally designates the domain name for all applications deployed via Dokku.

Step 2: Accessing the Dokku Web Setup Utility

Post the initial configuration, the Dokku setup utility becomes accessible at http://your-domain-name.com. Replace your-domain-name.com with the domain name or IP address specified earlier.

This utility will prompt for a public SSH key addition. This key serves the dokku user, under which the Dokku daemon operates. Generate a new SSH key pair on your local machine using the ssh-keygen command, then input the public key into the setup utility.

Step 3: Configuring Environment Variables with Dokku

Dokku uses environment variables for application configurations. For example, to deploy a Node.js application that requires a specific environment variable, set it as follows:

dokku config:set your-app-name NODE_ENV=production

Replace your-app-name with your Dokku application’s name and NODE_ENV=production with the relevant key-value pair.

Step 4: Dokku Plugin Configuration

Dokku comes equipped with a variety of plugins that enhance its capabilities. For example, if you want to integrate a MySQL database with your application, you have the mysql plugin at your disposal.

Start by installing the plugin:

sudo dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql

After installing the plugin, create and link a new MySQL database to your application:

sudo dokku mysql:create your-database-name
sudo dokku mysql:link your-database-name your-app-name

Replace your-database-name with your new MySQL database’s name and your-app-name with your Dokku application’s name.

Extending Dokku with Plugins on Debian 12, 11 or 10

Dokku’s versatility is significantly amplified by its extensive range of plugins. These plugins cater to many functionalities, from database integration and logging to monitoring. This guide will elucidate the steps to seamlessly integrate these plugins into your Dokku setup on Debian Linux.

Step 1: Grasping the Essence of Dokku Plugins

A Dokku plugin, at its core, is a repository that adheres to specific conventions and is designed to augment or modify Dokku’s inherent behavior. Developers can craft these plugins in any programming language, though they primarily choose shell or Python for their simplicity. These plugins, serving as modular extensions, facilitate commonly used services and tools that are pivotal for adept application deployment and management.

Step 2: Installing Dokku Plugins on Debian

The installation of a Dokku plugin is streamlined with the dokku plugin:install command. This command requires the Git repository URL of the desired plugin and, optionally, a designated name for the plugin. The command’s structure is:

sudo dokku plugin:install <url-of-plugin-repository> <plugin-name>

Replace <url-of-plugin-repository> with the plugin’s Git repository URL and <plugin-name> (optional) with your preferred name for the plugin.

For illustration, to integrate the MySQL plugin into Dokku, execute:

sudo dokku plugin:install https://github.com/dokku/dokku-mysql.git mysql

Here, https://github.com/dokku/dokku-mysql.git represents the Git repository URL for the MySQL plugin, and mysql is the designated name for this plugin.

Validating the Plugin Installation

Post-installation, it’s prudent to verify the plugin’s integration. To enumerate all the integrated plugins, deploy the dokku plugin command:

sudo dokku plugin

This command unveils all the installed plugins. Spotting your recent addition to this list confirms a successful installation.

Refreshing Dokku Plugins

It’s imperative to keep your Dokku plugins updated to harness the latest advancements and security enhancements. To refresh all integrated plugins, employ:

sudo dokku plugin:update --all

However, if the intent is to update a specific plugin, utilize:

sudo dokku plugin:update <plugin-name>

Replace <plugin-name> with the specific plugin’s name you aim to update.

Dokku Management Commands on Debian 12, 11 or 10

Dokku, as a robust Platform as a Service (PaaS) solution, requires periodic management to ensure optimal performance, security, and compatibility. This section elucidates the procedures for upgrading, verifying, and, if necessary, removing Dokku from your Debian Linux system.

Upgrade Dokku on Debian

Staying up-to-date with Dokku’s latest version is paramount. Regular updates introduce new features and fortify your system with essential security patches and improvements.

Determining Your Dokku Version

Before embarking on the upgrade, discern the current Dokku version with:

dokku version

This command reveals the installed Dokku version, providing a reference point for post-upgrade verification.

Refresh APT Package Repository

To ensure your system is aware of the latest Dokku version, refresh your package repository:

sudo apt update

Executing the Dokku Upgrade

With the repository updated, initiate the Dokku upgrade:

sudo apt upgrade dokku

This instructs the APT package manager to focus on the Dokku package, fetching and integrating the latest version if available.

Confirming the Upgrade

Post-upgrade, reaffirm the Dokku version:

dokku version

A version increment confirms a successful upgrade.

Post-Upgrade Measures

Post-upgrade, it’s prudent to synchronize your plugins:

sudo dokku plugin:update --all

This ensures all plugins are congruent with the updated Dokku version. Additionally, peruse the release notes or changelog for insights on new features or potential alterations that might influence your applications. Always validate the functionality of your applications post-upgrade.

Dokku Removal from Debian

In specific scenarios, you might contemplate a complete Dokku removal. The ensuing steps guide you through this process.

Dokku Uninstallation

Commence the removal by uninstalling Dokku:

sudo apt remove dokku

This prompts the APT manager to delete the Dokku package, seeking confirmation before execution.

Purging Dokku Dependencies

Post Dokku removal, it’s advisable to cleanse the system of lingering dependencies:

sudo apt autoremove

This command purges redundant packages initially installed to satiate Dokku dependencies.

Remove Dokku Directories From Debian

Residual Dokku data and configurations might persist post-uninstallation. Dokku typically reserves directories at /home/dokku and /var/lib/dokku. To eradicate these:

sudo rm -rf /home/dokku
sudo rm -rf /var/lib/dokku

Exercise caution with the rm -rf command; it irrevocably deletes specified directories and their contents. Ensure no vital data resides within these directories before execution.

Lastly, the APT sources list stores the repository information. To remove the Dokku repository, delete its specific list file:

sudo rm /etc/apt/sources.list.d/dokku.list

Conclusion

In conclusion, Dokku is a formidable Platform as a Service (PaaS) solution, offering users flexibility, power, and control. Throughout this guide, we meticulously navigated installing, configuring, managing, and removing Dokku on Debian versions 12, 11, and 10. It’s imperative to regularly update and maintain your Dokku installation to harness its full potential and ensure the security and efficiency of your deployments. As with any technical endeavor, continuous learning and referencing official documentation will always serve you well.

Leave a Comment