Skip to content

DigitalOcean ​

DigitalOcean is WebKit's primary infrastructure provider, offering App Platform for containerised deployments, Droplets for VMs, managed Postgres databases, and Spaces for object storage.

Authentication ​

Set your DigitalOcean API token as an environment variable:

bash
export DIGITALOCEAN_ACCESS_TOKEN="your-token"

Generate a token at cloud.digitalocean.com/account/api/tokens with read/write permissions.

App Platform ​

DigitalOcean App Platform provides managed container hosting with automatic scaling, SSL, and continuous deployment.

Configuration ​

json
{
  "apps": [
    {
      "name": "web",
      "type": "svelte-kit",
      "path": "./apps/web",
      "infrastructure": {
        "provider": "digital_ocean",
        "type": "app",
        "config": {
          "instance_size": "basic-xxs",
          "instance_count": 1,
          "region": "lon"
        }
      }
    }
  ]
}

Instance sizes ​

SizevCPUsMemoryMonthly cost
basic-xxsShared512MB~$5
basic-xsShared1GB~$10
basic-s12GB~$20
basic-m24GB~$40
professional-xs11GB~$12
professional-s12GB~$25
professional-m24GB~$50

Professional instances include dedicated CPU resources.

Regions ​

CodeLocation
lonLondon, UK
amsAmsterdam, Netherlands
fraFrankfurt, Germany
nycNew York, USA
sfoSan Francisco, USA
sgpSingapore
blrBangalore, India
sydSydney, Australia

Domain configuration ​

Configure domains for your app:

json
{
  "apps": [
    {
      "name": "web",
      "domains": {
        "primary": "example.com",
        "aliases": ["www.example.com"]
      }
    }
  ]
}

WebKit automatically:

  • Configures the domain in App Platform
  • Creates DNS records if the domain is managed by DigitalOcean
  • Provisions SSL certificates via Let's Encrypt

Alerts ​

App Platform alerts are automatically configured when you enable Slack notifications. Alerts trigger for:

  • CPU utilisation above 80%
  • Memory utilisation above 80%
  • Application restarts (more than 3 in 5 minutes)

Droplets ​

Droplets are virtual machines for workloads requiring more control than App Platform provides.

Configuration ​

json
{
  "apps": [
    {
      "name": "api",
      "type": "golang",
      "path": "./apps/api",
      "infrastructure": {
        "provider": "digital_ocean",
        "type": "vm",
        "config": {
          "size": "s-1vcpu-1gb",
          "region": "lon1",
          "image": "ubuntu-22-04-x64"
        }
      }
    }
  ]
}

Droplet sizes ​

SizevCPUsMemoryStorageMonthly cost
s-1vcpu-512mb-10gb1512MB10GB~$4
s-1vcpu-1gb11GB25GB~$6
s-1vcpu-2gb12GB50GB~$12
s-2vcpu-2gb22GB60GB~$18
s-2vcpu-4gb24GB80GB~$24
s-4vcpu-8gb48GB160GB~$48

Regions ​

Droplet regions use slightly different codes than App Platform:

CodeLocation
lon1London, UK
ams3Amsterdam, Netherlands
fra1Frankfurt, Germany
nyc1, nyc3New York, USA
sfo3San Francisco, USA
sgp1Singapore
blr1Bangalore, India

SSH access ​

WebKit configures SSH keys for Droplet access. Add your public key to the project's SSH configuration or use DigitalOcean's team SSH keys.

Managed Postgres ​

DigitalOcean Managed Databases provides fully managed PostgreSQL with automatic backups, failover, and maintenance.

Configuration ​

json
{
  "resources": [
    {
      "name": "postgres",
      "type": "postgres",
      "provider": "digital_ocean",
      "config": {
        "size": "db-s-1vcpu-1gb",
        "region": "lon1",
        "version": "15"
      },
      "backup": {
        "enabled": true,
        "schedule": "0 3 * * *"
      }
    }
  ]
}

Database sizes ​

SizevCPUsMemoryStorageMonthly cost
db-s-1vcpu-1gb11GB10GB~$15
db-s-1vcpu-2gb12GB25GB~$30
db-s-2vcpu-4gb24GB38GB~$60
db-s-4vcpu-8gb48GB115GB~$120

Outputs ​

After provisioning, these outputs are available for environment variables:

OutputDescription
postgres.connection_urlFull connection string
postgres.hostDatabase host
postgres.portDatabase port
postgres.databaseDatabase name
postgres.userDatabase user
postgres.passwordDatabase password

Use them in your manifest:

json
{
  "environment": {
    "production": {
      "DATABASE_URL": {
        "source": "resource",
        "value": "postgres.connection_url"
      }
    }
  }
}

Spaces (Object Storage) ​

DigitalOcean Spaces provides S3-compatible object storage for files, assets, and backups.

Configuration ​

json
{
  "resources": [
    {
      "name": "storage",
      "type": "s3",
      "provider": "digital_ocean",
      "config": {
        "region": "ams3",
        "acl": "private"
      }
    }
  ]
}

Regions ​

CodeLocation
ams3Amsterdam
fra1Frankfurt
nyc3New York
sfo3San Francisco
sgp1Singapore
syd1Sydney

ACL options ​

ACLDescription
privateNo public access (default)
public-readPublic read access

Outputs ​

OutputDescription
storage.bucket_nameBucket name
storage.endpointS3 endpoint URL
storage.regionBucket region

CDN ​

Enable CDN for public buckets:

json
{
  "resources": [
    {
      "name": "storage",
      "type": "s3",
      "provider": "digital_ocean",
      "config": {
        "acl": "public-read",
        "cdn": {
          "enabled": true,
          "ttl": 3600
        }
      }
    }
  ]
}

DNS management ​

WebKit can manage DNS records for domains hosted on DigitalOcean:

json
{
  "apps": [
    {
      "name": "web",
      "domains": {
        "primary": "example.com",
        "managed": true
      }
    }
  ]
}

When managed: true, WebKit creates:

  • A records pointing to App Platform
  • CNAME records for aliases
  • Required verification records

Example: Full-stack application ​

A complete example deploying a SvelteKit frontend with Payload CMS and Postgres:

json
{
  "project": {
    "name": "my-app",
    "title": "My Application",
    "repo": "github.com/myorg/my-app"
  },
  "apps": [
    {
      "name": "web",
      "type": "svelte-kit",
      "path": "./apps/web",
      "infrastructure": {
        "provider": "digital_ocean",
        "type": "app",
        "config": {
          "instance_size": "basic-xs",
          "region": "lon"
        }
      },
      "domains": {
        "primary": "myapp.com",
        "aliases": ["www.myapp.com"]
      }
    },
    {
      "name": "cms",
      "type": "payload",
      "path": "./apps/cms",
      "infrastructure": {
        "provider": "digital_ocean",
        "type": "app",
        "config": {
          "instance_size": "basic-s",
          "region": "lon"
        }
      },
      "domains": {
        "primary": "cms.myapp.com"
      },
      "environment": {
        "production": {
          "DATABASE_URL": {
            "source": "resource",
            "value": "postgres.connection_url"
          }
        }
      }
    }
  ],
  "resources": [
    {
      "name": "postgres",
      "type": "postgres",
      "provider": "digital_ocean",
      "config": {
        "size": "db-s-1vcpu-1gb",
        "region": "lon1"
      }
    },
    {
      "name": "storage",
      "type": "s3",
      "provider": "digital_ocean",
      "config": {
        "region": "ams3"
      }
    }
  ]
}

Further reading ​

Released under the MIT Licence.