Skip to content

Commit

Permalink
Please Markdown Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
FSG-Cat committed Dec 18, 2024
1 parent 7e5a3c0 commit 1e43478
Show file tree
Hide file tree
Showing 14 changed files with 73 additions and 40 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ This website is built using [Docusaurus](https://docusaurus.io/), a modern stati

### Installation

```
$ yarn
```bash
yarn
```

### Local Development

```
$ yarn start
```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
Expand All @@ -28,14 +28,14 @@ This command generates static content into the `build` directory and can be serv

Using SSH:

```
$ USE_SSH=true yarn deploy
```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
4 changes: 2 additions & 2 deletions docs/appservice/appservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please note that Draupnir in appservice mode does not support E2EE nor support u

The provisioned Draupnirs only inherit a subset of the configuration options that are accessible to Bot mode Draupnir. Those are the following options. If there's `:` as a suffix to a config option that means there are sub options like how under commands in the default config you also find `additionalPrefixes:` with a value of `draupnir`.

```
```txt
logLevel
syncOnStartup
fasterMembershipChecks
Expand All @@ -49,7 +49,7 @@ protections:

8. Copy the `draupnir-registration.yaml` to your matrix homeserver and refer to it in `homeserver.yaml` like so:

```
```yaml
app_service_config_files:
- "/data/draupnir-registration.yaml"
```
Expand Down
1 change: 0 additions & 1 deletion docs/bot/encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ device. Please see protecting encrypted rooms [here](../moderator/managing-prote

:::


:::danger

We can not at this time recommend setting up Draupnir with an E2EE
Expand Down
41 changes: 40 additions & 1 deletion docs/bot/setup_debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,69 +12,98 @@ This installation method is intended for experienced sysadmins.
:::

## Installation

install git curl and sudo

```shell
apt update && apt install -y git curl sudo
```
install node 20 from the node source repo, the full instructions can be found at https://github.com/nodesource/distributions

install node 20 from the node source repo, the full instructions can be found at [https://github.com/nodesource/distributions](https://github.com/nodesource/distributions)

```shell
curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh
bash nodesource_setup.sh
apt update && apt install nodejs -y
```

install yarn via npm

```shell
npm install --global yarn
```

create the directory to clone the repo

```shell
mkdir /opt/mod-bot
```

clone the repo and fetch the tags

```shell
git clone https://github.com/the-draupnir-project/Draupnir.git /opt/mod-bot/Draupnir
```

```shell
git -C /opt/mod-bot/Draupnir fetch --tags
```

create the directory for draupnirs datastorage

```shell
mkdir /opt/mod-bot/Draupnir/datastorage
```

add corepack

```shell
yarn global add corepack
```

add a user to run the bot
this user will be used by systemd to run the bot since there is no need to run it with root permissions

```shell
useradd -m draupnir
```

give ownership of the draupnir directory to the bot user

```shell
chown -R draupnir:draupnir /opt/mod-bot/Draupnir
```

build the bot with yarn

```shell
sudo -u draupnir bash -c "cd /opt/mod-bot/Draupnir && yarn install"
sudo -u draupnir bash -c "cd /opt/mod-bot/Draupnir && yarn build"
```

## Edit the config

copy the default config to production.yaml

```shell
cp /opt/mod-bot/Draupnir/config/default.yaml /opt/mod-bot/Draupnir/config/production.yaml
```

change the path of the datadirectory from the default to the directory we created earlier since the default dir is for the docker setup

```shell
sed -i 's|dataPath: "/data/storage"|dataPath: "/opt/mod-bot/Draupnir/datastorage"|' /opt/mod-bot/Draupnir/config/production.yaml
```

edit the production config:
the most important things to configure are the `homeserverUrl:`, the `rawHomeserverUrl:`, the `accessToken:` and the `managementRoom:`

```shell
nano /opt/mod-bot/Draupnir/config/production.yaml
```

## Example systemd service

copy this to `/etc/systemd/system/draupnir.service` and enable with `systemctl enable draupnir`, then simply start with `systemctl start draupnir`

:::tip
Expand Down Expand Up @@ -123,27 +152,37 @@ SystemCallFilter=@system-service
[Install]
WantedBy=multi-user.target
```

## Updating the bot

if you want to update && upgrade everything, use the draupnir useraccount in order to not create conflicts with filepermissions/ownerships

stop the bot

```shell
systemctl stop draupnir
```

pull updates from github with

```shell
sudo -u draupnir bash -c "cd /opt/mod-bot/Draupnir && git pull && git fetch --tags"
```

install/update yarn

```shell
sudo -u draupnir bash -c "cd /opt/mod-bot/Draupnir && yarn install"
```

build the bot

```shell
sudo -u draupnir bash -c "cd /opt/mod-bot/Draupnir && yarn build"
```

then simply start the bot again with

```shell
systemctl restart draupnir
```
1 change: 1 addition & 0 deletions docs/bot/setup_docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ If there are pre-releases, you should scroll down until you find the
latest release.

### `develop`

The `develop` tag will always refer to an image built from the `main`
branch of Draupnir's git repository. You will not experience any
severe breakages by using this tag, but you will want to be present
Expand Down
1 change: 0 additions & 1 deletion docs/bot/setup_draupnir_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ bot, see [the synapse admin API
documentation](https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#set-ratelimit)
for more information.


## Making Draupnir a Synapse Admin

:::note
Expand Down
1 change: 0 additions & 1 deletion docs/bot/setup_management_room.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Draupnir will only respond to commands originating from that room. If
you want to upgrade your room in the future, you will have to update
the configuration with it. Alternatively, you can create a room alias.


## Encrypting the management room

We do not recommend setting up an encrypted management room, and we
Expand Down
4 changes: 2 additions & 2 deletions docs/bot/synapse_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ entire homeserver.

First, install the module to your Synapse python environment:

```
pip install -e "git+https://github.com/matrix-org/mjolnir.git#egg=mjolnir&subdirectory=synapse_antispam"
```shellpip install -e "git+https://github.com/matrix-org/mjolnir.git#egg=mjolnir&subdirectory=synapse_antispam"
```

_Note_: Where your python environment is depends on your installation method. Visit
Expand Down Expand Up @@ -85,6 +84,7 @@ If you change the configuration, you will need to restart Synapse. You'll also n
to restart Synapse to install the plugin.

### Docker

Installations that use the Docker image of `synapse` that wish to use the synapse module require the `./Draupnir/synapse_antispam/mjolnir` project directory to be bind mounted into the `synapse` container's `/usr/local/lib/python3.11/site-packages/mjolnir` directory. Clone the project (`git clone https://github.com/the-draupnir-project/Draupnir`), then use the following `docker-compose` block as an example.

```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/bot/systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You will then want to copy your configuration file for Draupnir to
Then you will want to copy the following systemd unit file to
`/etc/systemd/system/draupnir.service`.

```
```ini
[Unit]
Description=Draupnir Docker Container
After=docker.service
Expand Down
2 changes: 0 additions & 2 deletions docs/concepts/power-levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,3 @@ the power level of the `state_default` field at the top level of the
[^help]:
In that case, we recommend you to join the draupnir support room for
help [#draupnir:matrix.org](https://matrix.to/#/#draupnir:matrix.org).

[^power-levels-spec]: The Matrix Specification for `m.room.power_levels` https://spec.matrix.org/latest/client-server-api/#mroompower_levels.
6 changes: 3 additions & 3 deletions docs/contributing/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Origin](https://developercertificate.org/) (DCO). This is a simple
declaration that you wrote the contribution or otherwise have the
right to contribute it to Matrix:

```
```txt
Developer Certificate of Origin
Version 1.1
Expand Down Expand Up @@ -157,7 +157,7 @@ By making a contribution to this project, I certify that:
If you agree to this for your contribution, then all that's needed is
to include the line in your commit or pull request comment:

```
```txt
Signed-off-by: Your Name <[email protected]>
```

Expand Down Expand Up @@ -227,4 +227,4 @@ The idea is to ensure that the developers and users of projects
would not be distracted from providing each other mutual
support and to give them a hope of escaping.

[^post-open-source] https://applied-langua.ge/posts/the-poverty-of-post-open-source.html.
[^post-open-source] [https://applied-langua.ge/posts/the-poverty-of-post-open-source.html](https://applied-langua.ge/posts/the-poverty-of-post-open-source.html).
26 changes: 13 additions & 13 deletions docs/contributing/development-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies.
You will also want to edit your `settings.json` to match something like
this, so that you can debug into MPS while debugging Draupnir.

```
```json
"debug.javascript.terminalOptions": {
"runtimeArgs": ["--preserve-symlinks"],
"sourceMaps": true,
Expand Down Expand Up @@ -83,38 +83,38 @@ To use mx-tester you will need to have rust installed. You can do that at [rustu

Once rust is installed you can install mx-tester like so.

```
$ cargo install mx-tester
```shell
cargo install mx-tester
```

Once you have mx-tester installed you we will want to build a synapse image with synapse_antispam from the Draupnir project root.

```
$ mx-tester build
```shell
mx-tester build
```

Then we can start a container that uses that image and the config in `mx-tester.yml`.

```
$ mx-tester up
```shell
mx-tester up
```

Once you have called `mx-tester up` you can run the integration tests.

```
$ yarn test:integration
```shell
yarn test:integration
```

After calling `mx-tester up`, if we want to play with mojlnir locally we can run the following and then point a matrix client to http://localhost:9999.
After calling `mx-tester up`, if we want to play with mojlnir locally we can run the following and then point a matrix client to `http://localhost:9999`.
You should then be able to join the management room at `#moderators:localhost:9999`.

```
```shell
yarn test:manual
```

Once we are finished developing we can stop the synapse container.

```
```shell
mx-tester down
```

Expand All @@ -138,7 +138,7 @@ If you need to debug an issue that is occurring through use in matrix,
say the unban command has stopped working, you can launch
mjolnir from the JavaScript Debug Terminal using `yarn test:manual`.
This will launch mjolnir using the config found in `config/harness.yaml`.
You can now open https://app.element.io, change the server to `localhost:8081`,
You can now open [https://app.element.io](https://app.element.io), change the server to `localhost:8081`,
and then create an account.
From here you can join the room `#moderators:localhost:9999` (you will also be
able to find it in the rooms directory) and interact with mjolnir.
Expand Down
3 changes: 1 addition & 2 deletions docs/moderator/managing-policy-lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ The easiest way to watch a room is to use the `!draupnir watch`
command. This will tell Draupnir to watch the list and apply its
policies to your rooms. We recommend subscribe to to the list curated
by the community moderation effort, which exclusively focuses on
spam. You can do so with the following command `!draupnir watch
#community-moderation-effort-bl:neko.dev`.
spam. You can do so with the following command `!draupnir watch #community-moderation-effort-bl:neko.dev`.

## Using the `status` command to view watched lists

Expand Down
1 change: 0 additions & 1 deletion docs/shared/dogfood.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

Welcome to the Dogfood Guide. This document details a semi updated list of who is Dogfooding what and this list serves to inform you of what components are under the most review due to this.


## The List

Out of our installation methods from setup.md the dogfood statuses are
Expand Down

0 comments on commit 1e43478

Please sign in to comment.