Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

External services and HTTPS

Configure external PostgreSQL, object storage and automatic HTTPS.

Connect Widefleet to existing cloud services using the same maintained Compose configuration as the local PostgreSQL/RustFS installation. Provision the host, cloud databases, object stores, IAM and permanent DNS records before following this guide. Use Linux x86-64, the supported Docker baseline from operations, and Docker Compose 2.20.0 or newer.

This guide targets release v0.4.2 with its matching source checkout and image manifest. See the operations guide for downloading and verifying the release manifest.

Select the installation

Copy infra/deployment.env.example to a private file outside Git and fill the authentication, image-independent platform, and selected provider settings. Remove unused placeholder credentials. Secrets belong in this private file or the specified host files, never in checked-in Compose files. Keep running Compose from the repository root.

COMPOSE_FILE in that private env file selects the maintained configurations, separated by : on the supported Linux host. Always start with infra/compose.base.yaml. Select one storage backend and optionally local PostgreSQL:

File Purpose
compose.base.yaml Management, shared runtime with app sign-in, Traefik, agent and initialization
compose.postgres.yaml Add local PostgreSQL; omit for an external DATABASE_URL
compose.s3.yaml S3 settings for external storage or local RustFS
compose.rustfs.yaml Add local RustFS; combine with compose.s3.yaml
compose.azure.yaml Native Azure Blob settings, with no local object-store service
compose.gcs.yaml Native GCS settings, with no local object-store service
compose.storage-credential.yaml Read-only credential-file mounts for Azure workload identity or GCS
compose.database-ca.yaml Read-only PostgreSQL CA-bundle mount
compose.acme-cloudflare.yaml Automatic HTTPS using Cloudflare DNS validation
compose.telemetry.yaml ClickHouse and an internal OpenTelemetry Collector for runtime logs

Examples for the private env file:

# External PostgreSQL + Azure Blob + Cloudflare/Let's Encrypt:
COMPOSE_FILE=infra/compose.base.yaml:infra/compose.azure.yaml:infra/compose.acme-cloudflare.yaml

# External PostgreSQL + GCS with VM identity + supplied certificates:
# COMPOSE_FILE=infra/compose.base.yaml:infra/compose.gcs.yaml

# Local PostgreSQL + RustFS + automatic HTTPS:
# COMPOSE_FILE=infra/compose.base.yaml:infra/compose.postgres.yaml:infra/compose.s3.yaml:infra/compose.rustfs.yaml:infra/compose.acme-cloudflare.yaml

infra/compose.yaml remains the original local-service entry point, implemented as an include of the base, PostgreSQL, S3 and RustFS files. Use the explicit base/file selections above when adding optional configurations; do not layer service overrides over the include wrapper. Explicit -f arguments override COMPOSE_FILE, so omit them when using this env-file selection.

All commands must receive the same image manifest and private environment. Below, release-images.env means the matching downloaded image manifest (or locally built image references); /absolute/deployment.env is your private configuration. docker compose config can display secrets: use config --quiet for validation and keep any full rendering private.

For runtime error history and widefleet logs, add compose.telemetry.yaml and follow telemetry setup. This requires updated management, CLI and agent builds, two ClickHouse credentials and persistent telemetry directories. App hooks and runtime export become active through an explicit app redeployment.

External PostgreSQL

Provision a PostgreSQL database and a login that owns that database and can create tables, indexes and the migration schema. Management runs the checked-in migrations and idempotently registers the CLI OAuth client; database-owner permissions are sufficient. The reference uses that owner for both initialization and runtime.

Use verified TLS explicitly:

DATABASE_URL=postgres://widefleet:URL_ENCODED_PASSWORD@database.example.com:5432/widefleet?sslmode=verify-full

For Azure, use the actual Flexible Server DNS hostname (for example example.postgres.database.azure.com), including when it resolves to a private address. verify-full validates both the certificate chain and the hostname. Encode special characters in the username/password. Do not use sslmode=no-verify or NODE_TLS_REJECT_UNAUTHORIZED=0.

For a provider/private CA that is not in Node’s trust store, add infra/compose.database-ca.yaml and configure:

DATABASE_CA_HOST_FILE=/absolute/secrets/postgres-ca.pem
DATABASE_URL=postgres://widefleet:URL_ENCODED_PASSWORD@database.example.com:5432/widefleet?sslmode=verify-full&sslrootcert=/run/secrets/postgres-ca.pem

Use the certificate’s matching DNS name. Cloud SQL connections to an IP address require a server certificate that can be verified for that IP or a supported DNS name and network path. A Cloud SQL connector/proxy is not bundled. Keep server-side TLS enforcement enabled and allow the host network access to the database. Private networking and firewall rules are operator responsibilities.

The external server must support the SQL in our migrations. PostgreSQL 18 is the tested baseline; verify your provider’s version, extensions, privileges and TLS chain during installation acceptance.

Object storage

Provision separate artifact and fleet containers/buckets before initialization. Configure the selected provider using storage backends. Azure/GCS initialization verifies their existence and access; it does not create cloud resources. S3 initialization retains its existing behavior of creating missing buckets.

For Azure:

AZURE_STORAGE_ACCOUNT_NAME=examplestorage
AZURE_STORAGE_CONTAINER=widefleet-artifacts
FLEET_AZURE_CONTAINER=widefleet-fleets

Omit identity/key variables for a system-assigned VM managed identity. Set AZURE_CLIENT_ID for a user-assigned identity. Alternatively, set only AZURE_STORAGE_ACCESS_KEY for account-key authentication. The identity needs blob data access to the containers, and its metadata endpoint must be reachable from initialization, management, agent and runtime containers.

For GCS, set GCS_BUCKET and FLEET_GCS_BUCKET. An attached VM service account is the default. Give it the required object and bucket-metadata permissions. GCS external-account / Workload Identity Federation credential files remain unsupported by the pinned fleet clients.

For file credentials, add compose.storage-credential.yaml and set FLEET_CREDENTIAL_HOST_FILE to the actual absolute path on the Docker host. Set the provider’s container path to /run/widefleet/storage-credential:

  • GCS: GOOGLE_APPLICATION_CREDENTIALS=/run/widefleet/storage-credential.
  • Azure workload identity: AZURE_FEDERATED_TOKEN_FILE=/run/widefleet/storage-credential, plus AZURE_CLIENT_ID and AZURE_TENANT_ID.

The file must exist and be readable by the management container’s node user and the agent/runtime users. Check mapped IDs for rootless Docker. Mounts are read-only and fail if the host path is absent. Compose mounts the credential file into initialization, management, agent and runtime services. Preserve the inode during token refresh; atomic file replacement requires recreating affected containers, as described in storage backends.

For external S3, set S3_ENDPOINT, S3_REGION, S3_BUCKET, FLEET_S3_BUCKET, S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY. FLEET_RUNTIME_S3_ENDPOINT is only needed if the runtime container uses a different endpoint. Omit compose.rustfs.yaml. The local RustFS service shares the private management network with the runtime.

Automatic HTTPS with Cloudflare

Set up two DNS records pointing to the host’s static public IP: platform.example.com and *.apps.example.com. Use PLATFORM_URL=https://platform.example.com and APP_DOMAIN=apps.example.com. The two Entra callback URLs are shown during first setup; they do not change when adding apps. Management must be outside APP_DOMAIN. App SSO uses auth.apps.example.com, already covered by the wildcard.

Use Cloudflare DNS only for the direct Traefik setup. Cloudflare supports deeper wildcard DNS records on all plans. Its normal Universal SSL coverage for example.com does not cover app.apps.example.com when proxying; an orange-cloud deployment needs suitable edge certificates as well as origin TLS. See wildcard DNS and Universal SSL limits.

Create a Cloudflare API token with Zone / Zone / Read and Zone / DNS / Edit, scoped only to the zone(s) containing management and app hostnames. Store the token alone in a private host file, readable by Traefik’s container user; keep the token out of Compose command arguments. The ACME configuration mounts it only into Traefik through CF_DNS_API_TOKEN_FILE. See the Cloudflare DNS provider.

CLOUDFLARE_DNS_TOKEN_FILE=/absolute/secrets/cloudflare-dns-token
ACME_EMAIL=operator@example.com
ACME_ENVIRONMENT=staging

Add compose.acme-cloudflare.yaml and start the selected services. Management generates the edge configuration at startup. Issuance uses DNS-01; Traefik creates and removes temporary _acme-challenge TXT records through its configured provider. Permanent DNS routing records remain operator-managed through the versioned DNS configuration/deployment process. Starting Traefik in this mode performs external certificate/DNS operations; rendering the configuration itself does not contact Cloudflare.

Check issuance using the staging CA first. Its certificates are intentionally not trusted by browsers, the CLI or the agent. Do not weaken their TLS verification to finish a staging installation. After checking issuance logs, set ACME_ENVIRONMENT=production, recreate management to render the static configuration, then recreate Traefik before starting normal clients. The default when the variable is omitted is production.

Traefik requests management and *.APP_DOMAIN together. A nested preview such as review.notes.apps.example.com additionally requires *.notes.apps.example.com; Traefik requests it when the preview is deployed. Organizations with a hostname suffix use flat preview addresses, already covered by *.APP_DOMAIN. The ACME overlay passes TLS_MODE=cloudflare to the agent, and the base Compose configuration supplies APP_DOMAIN. Issuance and renewal are handled by Traefik’s built-in ACME resolver.

The persistent named volume acme holds separate staging.json and production.json files with ACME account keys and certificates. Traefik owns renewal and creates its files with mode 0600. Back up this volume encrypted, keep it out of Git, and do not share one account file between simultaneously running Traefik instances. Monitor proxy logs and certificate expiration; failed renewals need operator attention.

Omit the ACME file to use existing certificates. Place fullchain.pem and privkey.pem under ${PLATFORM_DATA_DIRECTORY}/tls. The certificate must cover management, the app wildcard and any nested preview hosts or their parent wildcards. Its chain must be trusted by clients. Recreate Traefik after replacing supplied certificate files. A Cloudflare Origin CA certificate is suitable only behind its proxy, not for direct browser/CLI connections.

Start and verify

Create the host data directory and agent and tls subdirectories. Widefleet uses named volumes for keys, generated edge/runtime configuration, runtime state and optional ACME state. For local services, also prepare the PostgreSQL/RustFS paths and ownership from operations. Place external credential/CA/token files before starting their consumers.

docker compose --env-file release-images.env --env-file /absolute/deployment.env --profile agent pull
docker compose --env-file release-images.env --env-file /absolute/deployment.env config --quiet

Ensure external services are reachable, then start management and the proxy. Compose starts any selected local PostgreSQL/RustFS services, runs initialize, starts the runtime and waits for its health check before starting management:

docker compose --env-file release-images.env --env-file /absolute/deployment.env up -d control-plane proxy
docker compose --env-file release-images.env --env-file /absolute/deployment.env ps --all

Complete the staging/production certificate check if using ACME. Then verify https://platform.example.com/healthz, sign in to management, register the agent, and store its returned token in the private environment file. Start the agent:

docker compose --env-file release-images.env --env-file /absolute/deployment.env --profile agent up -d agent

Acceptance: log in with the CLI, deploy an app, complete app SSO, write/read D1 and R2 data, and repeat those reads after a normal runtime restart. Check that selected external services are used and that PostgreSQL/RustFS containers are absent when not selected. Only ports 80/443 are public. The initialize service prepares storage and the database schema before the runtime starts; deployment verifies app data access.

Restart Traefik after infrastructure changes to TLS mode or ACME environment. Keep generated app routes and ACME account state in their named volumes. Product SSO settings are managed through the UI/API, independently of these deployment settings. See first setup and recovery.

Last updated on October 23, 2026