Skip to content

Commit 12e9e55

Browse files
committed
docs(MdBook): add MdBook for online rustmail documentation
1 parent 414d319 commit 12e9e55

8 files changed

Lines changed: 264 additions & 34 deletions

File tree

.github/workflows/docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/docs.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup mdBook
21+
uses: peaceiris/actions-mdbook@v2
22+
with:
23+
mdbook-version: 'latest'
24+
25+
- name: Build documentation
26+
run: mdbook build docs
27+
28+
- name: Setup SSH
29+
uses: webfactory/ssh-agent@v0.9.0
30+
with:
31+
ssh-private-key: ${{ secrets.SSH_KEY }}
32+
33+
- name: Add known hosts
34+
run: ssh-keyscan -H rustmail.rs >> ~/.ssh/known_hosts
35+
36+
- name: Deploy to server via rsync
37+
run: |
38+
rsync -avz --delete book/ ubuntu@rustmail.rs:/var/www/rustmail_docs/

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ node_modules
99
package-lock.json
1010
bin
1111
rustmail/static
12-
rustmail_panel/dist
12+
rustmail_panel/dist
13+
/book/

docs/SUMMARY.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Summary
2+
3+
[Introduction](index.md)
4+
5+
---
6+
7+
# Getting Started
8+
9+
- [Installation](getting-started/installation.md)
10+
- [Configuration](getting-started/configuration.md)
11+
- [First Steps](getting-started/first-steps.md)
12+
13+
---
14+
15+
# User Guides
16+
17+
- [Commands](guides/commands.md)
18+
- [Server Modes](guides/server-modes.md)
19+
- [Tickets](guides/tickets.md)
20+
- [Web Panel](guides/panel.md)
21+
22+
---
23+
24+
# Deployment
25+
26+
- [Docker](deployment/docker.md)
27+
- [Production](deployment/production.md)
28+
29+
---
30+
31+
# Reference
32+
33+
- [Configuration Options](reference/configuration.md)
34+
- [REST API](reference/api.md)
35+
- [Database Schema](reference/database.md)
36+
37+
---
38+
39+
# Development
40+
41+
- [Architecture](development/architecture.md)
42+
- [Building](development/building.md)
43+
- [Contributing](development/contributing.md)

docs/book.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[book]
2+
title = "Rustmail Documentation"
3+
description = "Documentation for Rustmail, a Discord modmail bot"
4+
authors = ["Rustmail Team"]
5+
language = "en"
6+
src = "."
7+
8+
[build]
9+
build-dir = "../book"
10+
11+
[output.html]
12+
default-theme = "navy"
13+
preferred-dark-theme = "navy"
14+
git-repository-url = "https://github.com/Rustmail/rustmail"
15+
edit-url-template = "https://github.com/Rustmail/rustmail/edit/main/docs/{path}"
16+
site-url = "/"
17+
18+
[output.html.fold]
19+
enable = true
20+
level = 1
21+
22+
[output.html.search]
23+
enable = true
24+
limit-results = 20
25+
boost-hierarchy = 2
26+
27+
[output.html.playground]
28+
editable = false

docs/deployment/docker.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,40 @@ Common issues:
304304
- Missing required configuration fields
305305
- Permission issues on mounted volumes
306306

307+
### Container Stops After "Database connected!"
308+
309+
If logs only show:
310+
```
311+
Database connection pool established
312+
Database connected!
313+
```
314+
315+
The bot cannot load `config.toml`. The most common cause is an incorrect volume mount:
316+
317+
```bash
318+
# WRONG - relative path creates a directory instead of mounting the file
319+
docker run -v config.toml:/app/config.toml ...
320+
321+
# CORRECT - use absolute path
322+
docker run -v $(pwd)/config.toml:/app/config.toml ...
323+
docker run -v /home/user/rustmail/config.toml:/app/config.toml ...
324+
```
325+
326+
Verify the mount is correct:
327+
```bash
328+
# Should show a file, not a directory
329+
docker exec rustmail ls -la /app/config.toml
330+
331+
# Should display your config content
332+
docker exec rustmail cat /app/config.toml
333+
```
334+
335+
If `/app/config.toml` is a directory, remove the container and recreate with the correct path:
336+
```bash
337+
docker rm -f rustmail
338+
docker run -d --name rustmail -v $(pwd)/config.toml:/app/config.toml:ro ...
339+
```
340+
307341
### Cannot Connect to Panel
308342

309343
- Verify port 3002 is exposed: `docker port rustmail`

docs/getting-started/configuration.md

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ The easiest way to create your configuration is the online generator:
1010

1111
**[config.rustmail.rs](https://config.rustmail.rs)**
1212

13-
The generator walks you through each setting and produces a valid `config.toml` file. You can also build the configurator locally from the [rustmail_configurator](https://github.com/Rustmail/rustmail_configurator) repository.
13+
The generator walks you through each setting and produces a valid `config.toml` file. You can also build the
14+
configurator locally from the [rustmail_configurator](https://github.com/Rustmail/rustmail_configurator) repository.
1415

1516
---
1617

@@ -22,7 +23,8 @@ If you prefer to create the configuration manually, copy `config.example.toml` a
2223
cp config.example.toml config.toml
2324
```
2425

25-
Below is an overview of each configuration section. For a complete reference of all options, see [Configuration Reference](../reference/configuration.md).
26+
Below is an overview of each configuration section. For a complete reference of all options,
27+
see [Configuration Reference](../reference/configuration.md).
2628

2729
---
2830

@@ -67,6 +69,7 @@ staff_guild_id = 987654321098765432
6769
```
6870

6971
In dual-server mode:
72+
7073
- `community_guild_id` is where your users are
7174
- `staff_guild_id` is where ticket channels are created
7275

@@ -82,7 +85,8 @@ user_message_color = "3d54ff"
8285
staff_message_color = "ff3126"
8386
```
8487

85-
The `inbox_category_id` is required. Create a category in your staff server (or your single server) and copy its ID. All ticket channels will be created under this category.
88+
The `inbox_category_id` is required. Create a category in your staff server (or your single server) and copy its ID. All
89+
ticket channels will be created under this category.
8690

8791
---
8892

@@ -105,45 +109,73 @@ client_secret = "your_oauth2_client_secret"
105109
redirect_url = "http://localhost:3002/api/auth/callback"
106110
```
107111

108-
### Understanding the Redirect URL
112+
### Understanding redirect_url vs ip
113+
114+
These two fields serve different purposes and are often confused:
115+
116+
| Field | Purpose | Required |
117+
|----------------|----------------------------------------------------|------------------------------|
118+
| `redirect_url` | Public URL for OAuth2 authentication and log links | **Yes** (if panel enabled) |
119+
| `ip` | Network interface binding address | No (defaults to auto-detect) |
120+
121+
### The redirect_url Field (Important)
109122

110-
The `redirect_url` is where Discord sends users after they authenticate. It must:
123+
The `redirect_url` is **your panel's public URL**. It is used for:
111124

112-
1. Match exactly what you configured in the Discord Developer Portal
113-
2. Point to your bot's `/api/auth/callback` endpoint
125+
1. **OAuth2 authentication** - Discord redirects users here after login
126+
2. **Log links** - Links to ticket logs sent in your logs channel
127+
128+
It must:
129+
130+
- Match **exactly** what you configured in the Discord Developer Portal
131+
- End with `/api/auth/callback`
132+
- Be accessible from the internet (or your network for local use)
114133

115134
**Local development:**
135+
116136
```toml
117137
redirect_url = "http://localhost:3002/api/auth/callback"
118138
```
119139

120-
**Production with domain:**
140+
**Production with domain (behind reverse proxy):**
141+
121142
```toml
122143
redirect_url = "https://panel.example.com/api/auth/callback"
123144
```
124145

125-
### The IP Field
146+
**LAN access (no domain):**
147+
148+
```toml
149+
redirect_url = "http://192.168.1.100:3002/api/auth/callback"
150+
```
151+
152+
### The ip Field (Optional)
126153

127154
```toml
128155
[bot]
129156
ip = "192.168.1.100" # Optional
130157
```
131158

132-
The `ip` field controls what address the panel shows for direct access. If omitted, Rustmail auto-detects your local IP address.
159+
The `ip` field controls which **network interface** the panel server binds to. This is a technical setting for advanced
160+
network configurations.
161+
162+
- If omitted, Rustmail auto-detects your local IP
163+
- If the IP is invalid or unavailable, it falls back to `0.0.0.0` (all interfaces)
133164

134165
**When to set it manually:**
135166

136-
- Running in Docker with specific network configuration
167+
- Running in Docker with host networking
137168
- When auto-detection returns an incorrect interface
138-
- When you want to display a specific LAN address
169+
- When you need to bind to a specific network interface
139170

140-
**Note:** This field is cosmetic for the panel URL display. It does not affect where the server binds (the bot always listens on `0.0.0.0:3002`).
171+
**For most users:** Leave `ip` unset and focus on configuring `redirect_url` correctly.
141172

142173
---
143174

144175
## Reverse Proxy Setup
145176

146-
For production deployments, you typically run Rustmail behind a reverse proxy (Nginx, Caddy, Traefik, NPM, etc.) with a custom domain.
177+
For production deployments, you typically run Rustmail behind a reverse proxy (Nginx, Caddy, Traefik, NPM, etc.) with a
178+
custom domain.
147179

148180
### Architecture
149181

@@ -157,11 +189,11 @@ Internet → Reverse Proxy (443) → Rustmail (3002)
157189
### Nginx Proxy Manager (NPM)
158190

159191
1. **Add Proxy Host:**
160-
- Domain: `panel.example.com`
161-
- Scheme: `http`
162-
- Forward Hostname/IP: Your server's internal IP or `localhost`
163-
- Forward Port: `3002`
164-
- Enable SSL with Let's Encrypt
192+
- Domain: `panel.example.com`
193+
- Scheme: `http`
194+
- Forward Hostname/IP: Your server's internal IP or `localhost`
195+
- Forward Port: `3002`
196+
- Enable SSL with Let's Encrypt
165197

166198
2. **Configure Rustmail:**
167199
```toml
@@ -171,7 +203,7 @@ Internet → Reverse Proxy (443) → Rustmail (3002)
171203
```
172204

173205
3. **Update Discord OAuth2:**
174-
- Add `https://panel.example.com/api/auth/callback` to your redirect URIs
206+
- Add `https://panel.example.com/api/auth/callback` to your redirect URIs
175207

176208
### Nginx Configuration
177209

@@ -216,11 +248,13 @@ labels:
216248
217249
**OAuth2 redirect mismatch:**
218250
The redirect URL in `config.toml` must exactly match one of the URLs configured in Discord Developer Portal. Check for:
251+
219252
- Protocol mismatch (`http` vs `https`)
220253
- Trailing slashes
221254
- Port numbers
222255

223256
**Panel not accessible:**
257+
224258
- Verify the reverse proxy can reach port 3002
225259
- Check firewall rules
226260
- Ensure Rustmail is running and panel is enabled
@@ -240,7 +274,8 @@ panel_super_admin_roles = [987654321098765432]
240274
- `panel_super_admin_users` - List of Discord user IDs
241275
- `panel_super_admin_roles` - List of Discord role IDs
242276

243-
Users matching either list have unrestricted panel access. Additional permissions can be granted through the panel itself.
277+
Users matching either list have unrestricted panel access. Additional permissions can be granted through the panel
278+
itself.
244279

245280
---
246281

docs/getting-started/installation.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Before installing Rustmail, create a Discord application:
1515
3. Navigate to **Bot** in the sidebar
1616
4. Click **Add Bot**
1717
5. Under **Privileged Gateway Intents**, enable:
18-
- **Server Members Intent**
19-
- **Message Content Intent**
18+
- **Presence Intent**
19+
- **Server Members Intent**
20+
- **Message Content Intent**
2021
6. Copy the bot token (you will need it for configuration)
2122

2223
### Bot Invitation
@@ -26,15 +27,15 @@ Invite the bot to your server(s) with the required permissions:
2627
1. Go to **OAuth2 > URL Generator**
2728
2. Select scopes: `bot`, `applications.commands`
2829
3. Select permissions:
29-
- Manage Channels
30-
- Read Messages/View Channels
31-
- Send Messages
32-
- Manage Messages
33-
- Embed Links
34-
- Attach Files
35-
- Read Message History
36-
- Add Reactions
37-
- Use Slash Commands
30+
- Manage Channels
31+
- Read Messages/View Channels
32+
- Send Messages
33+
- Manage Messages
34+
- Embed Links
35+
- Attach Files
36+
- Read Message History
37+
- Add Reactions
38+
- Use Slash Commands
3839
4. Copy the generated URL and open it in your browser
3940
5. Select your server and authorize
4041

@@ -49,6 +50,7 @@ For dual-server mode, invite the bot to both servers.
4950
Download the latest release from [GitHub Releases](https://github.com/Rustmail/rustmail/releases).
5051

5152
Available platforms:
53+
5254
- Linux (x86_64)
5355
- Windows (x86_64)
5456
- macOS (x86_64, ARM64)
@@ -87,7 +89,8 @@ On first run, the bot creates:
8789
rustmail/
8890
├── rustmail
8991
├── config.toml
90-
└── db.sqlite # SQLite database (auto-created)
92+
└── db
93+
└── db.sqlite # SQLite database (auto-created)
9194
```
9295

9396
---

0 commit comments

Comments
 (0)