Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.monk.io/llms.txt

Use this file to discover all available pages before exploring further.

What is this integration?

Provision and manage DigitalOcean managed databases.

Supported Engines

EngineSlugVersions
PostgreSQLpg11, 12, 13, 14, 15, 16
MySQLmysql5.7, 8.0
Valkeyvalkey7, 8
MongoDBmongodb4.4, 5.0, 6.0, 7.0
Apache Kafkakafka3.5
OpenSearchopensearch1.x, 2.x
Note: Redis has been replaced by Valkey on DigitalOcean. If you want to use Redis, use valkey as the engine instead. For backwards compatibility, specifying engine: redis will automatically be mapped to valkey.

What Monk manages

  • Database clusters and configuration

Obtaining DigitalOcean Credentials

To use DigitalOcean Managed Databases with Monk, you’ll need a DigitalOcean API token.

What You’ll Need

  • Personal Access Token - DigitalOcean API token with read/write access
  • Optional: Default region (e.g., nyc1)

Step-by-Step

  1. Log into DigitalOcean at https://cloud.digitalocean.com
  2. Click API in the left sidebar
  3. Go to Tokens/Keys tab
  4. Click Generate New Token
  5. Token name: “Monk Deployment”
  6. Scopes: Check both Read and Write
  7. Click Generate Token
  8. Copy the token immediately - it’s shown only once
  9. Save it securely

Providing to Monk

When deploying to DigitalOcean, ask Monk:
deploy to DigitalOcean
use DigitalOcean managed MongoDB
Monk will request your DigitalOcean credentials if not already configured.

Security Best Practices

Rotate tokens regularly - Generate new tokens every 90 days ✅ Revoke unused tokens - Remove old tokens from DigitalOcean ✅ Use minimal scopes - Read + Write is sufficient for Monk ✅ Monitor usage - Check DigitalOcean activity logs

Getting Started

  1. Provide DigitalOcean credentials to Monk when prompted
  2. Define a PostgreSQL cluster (save as do-db.yaml):
namespace: digitalocean-database-example

my-postgres-db:
  defines: digitalocean-database/database
  name: my-postgres-cluster
  engine: pg
  version: "16"
  num_nodes: 1
  region: nyc1
  size: db-s-1vcpu-1gb
  1. Create/update:
monk update digitalocean-database-example/my-postgres-db

Backup & Restore Actions

DigitalOcean managed databases include automatic daily backups with 7-day retention.
ActionDescriptionKey Parameters
get-backup-infoShow backup config and PITR status-
list-backupsList available backup points-
describe-backupGet backup detailsbackup_created_at
restoreFork new cluster from backupnew_cluster_name, backup_created_at
get-restore-statusCheck fork progresscluster_id

Restore Example

# List available backups
monk do digitalocean-database-example/my-postgres-db/list-backups

# Restore to new cluster
monk do digitalocean-database-example/my-postgres-db/restore \
  --new_cluster_name=restored-db \
  --backup_created_at=2024-01-15T00:00:00Z
Note: Restore creates a NEW independent cluster (no in-place restore). PITR is supported for PostgreSQL and MySQL only.

Composing with Other Entities

Use connection-target to wire your app to a DigitalOcean managed database and read connection details from its state:
namespace: my-infra

my-postgres-db:
  defines: digitalocean-database/database
  name: my-app-db
  engine: pg
  version: "16"
  num_nodes: 1
  region: nyc1
  size: db-s-1vcpu-1gb

my-app:
  defines: runnable
  variables:
    db-host:
      type: string
      value: <- connection-target("database") entity-state get-member("connection_host")
      env: DB_HOST
    db-port:
      type: string
      value: <- connection-target("database") entity-state get-member("connection_port")
      env: DB_PORT
    db-user:
      type: string
      value: <- connection-target("database") entity-state get-member("connection_user")
      env: DB_USER
    db-password:
      type: string
      value: <- connection-target("database") entity-state get-member("connection_password")
      env: DB_PASSWORD
    db-name:
      type: string
      value: <- connection-target("database") entity-state get-member("connection_database")
      env: DB_NAME
  connections:
    database:
      runnable: my-infra/my-postgres-db
      service: data
  depends:
    wait-for:
      runnables:
        - my-infra/my-postgres-db
      timeout: 120