OpenMCF logoOpenMCF

Loading...

DigitalOcean Database Cluster

Deploys a managed database cluster on DigitalOcean supporting PostgreSQL, MySQL, Redis, and MongoDB engines. The component handles node sizing, version selection, optional VPC placement, and custom storage configuration, exposing connection details as stack outputs.

What Gets Created

When you deploy a DigitalOceanDatabaseCluster resource, OpenMCF provisions:

  • Database Cluster — a digitalocean_database_cluster resource with the specified engine, version, region, node size, and node count
  • VPC Attachment — created only when vpc is specified, places the cluster in a private network for secure access
  • Custom Storage — configured only when storageGib is specified, overrides the default storage for the chosen node size

Prerequisites

  • DigitalOcean credentials configured via environment variables or OpenMCF provider config
  • A DigitalOcean VPC in the target region if using private networking (can reference a DigitalOceanVpc resource via valueFrom)
  • A supported engine version for the chosen database engine (e.g., 16 for PostgreSQL 16, 8 for MySQL 8)

Quick Start

Create a file database.yaml:

apiVersion: digital-ocean.openmcf.org/v1
kind: DigitalOceanDatabaseCluster
metadata:
  name: my-database
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.DigitalOceanDatabaseCluster.my-database
spec:
  clusterName: my-database
  engine: pg
  engineVersion: "16"
  region: nyc3
  sizeSlug: db-s-1vcpu-2gb
  nodeCount: 1

Deploy:

openmcf apply -f database.yaml

This creates a single-node PostgreSQL 16 cluster in the NYC3 region with the db-s-1vcpu-2gb Droplet size.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
clusterNamestringName of the database cluster in DigitalOcean.Required, max 64 characters
engineenumDatabase engine. Valid values: pg (PostgreSQL), mysql, redis, mongodb.Required
engineVersionstringMajor version of the database engine (e.g., 16 for PostgreSQL, 8 for MySQL).Required, pattern: ^[0-9]+(\.[0-9]+)?$
regionenumDigitalOcean region for the cluster. Valid values: nyc3, sfo3, fra1, sgp1, lon1, tor1, blr1, ams3.Required
sizeSlugstringDroplet size slug for cluster nodes (e.g., db-s-2vcpu-4gb). Determines CPU and memory per node.Required
nodeCountuint32Number of nodes in the cluster.Required, 1–3

Optional Fields

FieldTypeDefaultDescription
vpcStringValueOrRef—VPC UUID for private network placement. Can reference a DigitalOceanVpc resource via valueFrom.
storageGibuint32—Custom storage size in GiB. If not set, uses the default storage for the chosen sizeSlug.
enablePublicConnectivityboolfalseWhen true, enables public network access to the cluster. When false, the cluster is accessible only via VPC or DigitalOcean internal network.

Examples

MySQL Cluster in VPC

A single-node MySQL 8 cluster placed in a private network:

apiVersion: digital-ocean.openmcf.org/v1
kind: DigitalOceanDatabaseCluster
metadata:
  name: mysql-app-db
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.DigitalOceanDatabaseCluster.mysql-app-db
spec:
  clusterName: mysql-app-db
  engine: mysql
  engineVersion: "8"
  region: fra1
  sizeSlug: db-s-2vcpu-4gb
  nodeCount: 1
  vpc:
    value: "vpc-fra1-uuid"

HA PostgreSQL with Custom Storage

A three-node PostgreSQL cluster with increased storage for production workloads:

apiVersion: digital-ocean.openmcf.org/v1
kind: DigitalOceanDatabaseCluster
metadata:
  name: prod-postgres
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.DigitalOceanDatabaseCluster.prod-postgres
spec:
  clusterName: prod-postgres
  engine: pg
  engineVersion: "16"
  region: nyc3
  sizeSlug: db-s-4vcpu-8gb
  nodeCount: 3
  storageGib: 100
  vpc:
    value: "vpc-prod-uuid"

Redis Cache with VPC Reference

A Redis cluster using a foreign key reference to an OpenMCF-managed VPC:

apiVersion: digital-ocean.openmcf.org/v1
kind: DigitalOceanDatabaseCluster
metadata:
  name: cache-redis
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.DigitalOceanDatabaseCluster.cache-redis
spec:
  clusterName: cache-redis
  engine: redis
  engineVersion: "7"
  region: sgp1
  sizeSlug: db-s-2vcpu-4gb
  nodeCount: 2
  vpc:
    valueFrom:
      kind: DigitalOceanVpc
      name: prod-vpc
      field: status.outputs.vpc_id

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
cluster_idstringUUID of the created database cluster
connection_uristringFull connection URI including credentials and database name
hoststringHostname or IP address of the database cluster
portuint32Network port the database cluster listens on
database_userstringUsername for the cluster's default database user
database_passwordstringPassword for the cluster's default database user

Related Components

  • DigitalOceanVpc — provides the VPC for private network placement
  • DigitalOceanKubernetesCluster — commonly co-deployed to run applications that consume the database
  • DigitalOceanFirewall — controls network access to the database cluster

Next article

DigitalOcean DNS Record

DigitalOcean DNS Record Creates a single DNS record within an existing DigitalOcean DNS zone (domain). The component supports A, AAAA, CNAME, MX, TXT, SRV, NS, and CAA record types, with type-specific fields for priority, weight, port, flags, and tag applied conditionally based on the record type. What Gets Created When you deploy a DigitalOceanDnsRecord resource, OpenMCF provisions: DNS Record — a single digitaloceanrecord resource in the specified domain with the configured type, name, value,...
Read next article
Presets
3 ready-to-deploy configurationsView presets →