hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 44 forks source link

Implement Custom Domains via Cloudflare #4882

Open rbennettcw opened 1 year ago

rbennettcw commented 1 year ago

Overview

Motivation

Currently all our assets are cached on our CDN (cloudflare). Because we only run our custom domains on heroku, when we give this custom domain to the clients, the resources that it requests are uncached. This has two problems:

  1. This increases the strain on our servers
  2. This increases the response time because the connection has to make a round trip to our server instead of the closest edge node. This is especially noticeable for clients in different regions

Initial Setup

Migration

Routes to add (paths TBD)

Env vars to add (specific naming TBD)

Testing

Draft Sequence Diagram

Image

kurtisassad commented 1 year ago

For testing

I think we shouldn't spend time on TDD for integration tests for this one since CNAMEs could take up to a few hours to propagate. The integration tests wont be able to run in real time so should probably be skipped.

I am in the process of writing e2e tests for custom domains, so this can also be skipped (I can modify the existing tests to work with this new method).