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:
- 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) - 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
- Log in to cloudflare with the tech account
- Choose Main account - it should Account Home page
- Click on the
wdcc.co.nzdomain and then go to DNS -> Records and then add the records:
Creating a new A record
- Select
Afor type - For the name: use the abbreviation for your project (e.g.
ayo- this will make the domainayo.wdcc.co.nz) - For the IPv4 address: use the one provided in the terminal after running
fly certs setup - Keep proxying on then save
Creating a new TXT record
- Select
TXTfor type - For the name: use the one provided in the terminal starting with
_fly-ownership - 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>