4th Street Bar Hive-Bar

Hive-Bar Powered by Hive beta-fdb5b5b

Community post

[Cluster Daemon - Clustd] Automatic DNS Record Updating using Cloudflare

![](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519760075/um5d3en5ufohwshmcdx3.jpg)
([Source](https://www.kom.tu-darmstadt.de/fileadmin/_migrated/pics/SW_Cluster_Logo_01.jpg))

Introduction

Clustd is an open source cluster management provider. The goal is to provide automated failover systems for apps, whether the system is down for maintenance or an unexpected event. It features completely automatic health checking with plug and play driver support. These drivers bring the functionality of the cluster alive by managing the system or even external resources on the fly.

Disclaimer: This is not intended to be used in conjunction with software that stores data on its own (e.g. database) , otherwise data will be out of sync. For synchronizing data, see your database manual or another synchronization method (e.g. rsync).

What does a cluster look like?

Each machine runs a clustd daemon. Clustd will automatically determine a new master if a machine goes offline. Driver triggers will be executed when a master machine goes offline. Drivers are intended to connect to a locally running clustd instance. Multiple drivers (even of the same type) can connect to the clustd instance to manage multiple services.

The Cloudflare Driver

![](https://res.cloudinary.com/hpiynhbhq/image/upload/v1521049386/foffqcsmbwczbxyfpiju.png)
([Source](https://cloudflare.com))

The purpose of this driver is to automatically update DNS records. In the event some publicly accessible service goes offline, this driver can handle switching the DNS records to an online failover machine. An example setup could be running a shell driver and Cloudflare driver on the same machine. If the master goes offline, the shell driver can start the web app and update the DNS records for complete failover protection.

Configuring the driver is simple and straight forward. Multiple DNS records aren't currently supported, but you can run multiple Cloudflare drivers to get around this limitation, if it's necessary to update multiple records.

host: ws://127.0.0.1:3001
secret: 'cluster secret'
cloudflare:
  email: -email-
  api_key: -api_key-
  dns_record:
    zone_id: -zone_id-
    name: mydomain.com
    value: 1.2.3.4
    ttl: 1 # 1 means auto
    proxied: true # Whether to proxy traffic through cloudflare

The Cloudfare web panel doesn't make it trivial to find the DNS record ID. So this will automatically search your DNS records to find the corresponding record and update it accordingly.

Find the driver here: https://github.com/steemdunk/clustd-driver-cloudflare

Setting up a cluster

Clustd documentation can be found at https://github.com/steemdunk/clustd, this is necessary for the initial cluster setup. Drivers are meant to be setup after the cluster is setup.

Other Relevant Dev Updates



Posted on Utopian.io - Rewarding Open Source Contributors

212 upvotes 6 downvotes $15.97

Replies (10)

Review before signing

Posting as . Signing with . Keychain permission: Posting. Hive Keychain will ask you to approve this action next.


  
Technical details

Operation fingerprint: