Skip to content

Instantly share code, notes, and snippets.

@jonaharagon
Last active August 1, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonaharagon/6b5aef4f076d3640815cbe8dfdb133e8 to your computer and use it in GitHub Desktop.
Save jonaharagon/6b5aef4f076d3640815cbe8dfdb133e8 to your computer and use it in GitHub Desktop.
OpenNIC's Discourse Dev Setup Instructions

Prerequisites

Docker and Git should be installed, and wget -qO- https://get.docker.com/ | sh should install both (although for some reason when I did it on Debian I still had to install Git manually).

Install

This is easy, just create a directory and clone Discourse's docker Git repo.

sudo -s
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse

Discourse states you will need to be root to complete setup, and I didn't test otherwise. I assume they're correct.

At this point a domain will already need to be pointed to the server, because the next setup steps will also setup Let's Encrypt. You'll also need SMTP credentials, because the initial setup process will send an email to your account.

Launch setup:

./discourse-setup

Then there's just some simple questions:

Hostname for your Discourse? [discourse.example.com]: discourse.opennic.org
Email address for admin account(s)? [me@example.com,you@example.com]: jonah@opennic.org,fusl@opennic.org
SMTP server address? [smtp.example.com]: mail.opennic.org
SMTP port? [587]: 
SMTP user name? [user@example.com]: whatever-email@opennic.org
SMTP password? [pa$$word]: password
Let's Encrypt account email? (ENTER to skip) [me@example.com]: jonah+le@opennic.org

Important email configuration

If the mailbox is anything other than noreply@[Discourse's Hostname] you'll need to change the default From email manually. This is why I couldn't get email working initially...

In the /var/discourse directory, run:

./launcher enter app
rails r "SiteSetting.notification_email = 'whatever-email@opennic.org'"
exit

Configuration

Color Scheme

Navigate to /admin/customize/colors/ and create a color scheme (or modify the existing one) following these settings:

"OpenNIC": {
  "primary": "000000",
  "secondary": "ffffff",
  "tertiary": "4996EC",
  "quaternary": "67AC5B",
  "header_background": "212121",
  "header_primary": "f3f3f3",
  "highlight": "FFF176",
  "danger": "b71c1c",
  "success": "00C853",
  "love": "f44336"
}

/admin/site_settings/category/backups/

Set Backup Frequency to 1. You can also setup an s3 bucket to upload backups to on that same page. Otherwise, backups are stored locally and can be downloaded from /admin/backups/.

/admin/site_settings/category/required/

Everything should be almost completely set already, but you should remove the default logo URLs from logo_url and logo_small_url, leaving them blank. This will set the logo as just a text version set to the instance title, since we don't have good logos that work.

/admin/site_settings/category/basic/

Check the following boxes: fixed category positions, fixed category positions on create, enable whispers, push notifications prompt

Set top menu to categories|latest|new|unread|top.

/admin/site_settings/category/login/

  • Enable enable local logins via email.

Nothing else needs to be changed here, but if we get a bunch of spam accounts or something, it may prove useful to enable must approve users in the future.

/admin/site_settings/category/users

  • Add opennic, core, core-team, coreteam to reserved usernames.
  • Change username change period to 0.
  • Enable show email on profile (note this still hides email from non-staff).
  • Disable prioritize username in ux.
  • Enable show inactive accounts.

/admin/site_settings/category/posting

  • Set min post length to 2.
  • Set body min entropy to 2.
  • Enable allow duplicate topic titles.
  • Set editing grace period to 120.
  • Enable staff edit locks post.
  • Add bbs, chan, cyb, dyn, fur, geek, gopher, indy, libre, neo, null, o, oss, oz, parody, pirate, to markdown linkify tlds.
  • Set newuser max replies per topic to 2.
  • Add opennic.org, opennicproject.org to whitelisted link domains.
  • Enable display name on posts.
  • Add mailto to allowed href schemes

In the event of spambots, etc. you can set approve post count or approve unless trust level to 1 here temporarily in addition to or instead of requiring user account approval as mentioned earlier, otherwise keep at 0.

/admin/site_settings/category/email

  • Set email link color to #4996EC.
  • Enable pop3 polling enabled first.
  • Set pop3 polling host to mail.opennic.org.
  • Set pop3 polling username to discuss@discourse.opennic.org.
  • Set pop3 polling password to the discuss@ mailbox password.
  • Enable reply by email enabled.
  • Set reply by email address to discuss+%{reply_key}@discourse.opennic.org.
  • Enable log mail processing failures.
  • Enable email in.
  • Set email in min trust to 0.
  • Set email prefix to OpenNIC.
  • Enable unsubscribe via email footer.
  • Set max emails per day per user to 0.
  • Enable enable forwarded emails.

/admin/site_settings/category/files

Nothing needs to be changed here, but if we want to use S3 for external media (uploaded images) as a sort of CDN, there's some settings you can set to make it work. This one also lets you use S3 compatible services (Minio, DigitalOcean Spaces), unlike, inexplicably, the backups settings.

You might want to disable automatically download gravatars depending on privacy concerns with Gravatar? I didn't really care so I left it enabled in dev.

/admin/site_settings/category/trust

At the moment nothing here needs to be changed, I'll evaluate these levels once we have a sizable community.

/admin/site_settings/category/security

Ensure force https is enabled only if Let's Encrypt is already working from the initial setup.

Depending on how we configure "core team" users, you may want to enable allow moderators to create categories, if they'll only be mods instead of admins. Categories will essentially function as new mailing lists, so if they need that capability go ahead.

If Discourse is installed in a private network (although it probably shouldn't), add the local NAT IP block to blacklist ip blocks.

/admin/site_settings/category/onebox

Everything should be fine here.

/admin/site_settings/category/spam

  • Set flags required to hide post to 0.
  • Set num spam flags to silence new user to 7 and num users to silence new user to 5.
  • Enable notify mods when user silenced.
  • Add opennic.org to white listed spam host domains.

auto silence first post regex might be useful when dealing with spam.

/admin/site_settings/category/rate_limits

Currently everything here is good, but again I'll reevaluate when we have a larger live community.

/admin/site_settings/category/legal

  • Set privacy policy url to https://www.opennic.org/privacy/
  • Disable log anonymizer details for GDPR compliance.

/admin/site_settings/category/search

Once we get more posts we may need to enable search prefer recent posts. We'll see how accurate and fast search is in the meantime before changing anything.

/admin/site_settings/category/uncategorized

global notice may be useful to notify everybody about server-related events.

/admin/site_settings/category/user_preferences

We're going to keep default email mailing list mode disabled because we don't necessarily want everybody to be on a mailing list clone, but ensure disable mailing list mode is disabled as well so people can enable it themselves.

  • Enable default include tl0 in digests.

/admin/site_settings/category/tags

  • Enable tagging enabled.
  • Set min trust to create tag to 2.

Creating Categories

Categories are basically like independent mailing lists for the purposes of this install. On the homepage next to the New Topic button there's a hamburger menu, which gives you the option to create a new category.

The categories I created are as follows:

"General"

This category is the general discussion platform for new OpenNIC policies and other organizational matters, and should not be used for support. You can post to this category here or by emailing general@discourse-dev.opennic.org (a user account here is still required).

This category is for discussing OpenNIC as an organization, new policies, etc. and is essentially a drop-in replacement for the old mailing list discuss@ system, sans support. All support requests should now instead be made in the “Support” category.

Please be considerate of other OpenNIC members, and keep our community guidelines in mind when posting.

General Settings

  • Name: General
  • Background color: 3AB54A

Security

  • everyone can Create/Reply/See

Settings

  • Position: 1
  • Auto-close topic hours: 336 (two weeks seems reasonable)
  • Don't close until the last post in the topic is at least this old. enabled.
  • Default Top Period: Monthly
  • Custom incoming email address: general@discourse-dev.opennic.org (this must be set as an alias to discuss@discourse.opennic.org (or the POP3 polling mailbox) in Mailcow!)

"Support"

This category is the general support platform for OpenNIC members . You can post support queries to this category here or by emailing  `support@discourse-dev.opennic.org` (no user account required).

This category is for finding help for new and existing members within the OpenNIC community. All requests are accepted no matter what, so feel free to post any questions you may have! Please be considerate of all OpenNIC members when posting here, even very new ones, and keep our community guidelines in mind when posting.

General Settings

  • Name: Support
  • Background color: 0E76BD

Security

  • everyone can Create/Reply/See

Settings

  • Position: 2
  • Auto-close topic hours: 168 (two weeks seems reasonable)
  • Don't close until the last post in the topic is at least this old. enabled.
  • Custom incoming email address: support@discourse-dev.opennic.org (this must be set as an alias to discuss@discourse.opennic.org (or the POP3 polling mailbox) in Mailcow!)
  • Accept emails from anonymous users with no accounts (seems good if we just want to give out a support email to new users without having them join all this setup, but we may have to disable it if it's abused)

"Announcements"

This category only contains official announcements from OpenNIC core team members and Discourse administrators.

General Settings

  • Name: Announcements
  • Background color: BF1E2E

Security

  • staff can Create/Reply/See
  • everyone can Reply/See

Settings

  • Position: 0
  • Default Top Period: Monthly
  • Navigate to first post after topics are read enabled.

Category Positions

Ensure the following positions are set:

0: Announcements 1: General 2: Support 3: Site Feedback 4: Uncategorized 5: Staff 6: Lounge

User Settings

Mailing List Mode

Users wishing for a traditional mailing list mode should set the following settings in their user preferences (at /u/[USERNAME]/preferences/emails).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment