Skip to content

Setting up DNS using Cloudflare

Video: video (skip to ~4 minutes)

In terminal

Note: This uses flyctl

Due to cloudflare proxy, we need to allow cloudflare domain to access the fly machine. We do this by issuing certificates:

  1. In the terminal, run fly certs add <project-name>.wdcc.co.nz -a <app-name> (e.g. fly certs create ayo.wdcc.co.nz -a ayo-prod)
  2. Run fly certs setup <project-name>.wdcc.co.nz -a <app-name>. This will bring up a bunch of options.

We will use the A record with the Ownership TXT Record

On Cloudflare

  1. Log in to cloudflare with the tech account
  2. Choose Main account - it should Account Home page
  3. Click on the wdcc.co.nz domain and then go to DNS -> Records and then add the records:

Creating a new A record

  1. Select A for type
  2. For the name: use the abbreviation for your project (e.g. ayo - this will make the domain ayo.wdcc.co.nz)
  3. For the IPv4 address: use the one provided in the terminal after running fly certs setup
  4. Keep proxying on then save

Creating a new TXT record

  1. Select TXT for type
  2. For the name: use the one provided in the terminal starting with _fly-ownership
  3. For the content: use the one provided in the terminal following the arrow (usually start with app-)

You can check the status of the certificate using fly certs check <project-name>.wdcc.co.nz -a <app-name>