Preventing DDoS on a Discourse instance?

Configure UFW and if necessary put it behind Cloudflare with a page rule to “disable performance” so that it doesn’t screw around with the code.