Setting up Discourse on DigitalOcean using Mailgun as the server.
These instructions are specifically for setting up Discourse on DigitalOcean using Mailgun for the mail server and Namecheap for the DNS.
DigitalOcean
Go to DigitalOcean and create a Discourse droplet.
https://marketplace.digitalocean.com/apps/discourse
When it asks you for an SSH key, choose one that you already created or create a new one. You’ll need it later to SSH into your new server.
Namecheap
Go the the Advanced DNS section for your domain name in Namecheap.
Add an A record that points a sub domain to the IP address of the droplet you just created.
- Host: group
- IP: 222.222.2.22
MailGun
In MailGun, add a new domain to your account.
https://app.mailgun.com/app/sending/domains/new
Enter group.yourwebsite.com
You don’t have to use “group” as the subdomain. You could also use “forum” or “discussion”, but it does have to match whatever you entered for the subdomain (the A record).
The next page will give you a lot of records that you’ll have to enter in Namecheap. There’s two TXT records, one CNAME record, and two MX records. Pay attention to the example values below because you’ll enter them differently than how they’re shown in MailGun. For example, MailGun will say to enter “group.yourwebsite.com” for the host, but you actually just have to enter “group”.
Go back to Namecheap and enter these records for your domain. You’ll be switching back and forth between MailGun and Namecheap for this section.
TXT Record
- Host: mailo._domainkey.group
- Value: k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0YslSf8NDkbKWZYI2f1KybL5nFb81fOxC37SZGQrynipKIk3mOBmy0O1xfqLBAtnlzdv/0m8ZC4yPZTyxh608XknEBLH8lUF/dR67H0IQVIDq2tKzbU26pPs2xoGlnq9fEXTzJyf105xK6ALgrXyWj6RpClEDpH7WlsRdjlaX9wIDAQAB
TXT Record
- Host: group
- Value: v=spf1 include:mailgun.org ~all
CNAME Record
- Host: email.group
- Value: mailgun.org.
MX Record 1
- Host: group.paircode.com
- Value: mxa.mailgun.org.
MX Record 2
- Host: group.paircode.com
- Value: mxb.mailgun.org.
After you verify that worked, MailGun will automatically take you to another page. That’s how you know it is verified.
Once that’s all set up, navigate to the SMTP Credentials page. You can follow the instructions below or replace your domain in the link below.
https://app.mailgun.com/app/sending/domains/group.yourwebsite.com/credentials
Here’s the long route.
- Click Domains in the sidebar (https://app.mailgun.com/app/sending/domains).
- Click the domain that you just created (https://app.mailgun.com/app/sending/domains/group.yourwebsite.com).
- In the sidebar, click Domain Settings (https://app.mailgun.com/app/sending/domains/group.yourwebsite.com/settings).
- Finally, click the SMTP Credentials tab (https://app.mailgun.com/app/sending/domains/group.yourwebsite.com/credentials).
On the SMTP Credentials page, click Add New SMTP User. Enter noreply for the username. Copy the username (noreply@group.yourwebsite.com) and password. You’ll need it shortly.
You’re, now, ready to setup Discourse.
SSH into your new droplet.
ssh@111.111.1.11 -i ~/.ssh/id_rsa_whatever
The id_rsa_whatever is the file that you saved the private key to. If it’s called id_rsa, then SSH will automatically use it.
IMPORTANT
During the instructions, you’ll be asked for a few email addresses. If it asks you for an administrator email, enter an email that gets emails, not the noreply@group.yourwebsite.com email.
When it asks you for SMTP credentials, use the username you created (noreply@group.yourwebsite.com), the password for that SMTP user, and smtp.mailgun.org for the host.
You’ll need to verify your email address, and then Discourse will take you through some more steps.
Optional
If you have a WordPress website, you can use it as an SSO.