Skip to content

Setup Cloudflare DNS

This tutorial walks through connecting a Cloudflare account to Sadeem and choosing a DNS strategy for your subscriptions.


Prerequisites

Before starting, confirm:

  • A Cloudflare account with your domain added as a zone
  • Your domain's nameservers are pointing to Cloudflare (check in the Cloudflare dashboard — the zone status must say Active)
  • Network access from the Master Odoo to the Cloudflare API (https://api.cloudflare.com)

Step 1: Create the API Token

Sadeem uses an API token (not the Global API Key) for scoped, revocable access.

  1. Log in to dash.cloudflare.com
  2. Navigate to My Profile → API Tokens → Create Token
  3. Choose Custom Token (not a template)
  4. Under Permissions, add: Zone → DNS → Edit — select the specific zone you'll use for SaaS subdomains
  5. Under Zone Resources: set Include → Specific zone → <your domain>
  6. Optionally set an expiration date (recommended for production)
  7. Click Continue to summary → Create Token
  8. Copy the token — it is shown only once

Warning

Store the token securely. If lost, generate a new one. Do not use the Global API Key — it grants full account access.


Step 2: Find Your Zone ID

  1. Navigate to Cloudflare dashboard → <your domain> → Overview
  2. In the right sidebar under the API section, the Zone ID is displayed
  3. Copy it — you'll paste it into Sadeem in the next step

Step 3: Add the Cloudflare Account in Sadeem

Navigate to SAAS Management → Infrastructure → Cloudflare Accounts → New.

Field Value
Name A label, e.g. sadeem.cloud
API Token The token you created above
Email Your Cloudflare account email address

Save the record.

Tip

After saving, click Test Connection on the record. A successful test posts a confirmation message to the chatter including the account details returned by the Cloudflare API. A failed test shows the error message from Cloudflare — check the token permissions and zone scope.


Docker (Portainer environment)

Open the Portainer environment: SAAS Management → Infrastructure → Portainer Servers → <server> → Environments → <env>.

Field Value
Cloudflare Account Select the account you just created
Cloudflare domain zone id Your Zone ID
Proxied Enable or disable based on preference
Auto create DNS record See Step 5

These values are inherited by every subscription created under this environment — you typically won't need to fill them in per-subscription.

DBFilter (server group)

Open the server group: SAAS Management → Infrastructure → DBFilter Servers → <server group>.

Set the same Cloudflare Account, Cloudflare domain zone id, and Auto create DNS record fields. Every subscription created from this server group inherits them automatically.


Step 5: Choose a DNS Strategy

You have two approaches. Pick one — you don't need both.

Option A — Auto-create per subscription

Enable Auto create DNS record on your Portainer environment or DBFilter server group.

When each subscription is built, Sadeem creates an individual A record in Cloudflare for that subscription's domain automatically. The record is also removed when the subscription is terminated.

Best for: operators who want fully automated, per-customer DNS without managing records manually.

Option B — Wildcard record (manual, one-time)

Create a single wildcard A record in Cloudflare that covers all subdomains at once. Navigate to SAAS Management → Infrastructure → Cloudflare Accounts → <your account> → Records → New:

Field Value
Type A
Name *
Content Your server's public IP
Zone ID Your Zone ID
Proxied Enabled

With this in place, every subdomain resolves automatically. Leave Auto create DNS record disabled on your environments — Sadeem skips the DNS step entirely during build.

Best for: operators who want the simplest setup or who manage many subscriptions under the same domain.

Note

Option B does not require a Cloudflare account to be configured in Sadeem at all — the wildcard record is a one-time manual step in the Cloudflare dashboard.


Verifying DNS

After a subscription is built, verify DNS is resolving:

dig customer1.yourdomain.com
# Should return your server IP (or a Cloudflare proxy IP if proxied)

Allow a few minutes for propagation if the record was just created.

Note

Cloudflare error 81058 means a DNS record for that domain already exists. Sadeem's Diagnosis & Fix handles this automatically by finding and linking the existing record — no manual action is needed.