Skip to main content

Reference

Static assets with CDN / Spaces with CDN

Provision Spaces plus CDN for public asset delivery, edge caching, and DNS-backed custom URLs.

Overview

Variant overview

Provision Spaces plus CDN for public asset delivery, edge caching, and DNS-backed custom URLs.

Manifest file

Edit static-assets-cdn-spaces-cdn.environment.yaml to change the scenario.

Rendered output

OPSd renders the manifest into OpenTofu under rendered/static-assets-cdn-spaces-cdn.

Supported changes

The variant defines which add, remove, and scale operations are supported.

Good fit

the operating model of this variant already matches the team and workload

Tradeoff

Review the supported growth boundary before choosing this path.

What gets created for this setup

This diagram shows the result you get after rendering the selected variant.

Infrastructure shape

Actor

Provider Zone

Edge

Data

CDN
DNS
Spaces
Actor -> CDN · request 1 CDN -> DNS · resolve 2 DNS -> Spaces · storage 3

Before you start

Shared setup is covered in Installation and the Introduction. This section lists the minimum things you need before the first render for DigitalOcean.

  • Installation install the shared OPSd CLI.
  • Introduction understand the workflow boundary and required toolchain.
  • Have a container image or build artifact ready.

Initialize this variant

This is the first-run path when no scenario has been initialized yet.

Initialization sequence

opsd list blueprints
opsd init blueprint static-assets-cdn static-assets-cdn-spaces-cdn.environment.yaml --variant spaces-cdn
opsd validate manifest static-assets-cdn-spaces-cdn.environment.yaml
opsd render manifest static-assets-cdn-spaces-cdn.environment.yaml --output rendered/static-assets-cdn-spaces-cdn
cd rendered/static-assets-cdn-spaces-cdn
tofu init
tofu plan

# review the rendered output before planning
cd rendered/static-assets-cdn-spaces-cdn
tofu init
tofu plan

Edit the manifest

After the first deployment, the supported path is still manifest first. Use the supported opsd add, remove, and scale commands for this variant, then validate and render again.

Supported change commands

Remove a CDN endpoint

Clear the CDN endpoint list when the variant supports removal.

opsd remove cdn-endpoint static-assets-cdn-spaces-cdn.environment.yaml assets-cdn

Edit, validate, render

# edit static-assets-cdn-spaces-cdn.environment.yaml

# validate the config before rendering
opsd validate manifest static-assets-cdn-spaces-cdn.environment.yaml

# render the updated output and review it
opsd render manifest static-assets-cdn-spaces-cdn.environment.yaml --output rendered/static-assets-cdn-spaces-cdn
cd rendered/static-assets-cdn-spaces-cdn

# plan and apply only after the diff is clear
tofu plan
tofu apply

Supported changes

These examples come from the variant capability map and show the supported add, remove, and scale operations for this setup.

Remove a CDN endpoint

Clear the CDN endpoint list when the variant supports removal.

opsd remove cdn-endpoint static-assets-cdn-spaces-cdn.environment.yaml assets-cdn

Changes are not active yet

Editing the manifest changes the desired state. To make it real, validate the manifest, render the updated output, and then run `tofu apply` against the rendered directory.

opsd validate manifest static-assets-cdn-spaces-cdn.environment.yaml
opsd render manifest static-assets-cdn-spaces-cdn.environment.yaml --output rendered/static-assets-cdn-spaces-cdn
cd rendered/static-assets-cdn-spaces-cdn
tofu plan
tofu apply

Related variants

Use the scenario overview to compare the other supported variants for the same blueprint.