Install Cloudflareddns on TrueNAS Scale (If you have a dynamic IP)

1. Prerequisites

TrueNAS Scale set up for Apps.
Cloudflare domain

2. Summary

To configure the Truecharts app cloudflareddns the following information is required to be entered in the configuration.
Cloudflare API Token
Domain name
Cloudflare Zone ID
DNS Record Type
Storage Type

3. Introduction

If you followed my previous article on transferring your domain DNS to Cloudflare then your DNS on Cloudflare will look like this:

Cloudflare DNS management interface for ryeroxley.co.uk, showing DNS records with types A, CNAME, MX, SRV, TXT, their contents, proxy status, and TTL settings.

Note the A record points to 83.233.160.22. This will point to your previous site. In this case names.co.uk. This must point to the IP address of your self-hosted server or gateway/router. If you have a dynamic IP address then this IP address can change without notice. Using the TrueNAS Scale App cloudflareddns will monitor your IP address and update it in Cloudflare if required.

To configure the app we need to know:

Cloudflare API Token.
Cloudflare Zone ID.
Host Path for Storage.

App Configuration
For the next section, we need to get an API Token and a Zone from Cloudflare.

Log in to Cloudflare. Click on the appropriate domain. On the right-hand side there is a link to Get your API token click on the link. Next click Create Token.

The homepage of a Cloudflare account management interface displaying the domain 'ryeroxley.co.uk' as active. A search bar and 'Add a site' button are available for further actions.
A screenshot of the Cloudflare analytics dashboard for the domain ryeroxley.co.uk, showing traffic data and quick action settings.
A screenshot of the Cloudflare User API Tokens page showing an option to create a new token and sections for API Tokens and API Keys, with 'No API tokens' listed and buttons to view or change the Global API Key and Origin CA Key.

As we want to edit the A record in the DNS click on the Edit zone DNS, Use Template.

A screenshot of the Cloudflare User API Tokens creation page, offering various pre-configured permission templates for tasks like editing DNS zones, reading billing information, and managing Cloudflare Workers, as well as an option to create a custom API token.

The Zone to edit is DNS and it needs Edit permissions. The Resource to include is the specific domain to edit. (if you are hosting more than one domain you may wish to leave this set to All). Optionally you can also restrict to specific IP addresses or time scales. click Continue to summary.

A configuration page for creating a new Cloudflare API token named 'Edit zone DNS' with specific permissions and zone resources targeted to the domain 'ryeroxley.co.uk'.

Check the summary and Create Token. The next screen displays the API Token. Copy and paste the token somewhere safe!

A confirmation screen showing that an 'Edit zone DNS' API token was successfully created on Cloudflare, with an obscured token displayed and a button to copy it. Instructions are provided to test the token using a CURL command in a terminal.

If you have access to a Linux shell you can test the token by pasting the code into the shell. You should get a response that includes the text "This API Token is valid and active"

We have the API token the other piece of information needed is the API Zone ID . Click back to return to the account home and then click on the domain again.

A user's account settings navigation menu on Cloudflare, highlighting the 'API Tokens' option for managing access tokens.
Cloudflare account home page displaying a single active domain, 'ryeroxley.co.uk', with options to filter, search, and add more sites.

In the resulting window the API Zone ID is at the bottom on the right hand side.

Cloudflare analytics dashboard for the domain ryeroxley.co.uk, showing graphs for unique visitors, total requests, percent cached, and total data served.

Storage and Persistence

As discussed here I prefer to use Host Path for storing data separately from the container. To replicate the same structure, follow the guidelines provided and assign the dataset to cloudflaredns.

3. Install Truecharts Cloudflareddns

In many cases TrueNAS Scale offers Apps from TrueNAS and Truecharts however for Cloudflareddns the App is only offered by Truecharts. In TrueNAS Scale go to Apps > Check Available Apps and search for cloudflareddns. Click on the Cloudflareddns icon then click install. If this is the first app you have installed you will be presented with an Information warning, click Confirm and then Agree.

A screenshot of the TrueNAS Scale interface with no applications installed, featuring a sidebar with various management options and a main window with an option to check available apps.
Detailed view of the 'CloudflaredDNS' app in the TrueNAS catalog, highlighting the latest version, stable train, and resources needed, with links to documentation and an invitation to support the TrueCharts project.
A search result on the TrueNAS Discover Applications page showing an app called 'CloudflaredDNS' designed to automate Cloudflare DNS records for dynamic IP addresses.

Once the app settings have loaded, you will encounter a vast array of options. Please proceed through these steps one by one:

Application Name
As this is likely to be the only instance of this App we will load then these settings can be left as they are.
General Settings
Again these can be left as they are.
Workload Settings
Again these can be left as they are.

A configuration window for an application named 'cloudflaredDNS' with the version field set to 9.8.4, ready for installation or update.
A screenshot of the 'General Settings' panel in a software application, with options to 'Stop All', set the timezone to 'Europe/London', enable 'Expert - Pod Options', and add 'Image Pull Secrets', indicative of deployment configurations.
A screenshot of 'Workload Settings' in a deployment configuration interface, showing options to specify deployment type, the number of replicas, and add containers along with extra environment variables and arguments.

At the bottom on the right in the API block is the Zone ID.

GPT Alt Text: An interface for configuring the Cloudflared DNS app with fields for entering API key, user, token, and other settings, awaiting input.

Returning to the TrueNAS Scale App we now have the information we need for the App configuration section.

CF API Key - leave blank.
CF User - leave blank.
CF API Token - insert the token we generated earlier.
CF API Token Zone - leave blank.
Interval - do not change.
Detection Mode - do not change.
Detection Mode Override - do not change.
Log Level - do not change.

Next click Add to add a Host, Zones and Record Types

Screenshot of a configuration window for DNS settings with fields for entering the 'Domain', 'Zone', and 'Record Type'. The 'Domain' is filled with 'ryroxley.com', and 'Record Type' is set to 'A', indicating an A record setup in DNS management.

For the Domain enter your domain.

The Zone is the API Zone ID we obtained from Cloudflare earlier.

Leave the Record Type as A.

A cropped section of a software interface highlighting the 'Networking and Services' header and a 'Show Expert Config' toggle, next to a 'Section Help' prompt for configuring network and services for containers.

The Network and Services Section can be left as the defaults.

A configuration panel titled 'Storage and Persistence' featuring options for 'Integrated Persistent Storage' and 'App Config Storage', with dropdowns and toggles for permissions

In the Storage and Persistance section change the Type of Storage to Host Path and then select the path from the Host Path dropdown.

All further options can be left as their defaults. Click Install. This may take some time so be patient. Once installed you will be taken back to the Applications dashboard where the app will be deploying. Eventually this will change to Running.

A dark-themed applications management interface displaying a single entry: 'cloudflarededdns' by Truecharts, with a status indicating it is currently being deployed and an 'Up to date' label under Updates.
Software dashboard showing the application 'cloudflarededdns' from Truecharts as 'Running' with a green status indicator and marked as 'Up to date' in a sleek, dark-themed interface.

If you now go back to your Cloudflare account and examine the DNS A record it should now point to your IP address.

A web interface showing DNS management settings for the domain ryeroxley.co.uk, including records for A, CNAME, MX, SRV, and TXT, with options to edit each and indicators for proxy status.