Skip to content

Commit

Permalink
Docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
raidensakura committed Jun 6, 2023
1 parent ca60f0f commit f2d6915
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 94 deletions.
6 changes: 3 additions & 3 deletions docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
"title": "About",
"type": "page"
},
"getting-started": "Getting Started",
"getting-started": "Getting started",
"installation": "Installing Modmail",
"logviewer-installation": "Installing Logviewer",
"configuration": "Configuring Modmail",
"updating": "Updating Modmail",
"updating-logviewer": "Updating Logviewer",
"setting-up-auto-restart": "Set Up Auto-restart",
"setting-up-auto-restart": "Set up auto-restart",
"contact": {
"title": "Contact",
"title": "Discord",
"type": "page",
"href": "https://dsc.gg/transience",
"newWindow": true
Expand Down
Binary file modified docs/pages/assets/docker-illust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-logs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/nssm-success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/updating.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/which-python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/pages/assets/windows-env.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 5 additions & 11 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
---
title: Introduction to Modmail
---
import Image from 'next/image'

# Introduction
Expand Down Expand Up @@ -25,7 +28,7 @@ Our Logviewer will save the threads so your staff can view previous threads thro
* Minimum duration for accounts to be created before allowed to contact Modmail (`account_age`).
* Minimum length for members to be in the guild before allowed to contact Modmail (`guild_age`).

**Advanced logging functionality**
#### **Advanced logging functionality**

* When you close a thread, Modmail will generate a log link and post it to your log channel.
* Native Discord dark-mode feel.
Expand All @@ -44,21 +47,12 @@ Our Logviewer will save the threads so your staff can view previous threads thro

This list is ever-growing thanks to active development by our exceptional contributors. See a full list of available commands by using the `?help` command.

## Installation

Visit our [installation page](/installation) for detailed instructions on setting up Modmail for your server.

## Supporting the project

You have various options to help the project. Giving this repository a star is greatly appreciated. You can also help people that have trouble setting up Modmail at our [Discord server](https://discord.gg/cnUpwrnpYb). 

If you like to show your appreciation, consider supporting us on [**Patreon**](https://www.patreon.com/kyber)!

### Contributing
## Contributing

Support Modmail with your contributions! Whether it be improvements to the documentation or new functionality, please feel free to make the change. Check out our [contributing guidelines](https://github.com/modmail-dev/modmail/blob/master/.github/CONTRIBUTING.md) before you get started.

## Next steps

* Read about [installing Modmail](installation/).
* Become familiar with [Modmail commands and functionalities](getting-started.md).
30 changes: 0 additions & 30 deletions docs/pages/installation/local-hosting.mdx

This file was deleted.

21 changes: 4 additions & 17 deletions docs/pages/installation/local-hosting/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Docker is considered an advanced setup, it is recommended that you understand ho
</Callout>

![](../../assets/docker-illust.png)
<sub>A simple illustration explaining how Docker works</sub>

## Prerequisites

Expand All @@ -26,28 +27,14 @@ Docker is considered an advanced setup, it is recommended that you understand ho

Docker has their own installation page for popular Linux-based distros, read them by visiting the link below:

<Cards>
<br />
<Card
icon={
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
className="h-6 w-6"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"
/>
</svg>
}
<img src="https://www.docker.com/wp-content/uploads/2023/04/cropped-Docker-favicon-32x32.png" alt="drawing" width="25"/>
}
title="Install Docker"
href="https://docs.docker.com/engine/install/"
/>
</Cards>

If you're on a desktop environment, refer to the "Desktop" section of their documentation as Docker Desktop also comes with nice GUI that you manage your deployments with.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
description: Deploy Modmail on a Fedora server.
---

import { Callout } from 'nextra-theme-docs'

# Fedora

<Callout emoji="⚠️" type="warning">
Expand All @@ -13,7 +15,7 @@ For safety reasons, **DO NOT** install Modmail with a root user. A misbehaving o
1. Root access (**`sudo`**).
2. Minimum 1GB of RAM
3. At least 2GB available disk space.
4. Supported releases:&#x20;
4. Supported releases:
* Fedora 38
* Fedora 37
* Fedora 36
Expand Down Expand Up @@ -52,17 +54,18 @@ cd modmail

And then, install `pipenv` and the bot dependencies with:

<pre class="language-bash"><code class="lang-bash">python3.10 -m pip install pipenv
<strong>python3.10 -m pipenv install --python 3.10
</strong></code></pre>
```bash
python3.10 -m pip install pipenv
python3.10 -m pipenv install --python 3.10
```

Create a file named `.env` with `nano` and paste all the environmental variables (secrets) needed to run the bot via right-clicking in the nano editor. Refer to the steps in the [parent Installation page](../#preparing-your-environmental-variables) to find where to obtain these.

```bash
nano .env
```

<figure><img src="../../.gitbook/assets/image (6).png" alt=""><figcaption></figcaption></figure>
![](../../assets/vps-env.png)

After that, press `Ctrl+O` and `Enter` to save your changes. Exit the `nano` editor with `Ctrl+X`.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Deploy Modmail on a MacOS machine.
title: MacOS
---

# MacOS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
---
description: Deploy Modmail on an Ubuntu server.
title: Ubuntu
---

import { Callout } from 'nextra-theme-docs'

# Ubuntu

<Callout emoji="⚠️" type="warning">
Expand All @@ -13,7 +16,7 @@ For safety reasons, **DO NOT** install Modmail with a root user. A misbehaving o
1. Root access (**`sudo`**).
2. Minimum 1GB of RAM
3. At least 2GB available disk space.
4. Supported releases:&#x20;
4. Supported releases:
* Ubuntu 18.04 LTS (Bionic Beaver)
* Ubuntu 20.04 LTS (Focal Fossa)
* Ubuntu 22.04 LTS (Jammy Jellyfish)
Expand Down Expand Up @@ -58,9 +61,8 @@ python3.10 -m pip install pipenv

<summary>Failed to install Python 3.10?</summary>

You can manually compile Python instead of adding using the Deadsnakes PPA. Compiling Python may take a while (est. 5-10 minutes). Copy and run line 2-7 all at once.
You can manually compile Python instead of adding using the Deadsnakes PPA. Compiling Python may take a while (est. 5-10 minutes)

{% code lineNumbers="true" %}
```bash
sudo apt update && sudo apt upgrade -y # Update and upgrade all packages
sudo apt install -y software-properties-common \
Expand All @@ -75,7 +77,6 @@ cd Python-3.10.9
./configure --enable-optimizations
make altinstall
```
{% endcode %}

</details>

Expand All @@ -90,16 +91,17 @@ cd modmail

Inside the Modmail folder, Install `pipenv` and its Python packages with:

<pre class="language-bash"><code class="lang-bash"><strong>python3.10 -m pipenv install --python 3.10
</strong></code></pre>
```bash
python3.10 -m pipenv install --python 3.10
```

Create a file named `.env` with `nano` and paste all the environmental variables (secrets) needed to run the bot via right-clicking in the nano editor. Refer to the steps in the [parent Installation page](../#preparing-your-environmental-variables) to find where to obtain these.

```bash
nano .env
```

<figure><img src="../../.gitbook/assets/image (6).png" alt=""><figcaption></figcaption></figure>
![](../../assets/vps-env.png)

After that, press `Ctrl+O` and `Enter` to save your changes. Exit the `nano` editor with `Ctrl+X`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
description: Deploy Modmail on a Windows machine.
---

import { Callout } from 'nextra-theme-docs'

# Windows

## Prerequisites
Expand Down Expand Up @@ -70,13 +72,11 @@ py -3.10 -m pipenv install

Create a new file in the modmail folder named `.env` and paste in your environmental variables needed to run Modmail. Refer to the steps in the [parent Installation page](../#preparing-your-environmental-variables) to find where to obtain these.

<figure><img src="../../.gitbook/assets/image (3).png" alt=""><figcaption></figcaption></figure>

![](../../assets/windows-env.png)
Lastly, in your PowerShell window simply enter the command below to run your Modmail bot:

```powershell
py -3.10 -m pipenv run bot
```

If no error shows up, it means that your Modmail is now running correctly.

Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
title: Setting up auto-restart
---
import { Callout } from 'nextra-theme-docs'

# Setting up auto-restart

## Using PM2 on Linux
Expand Down Expand Up @@ -72,7 +77,6 @@ sudo nano /etc/systemd/system/modmail.service

and paste in the contents below, replacing `username`, `modmail_path` and `pipenv_path` with yours respectively. `Ctrl+O` and `Enter` to save. `Ctrl+X` to exit the nano editor.

{% code title="modmail.service" %}
```bash
[Unit]
Description=Modmail bot
Expand All @@ -90,7 +94,6 @@ ExecStart=pipenv_path run python bot.py # replace pipenv_path only
[Install]
WantedBy=multi-user.target
```
{% endcode %}

Now, start your Modmail bot with:

Expand Down Expand Up @@ -127,7 +130,7 @@ To have the bot auto-restart on crash or system reboot, we will be using `nssm`

First, find the Python path of your Modmail pipenv by running `pipenv shell` and `which python` in your Modmail folder. Copy the path that appears in your terminal and paste it in the first line of our next step.

<figure><img src=".gitbook/assets/image (9).png" alt=""><figcaption></figcaption></figure>
![](./assets/which-python.png)

Second, create a file named `modmail.bat` in your modmail directory with the following contents, replacing `python_path` with the one you copied previously and `python.exe` with `activate.bat`:

Expand All @@ -138,30 +141,30 @@ call python bot.py

The finished file should look something like this:

{% code title="modmail.bat" %}

```batch
call C:\Users\Raiden\.virtualenvs\modmail-oXWHQUly\Scripts\activate.bat
call python bot.py
```
{% endcode %}


Third, download `nssm` by [clicking here](http://nssm.cc/download) and downloading the file under "Latest Release".

The download will be a `.zip` file so you'll need to extract it first using your file archiver program (such as WinRAR or 7-zip). After that, find `nssm.exe` in the folder corresponding to your OS bit version (these days it should be win64) and copy it's file path:

<figure><img src=".gitbook/assets/image (1).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-download.png)

As `nssm` itself is only a command-line program, we'll need to use our trusty Terminal to use the application to create our service. So, search up "Powershell" in your start menu, right-click it and click "Run as Administrator".&#x20;
As `nssm` itself is only a command-line program, we'll need to use our trusty Terminal to use the application to create our service. So, search up "Powershell" in your start menu, right-click it and click "Run as Administrator".

Change directory (CD) into the folder path that you copied earlier, the command should look like something like this:

```powershell
cd "C:\Users\Raiden\Downloads\nssm-2.24\win64"
```

{% hint style="info" %}
<Callout emoji="ℹ️" type="info">
Wrapping "your folder\directory" on Windows in double quotes is necessary to make sure spaces in our file path is parsed correctly.
{% endhint %}
</Callout>

And then, proceed to create a new service for Modmail using `nssm` with:

Expand All @@ -171,27 +174,27 @@ And then, proceed to create a new service for Modmail using `nssm` with:

A GUI will pop up where you can fill in the details needed for your Modmail service. Replace the `Path` with the path of your `modmail.bat` script and the `Startup directory` with the path of your Modmail folder as follow:

<figure><img src=".gitbook/assets/image.png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-app.png)

You can fill in these extra details as you see fit as it's only for your own reference:

<figure><img src=".gitbook/assets/image (11).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-details.png)

You can also optionally specify a log file as output and error in the `I/O` tab, just be sure to create the file beforehand so you can select it in the GUI.

<figure><img src=".gitbook/assets/image (5).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-io.png)

And finally, click "Install Service" to install your Modmail bot as a service on your Windows system.

<figure><img src=".gitbook/assets/image (2).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-success.png)

By now you should have the service installed but not yet running. You can start it by using this command below in the open `nssm` Terminal from earlier:

```
.\nssm start modmail
```

<figure><img src=".gitbook/assets/image (10).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-start.png)

You should be able to see your bot running if everything goes well. You can also verify the status of your Modmail service with:

Expand All @@ -201,6 +204,6 @@ You should be able to see your bot running if everything goes well. You can also

And if you specified the log output file in your previous step, you should be able to see your current Modmail logs like so:

<figure><img src=".gitbook/assets/image (8).png" alt=""><figcaption></figcaption></figure>
![](./assets/nssm-logs.png)

And that's it! Your bot will now auto-start everytime you reboot your system. You can also additionally stop and restart your service with `.\nssm stop modmail` and `.\nssm restart modmail` respectively. Refer to [NSSM Documentation](http://nssm.cc/usage) for further customization as this guide is only meant to cover the basic needs adequate for standard Modmail usage.
7 changes: 4 additions & 3 deletions docs/pages/updating.md → docs/pages/updating.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Guide on how to update the Modmail bot.
description: Keeping your Modmail up to date
title: Updating Modmail
---

# Updating
Expand All @@ -18,7 +19,7 @@ If the output shows this exact URL as shown below,

```
[remote "origin"]
url = https://github.com/modmail-dev/modmail.git
url = https://github.com/modmail-dev/modmail.git
```

you can go ahead and run the command below to pull in the latest changes:
Expand All @@ -29,7 +30,7 @@ git pull

Else, it means that your repository is a fork and must update (aka sync) it independently. If your repository is hosted on GitHub, click on the button on your repo's GitHub URL as highlighted below:

<figure><img src=".gitbook/assets/Screenshot 2023-04-13 224748.png" alt=""><figcaption></figcaption></figure>
![](./assets/updating.png)

Run the `git pull` command above locally after syncing your fork.

Expand Down

0 comments on commit f2d6915

Please sign in to comment.