DigitalOcean Droplet with Managed Database​Digital​Ocean ​Droplet with ​Managed ​Database

Install Kestra on DigitalOcean Droplet with DigitalOcean Database as a database backend.

This guide provides instructions for deploying Kestra on DigitalOcean Droplet with Managed Database from DigitalOcean as a database backend.

Prerequisites:

  • basic knowledge about using a command line interface
  • basic knowledge about DigitalOcean and PostgreSQL

Create a DigitalOcean Droplet

First, we will create a virtual machine known as a Droplet in DigitalOcean. To do so, go to the DigitalOcean portal and choose Droplets from the left navigation bar.

  1. On the Droplets page, click on Create Droplet button. This will navigate you to the "Create Droplets" page.
  2. Choose an appropriate region.
  3. Choose Ubuntu as the OS image with the latest version.
  4. Kestra needs at least 4GiB Memory and 2vCPU to run correctly. You can go with Shared or Dedicated CPU configuraton options as per your requirement. Here, we are choosing Basic plan with Regular CPU option, and a plan that provides us with 4GiB Memory and 2vCPU.
  5. You can choose an appropriate authentication method: SSH Key or Password based.
  6. Provide an appropriate hostname, and click on the Create Droplet button at the bottom.

droplet_setup1

droplet_setup2

droplet_setup3

droplet_setup4

Wait until the virtual machine is up and running. From the Droplets page, you can navigate to the recently created Droplet. From here, you can open the machine's console by clicking on the Console button at the top.

droplet_setup5

Install Docker

Once in the console terminal, you can run the commands to install Kestra.

Kestra can be started directly from a .jar binary or using Docker. We’ll use Docker here for a quick setup:

  1. Install Docker on the Droplet. You can find the last updated instruction on the Docker website.
  2. Install docker compose.

To check your installation, run sudo docker version and sudo docker compose version. You're now ready to download and launch the Kestra server.

Install Kestra

Download the official Docker-Compose file: curl -o docker-compose.yml https://raw.githubusercontent.com/kestra-io/kestra/develop/docker-compose.yml

Use an editor such as Vim to modify the docker-compose.yml, set basic authentication to true, and configure your basic authentication credentials to secure your Kestra instance.

yaml
kestra:
  server:
    basic-auth:
      enabled: true
      username: [email protected] # it must be a valid email address
      password: kestra

Then, use the following command to start the Kestra server:

bash
sudo docker compose up -d

You can now access the Kestra UI at http://<public_droplet_ip>:8080 and start developing flows.

Launch DigitalOcean Database

This first installation relies on a PostgreSQL database running alongside the Kestra server - on the VM instance (see the PostgreSQL service running thanks to the docker-compose).

For a simple proof of concept (PoC), you can keep the PostgreSQL database running in Docker.

However, for a production-grade installation, we recommend a managed database service such as DigitalOcean Database.

Launch a PostgreSQL database using DigitalOcean Database

  1. Go to the DigitalOcean Databases.
  2. Click on Create Database button on the top.
  3. Choose an appropriate region and select PostgreSQL as the database engine (Kestra also supports MySQL, but PostgreSQL is recommended).
  4. Choose the database configuration as per your requirement.
  5. Provide an appropriate database cluster name.
  6. Click on the Create Database Cluster button at the bottom of the page.
  7. Wait for the database to be provisioned. Generally, this takes around 5 minutes.

db_setup1

db_setup2

db_setup3

  1. Once the database is ready, you can click on the Get Started button.
  2. In the Add trusted sources dropbox, you can select your computer (in case you want to connect to this database from the PostgreSQL client running on your computer), and the kestra-host droplet created in the earlier section.
  3. Click on Allow these inbound sources only.
  4. On this page, ensure Public network is selected on the top. Take a note of the Connection Details that appear, and click on Continue.
  5. On the next page, click on Great, I'm done button.

db_setup4

db_setup5

db_setup6

db_setup7

Create a Kestra database

  1. Go to the database overview page, navigate to Users & Databases tab.
  2. Under Databases, type an appropriate database name, and click on Save.

db_setup8

db_setup9

Update Kestra configuration

In the docker-compose configuration, edit the datasources property of the Kestra service to point Kestra to your Azure database:

yaml
datasources:
  postgres:
    url: jdbc:postgresql://<your-db-host>:25060/<db_name>
    driverClassName: org.postgresql.Driver
    username: doadmin
    password: <your-password>

Because you now use the database powered by "DigitalOcean Database", you don't need the Postgres Docker service anymore. Remove it from the docker-compose.yml file. You'll also need to delete the depends_on section at the end of the YAML file:

yaml
depends_on:
  postgres:
    condition: service_started

In order for the changes to take effect, restart the docker services with sudo docker compose restart or sudo docker compose up -d.

Configure Spaces Object Storage

By default, internal storage is implemented using the local file system. This section will guide you on how to change the storage backend to Spaces Object Storage to ensure more reliable, durable, and scalable storage.

Firstly, we will create the access key and secret key that can be used to connect to Spaces Object Storage.

  1. Navigate to the API from the left navigation menu.
  2. Go to the Spaces Keys tab.
  3. Click on Generate New Key button.
  4. Provide an appropriate name for the spaces access key, and click on Create Access Key.
  5. A new access key with the given name will be generated. Take a note of the secret key as you will not be able to retrieve it later.

spaces_api1

spaces_api2

spaces_api3

Let's create a bucket in the Spaces Object Storage.

  1. Go to the Spaces Object Storage. You can also navigate to the Spaces Object Storage from the left navigation menu.
  2. Click on Create Spaces Bucket button.
  3. Choose an appropriate data center region.
  4. Put an appropriate unique Spaces Bucket name, and select the corresponding project in which the Spaces Bucket needs to be created.
  5. Click on Create a Spaces Bucket at the bottom to create the Spaces Bucket.
  6. Once the bucket is created, you can go to the bucket's page, and note down the Original Endpoint.
  7. Edit the Kestra storage configuration in the docker-compose.yml file.
yaml
kestra:
  storage:
    type: minio
    minio:
      endpoint: "<bucket-original-endpoint>"
      port: "443"
      secure: true
      accessKey: "<spaces-access-key>"
      secretKey: "<spaces-secret-key>"
      region: "FRA1"
      bucket: "<bucket-name>"

In order for the changes to take effect, restart the docker services with sudo docker compose restart or sudo docker compose up -d.

spaces_object_storage1

spaces_object_storage2

spaces_object_storage3

spaces_object_storage4

Next steps

This guide walked you through installing Kestra on a DigitalOcean Droplet with DigitalOcean Database.

This setup provides a simple starting point for running Kestra in production on a single machine.

Reach out via Slack if you encounter any issues or if you have any questions regarding deploying Kestra to production.

Make sure to also check the CI/CD guide to automate your workflow deployments based on changes in Git.