This is a work-in-progress.
This note goes over how I like to run Discourse sites.
Summary
I enjoy a specific set of network resources for my Discourse sites:
- VPS for Discourse, currently using Linode
- Object Storage, currently using Linode
- Uploads, where uploaded files are stored
- Assets, for CSS and JS
- CDN for object storage, currently using KeyCDN
- Mail delivery, currently using Mailgun
- Mailbox for email-in, currently using Gandi
- DNS updates for everything, using Gandi
Dependencies
This process relies on a variety of API calls, some provided by additional software provided by a service vendor.
- Install and Configure the Linode CLI | Linode Docs,
python
,pip3
,linode-cli
,boto
Decisions
Here are the only decisions to make. By answering these prompts, we are able to construct the commands required to provision our services.
The project label will be used in various technical contexts, as slugs to identify services. Here are requirements:
- Can only contain lower-case characters, numbers, periods, and dashes.
- Must start with a lowercase letter or number.
- Cannot contain underscores (_), end with a dash (-) or period (.), have consecutive periods (.), or use dashes (-) adjacent to periods (.).
This is the path to an SSH key file that will be authorized to access the VPS. This will be the primary way to access some services.
The default is adequate to create a new Discourse instance. For larger, pre-existing communities a larger type with more resources may be selected.
To see the resources and which ID you should use, view the output of linode-cli linodes types
.
Provision
Update tools
Ensure the tools are up-to-date.
pip3 install --upgrade linode-cli
Linode services
The following snippet will generate a root password and then create the following computing resources:
- a virtual private server where the Discourse app will run, called
=project_label=-discourse-vps
- two object storage buckets for…
- …uploads to the site, called
=project_label=-discourse-uploads
- …backups from the site, called
=project_label=-discourse-backups
- …uploads to the site, called
- an access key to the object storage buckets, called
=project_label=-object-storage-key
The output will include the access and secret key for accessing the object storage buckets, which will be used when Discourse is installed.
This is the only time it will be shown, so make sure to note it it before moving forward.
vps_root_password=$(openssl rand -base64 40);
linode-cli linodes create \
--label "=project_label=-discourse-vps" \
--type =linode_type= \
--root_pass "$vps_root_password" \
--authorized_keys "$(cat =ssh_key_file=)" \
--region us-west \
--image linode/ubuntu20.04 \
--tags "=project_label=" --tags "discourse";
linode-cli obj mb =project_label=-discourse-backups;
linode-cli obj mb =project_label=-discourse-uploads;
linode-cli object-storage keys-create \
--label "=project_label=-object-storage-key" \
--bucket_access.cluster "us-east-1" \
--bucket_access.bucket_name "=project_label=-discourse-backups" \
--bucket_access.permissions "read_write" \
--bucket_access.cluster "us-east-1" \
--bucket_access.bucket_name "=project_label=-discourse-uploads" \
--bucket_access.permissions "read_write";
unset vps_root_password