Infrastructure - Discourse¶
Some quick notes on admin'ing Discourse from the shell level
Host - community.theforeman.org¶
Discourse runs on our Scaleway account, and is linked to our Puppet infra so the usual people have SSH key access. Backups to the puppetserver of the DB dumps, attachments, and container definitions are enabled too.
Discourse runs in Docker, so very little is running at the main host level. There are 2 containers running:
1. The main Discourse app, containing Rails, Redis, Sidekiq, and PSQL. Listens on 80 and 443 and provides it's own Let's Encrypt setup
2. A Postfix container listening on 25 which handles incoming mail and then passes it to Discourse for turning into posts
All the work is done in
/var/discourse. In that directory you'll find:
containersdirectory which contains YAML files specifying the `app` and `mail-receiver` definitions
shareddirectory containing the permanent volumes mounted into Docker (backups are in here)
launcherbash script for interacting with the containers
There's really only one useful command here - `./launcher logs` will get you the recent logs from the container. Combined with grep, you can check to see if a specific mail arrived, eg:
$ ./launcher logs mail-receiver | egrep "from=|receive-mail"
<22>Dec 26 06:19:44 postfix/qmgr: 54787280723: from=<email-redacted>, size=10324, nrcpt=1 (queue active)
<23>Dec 26 06:19:44 receive-mail: Recipient: reply+<token-redacted>@community.theforeman.org
If for some reason you need access to the Rails instance itself, you can enter the container with
./launcher enter app. That will put you at the root of the rails app, so you can immediately do things like
bundle exec rake -T
For basic app control,
restart are available, of course.
If for some reason the Discourse WebUI upgrade process fails, it will direct you to do a CLI upgrade, which is usually
./launcher rebuild app but on-screen notes are usually provided.
Untested, but should just be a case of restoring the most recent backup into a new install of Discourse, and then updting the CNAME to point to the new host. To be confirmed.