Self-hosting Discourse for a Canadian community: keeping data and backups in Canada

AI-generated summary

4GoodHosting shared a checklist for self-hosting Discourse for Canadian clients requiring strict data residency. Key recommendations include hosting servers and backups in Canadian data centers, using Canadian-hosted S3-compatible storage, and ensuring upload buckets and SMTP providers are also local. The author also emphasized auditing third-party plugins and monitoring tools to prevent data leakage, asking the community about effective ways to manage CDN caching without data leaving the country.

Jagster responded that maintaining data strictly within Canada or the EU fundamentally contradicts the global nature of CDNs, which rely on geographically distributed nodes for performance. Jagster noted that staying within a specific legal jurisdiction is simpler when using non-US/China/Russia-based providers.

supermathie clarified that while CDCK stores content in locale-specific hosting, their CDN endpoints worldwide cache it upon request. supermathie argued that preventing any data from leaving the country is practically infeasible without completely blocking foreign user access, as any request from outside the borders means data has left. They suggested that if the concern is sensitive PII, it does not traverse the CDN, and for UGC, secure uploads can be enabled. Additionally, some CDN providers offer options to restrict caching to specific regions.

Jagster countered supermathie, highlighting a legal and regulatory distinction between data residing in a foreign government-regulated data center (e.g., US servers) versus data stored on a user’s personal device. This distinction suggests that while technical data transfer is unavoidable, the regulatory exposure differs significantly between transient caching on foreign infrastructure and long-term storage.

We help a few Canadian organisations run their own community forums, and a recurring request is that member data never leaves the country. Discourse makes most of this straightforward, but there are a few places where data can quietly end up elsewhere. Here is the checklist we use when planning a self-hosted install for a client with Canadian data residency requirements:

  1. Server location: pick a VPS or dedicated server physically in a Canadian data centre (Vancouver, Toronto or Montreal) and confirm it in writing with the provider.
  2. Backups: point automatic backups at S3-compatible storage hosted in Canada rather than the default region of a large cloud provider.
  3. Uploads: if you move uploads to object storage, make sure the bucket and any CDN origin are also in Canada.
  4. Outgoing mail: choose an SMTP provider that processes mail in Canada, or at least document where it is handled.
  5. Third-party plugins and integrations: review analytics, translation and AI plugins, since they often send content to servers outside the country.
  6. Logs and monitoring: keep log shipping and uptime monitoring in-region too.

For those of you running Discourse for Canadian (or EU) communities, what else do you check? Has anyone found a clean way to handle CDN caching without data leaving the country?

Handling CDN globally such way that data never leaves EU or Canada breaks the idea of CDN aka. using geographically closest datacenter.

Staying inside Canada, or for me EU, is quite easy task when using enterprises that aren’t USA, China, Russia etc. connected. Meaning ie. I don’t trust Amazon/AWS at all.

[what CDCK does]

For our locale-specific hosting (CA/US/EU) we store content in that locale, but CDN endpoints worldwide can cache it upon request [excepting specific negotiated terms to the contrary].

[not an official statement from CDCK, but personal opinion]

This sort of request feels very pie-in-the-sky to me - as much as I’m for data sovereignty, preventing ANY data from leaving the country without a complete geolock on access just isn’t feasible. If someone outside the country accesses your site… the data has left the country. Do you also block all user access from outside the country? That’s the only way to have it.

If not, why is caching outside the country a problem? What’s the actual goal?

Depending on CDN provider, opting not to cache on CDN endpoints outside the country is possible, so if you really want to do it, go ahead.

If it’s sensitive PII you’re concerned about, that data doesn’t traverse the CDN. If it’s UGC (uploads, etc.), secure uploads can be enabled.

You know very well that there is big difference if we are talking about keeping all data in a datacenter that is regulated ie. US government or in user’s device.