Tu un-delete a topic, open it, click the wrench icon and select
`Un-delete topic`.
### Permanently destroy a topic
If a topic needs to be purged from Discourse, this can be accomplished using the
Rails console as follows, using the numeric topic identifier:
Topic.find(topic_id).destroy
These instructions are copied from [this post](https://meta.discourse.org/t/how-can-i-delete-or-undelete-topics/41700/9)
on the Discourse Meta forum.
In case of a major problem with the forum, we should contact the Discourse
people at team@discourse.org. They have access to offsite backups.
### Enter the Discourse container
Manual backups can be triggered and retrieved via the web interface,
see [Backups](#backups). Such backups could then be used to recreate the
forum on another installation of Discourse, in case of a catastrophe.
It's possible to enter the Discourse container to look around, make
modifications, and restart the Discourse daemon itself.
cd /srv/discourse
./launcher enter app
Any changes made in the container will be lost on upgrades, or when the
container is rebuilt using `./launcher rebuild app`.
Within the container its possible to restart the Discourse daemon using:
sv restart unicorn
## Disaster recovery
# Reference
## Installation
The forum software was installed for us by the Discourse team, in their cloud
infrastructure, so the only thing that needed to be set up from our side was a
DNS entry.
Our installation is modeled after upstream's [recommended procedure] for
deploying a single-server Docker-based instance of Discourse.
The address chosen for this service is https://forum.torproject.net/.
First, a [new machine] is required, with the following parameters:
It was decided to use the `.net` suffix instead of `.org` per [TPA-RFC-6](https://gitlab.torproject.org/tpo/tpa/team/-/wikis/policy/tpa-rfc-6-naming-convention).
- an 80GB SSD-backed volume for container images and user uploads
- a 20GB NVMe-backed volume for the database
### Domain rediection
Directories and mounts should be configured in the following manner:
For convenience, a HTTP redirection is set up in our infrastructure pointing
An onion service is configured on the machine using Puppet, listening on ports
80 and 443.
## Backups
Internally, Discourse has a `force_https` setting which determines whether
links are generated using the `http` or `https` scheme, and affects CSP URLs.
When this is enabled, the forum does not work using the onion service because
CSP URLs in the headers sent by Discourse are generated with the `https`
scheme. When the parameter is disabled, the main issue is that the links in
notifications all use the `http` scheme.
This service is hosted by Discourse.org which handle creating and storing
backups for the forum:
So the most straightforward fix is simply to serve the forum via `https` on the
onion service, that way we can leave the `force_https` setting enabled, and the
CSP headers don't prevent forum pages from loading.
> Off-site backups are created every 12 hours when hosted by Discourse. To access an off-site backup, or to restore an uploaded backup, please [contact us](mailto:team@discourse.org).
## Directory structure
It's possible to trigger the creation of a downloadable backup via this [page](https://forum.torproject.net/admin/backups)
on the admin interface. Once the backup is completed, a download link is sent by
email to the admin who requested the backup.
The purpose of the various directories under `/srv/discourse` is described in
the [discourse_docker README](https://github.com/discourse/discourse_docker#directory-structure).
## Deleting topics and posts
The most important directories are:
The design of Discourse is such that when a post is deleted via the web
interface, it's merely flagged as such in the database. There is no purging of
these records either, they remain for the life of the instance.