How Exactly should I add cloudflare CDN to discourse?

@Nam_Nguyen thanks for these steps. What exactly do you add to cloudlare? Just the root domain or all the other paths as well, like MX and TXT? Now, when I add my domain to cloudflare, it shows these as passing via CDN:

type A => forum points to digitalOceanIP
type A => domain.com points to digitalOceanIP
type A => www.forum points to digitalOceanIP
type A => www points to digitalOceanIP

(I added redirects for root and www paths to my forum subdomain)

MX and TXT aren’t passing via Cloudflare.

is this similar to yours?

What I did after this step is I copied the CloudFlare name servers that were generated for my domain and added them on my registrar.

And after couple of minutes my site was down.

I didnt follow the steps exactly. Rather I added cloudflare the last. Regular discourse installation + LetsEncrypt SSL + Cloudflare CDN (here I stuck, so I had to go back one step)