Skip to content

Commit 0e9ce23

Browse files
committed
docs(global): update all rustmail documentations
1 parent 1eeb439 commit 0e9ce23

18 files changed

Lines changed: 4515 additions & 72 deletions

docs/commands.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

docs/deployment/docker.md

Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
# Docker Deployment
2+
3+
This guide covers running Rustmail in Docker containers.
4+
5+
---
6+
7+
## Quick Start
8+
9+
### Pull the Image
10+
11+
```bash
12+
docker pull ghcr.io/rustmail/rustmail:latest
13+
```
14+
15+
### Run with Docker
16+
17+
```bash
18+
docker run -d \
19+
--name rustmail \
20+
-p 3002:3002 \
21+
-v /path/to/config.toml:/app/config.toml:ro \
22+
-v rustmail-data:/app/db \
23+
ghcr.io/rustmail/rustmail:latest
24+
```
25+
26+
---
27+
28+
## Docker Compose
29+
30+
Create a `docker-compose.yml`:
31+
32+
```yaml
33+
version: '3.8'
34+
35+
services:
36+
rustmail:
37+
image: ghcr.io/rustmail/rustmail:latest
38+
container_name: rustmail
39+
restart: unless-stopped
40+
ports:
41+
- "3002:3002"
42+
volumes:
43+
- ./config.toml:/app/config.toml:ro
44+
- rustmail-data:/app/db
45+
environment:
46+
- TZ=Europe/Paris
47+
48+
volumes:
49+
rustmail-data:
50+
```
51+
52+
Start with:
53+
54+
```bash
55+
docker-compose up -d
56+
```
57+
58+
---
59+
60+
## Configuration
61+
62+
### Volume Mounts
63+
64+
| Path | Description |
65+
|--------------------|-----------------------------------------|
66+
| `/app/config.toml` | Configuration file (required) |
67+
| `/app/db` | Database directory (persistent storage) |
68+
69+
### Ports
70+
71+
| Port | Description |
72+
|--------|-------------------|
73+
| `3002` | Web panel and API |
74+
75+
### Environment Variables
76+
77+
| Variable | Description |
78+
|----------|--------------------|
79+
| `TZ` | Container timezone |
80+
81+
---
82+
83+
## Building the Image
84+
85+
To build from source:
86+
87+
```bash
88+
# Clone the repository
89+
git clone https://github.com/Rustmail/rustmail.git
90+
cd rustmail
91+
92+
# Build the image
93+
docker build -t rustmail:local .
94+
```
95+
96+
The Dockerfile uses a multi-stage build with Debian Bookworm Slim as the runtime base.
97+
98+
---
99+
100+
## Docker Compose with Reverse Proxy
101+
102+
### With Traefik
103+
104+
```yaml
105+
version: '3.8'
106+
107+
services:
108+
rustmail:
109+
image: ghcr.io/rustmail/rustmail:latest
110+
container_name: rustmail
111+
restart: unless-stopped
112+
volumes:
113+
- ./config.toml:/app/config.toml:ro
114+
- rustmail-data:/app/db
115+
labels:
116+
- "traefik.enable=true"
117+
- "traefik.http.routers.rustmail.rule=Host(`panel.example.com`)"
118+
- "traefik.http.routers.rustmail.tls=true"
119+
- "traefik.http.routers.rustmail.tls.certresolver=letsencrypt"
120+
- "traefik.http.services.rustmail.loadbalancer.server.port=3002"
121+
networks:
122+
- traefik
123+
124+
networks:
125+
traefik:
126+
external: true
127+
128+
volumes:
129+
rustmail-data:
130+
```
131+
132+
### With Nginx Proxy Manager
133+
134+
```yaml
135+
version: '3.8'
136+
137+
services:
138+
rustmail:
139+
image: ghcr.io/rustmail/rustmail:latest
140+
container_name: rustmail
141+
restart: unless-stopped
142+
volumes:
143+
- ./config.toml:/app/config.toml:ro
144+
- rustmail-data:/app/db
145+
networks:
146+
- npm_network
147+
148+
networks:
149+
npm_network:
150+
external: true
151+
152+
volumes:
153+
rustmail-data:
154+
```
155+
156+
Then in NPM, create a proxy host pointing to `rustmail:3002`.
157+
158+
### With Caddy
159+
160+
```yaml
161+
version: '3.8'
162+
163+
services:
164+
rustmail:
165+
image: ghcr.io/rustmail/rustmail:latest
166+
container_name: rustmail
167+
restart: unless-stopped
168+
volumes:
169+
- ./config.toml:/app/config.toml:ro
170+
- rustmail-data:/app/db
171+
networks:
172+
- caddy
173+
174+
caddy:
175+
image: caddy:alpine
176+
restart: unless-stopped
177+
ports:
178+
- "80:80"
179+
- "443:443"
180+
volumes:
181+
- ./Caddyfile:/etc/caddy/Caddyfile:ro
182+
- caddy-data:/data
183+
networks:
184+
- caddy
185+
186+
networks:
187+
caddy:
188+
189+
volumes:
190+
rustmail-data:
191+
caddy-data:
192+
```
193+
194+
Caddyfile:
195+
```
196+
panel.example.com {
197+
reverse_proxy rustmail:3002
198+
}
199+
```
200+
201+
---
202+
203+
## Health Checks
204+
205+
Add health monitoring:
206+
207+
```yaml
208+
services:
209+
rustmail:
210+
image: ghcr.io/rustmail/rustmail:latest
211+
healthcheck:
212+
test: ["CMD", "curl", "-f", "http://localhost:3002/api/panel/check"]
213+
interval: 30s
214+
timeout: 10s
215+
retries: 3
216+
start_period: 10s
217+
```
218+
219+
---
220+
221+
## Logging
222+
223+
View logs:
224+
225+
```bash
226+
# Follow logs
227+
docker logs -f rustmail
228+
229+
# Last 100 lines
230+
docker logs --tail 100 rustmail
231+
```
232+
233+
Configure log rotation in Docker daemon or use a logging driver:
234+
235+
```yaml
236+
services:
237+
rustmail:
238+
logging:
239+
driver: "json-file"
240+
options:
241+
max-size: "10m"
242+
max-file: "3"
243+
```
244+
245+
---
246+
247+
## Backup
248+
249+
### Database Backup
250+
251+
```bash
252+
# Stop container for consistent backup
253+
docker stop rustmail
254+
255+
# Copy database
256+
docker cp rustmail:/app/db/db.sqlite ./backup-$(date +%Y%m%d).sqlite
257+
258+
# Restart
259+
docker start rustmail
260+
```
261+
262+
### Volume Backup
263+
264+
```bash
265+
docker run --rm \
266+
-v rustmail-data:/data:ro \
267+
-v $(pwd):/backup \
268+
alpine tar czf /backup/rustmail-backup.tar.gz /data
269+
```
270+
271+
---
272+
273+
## Updates
274+
275+
### Pull New Image
276+
277+
```bash
278+
docker-compose pull
279+
docker-compose up -d
280+
```
281+
282+
### Manual Update
283+
284+
```bash
285+
docker pull ghcr.io/rustmail/rustmail:latest
286+
docker stop rustmail
287+
docker rm rustmail
288+
# Run new container with same volumes
289+
```
290+
291+
---
292+
293+
## Troubleshooting
294+
295+
### Container Won't Start
296+
297+
Check logs:
298+
```bash
299+
docker logs rustmail
300+
```
301+
302+
Common issues:
303+
- Invalid `config.toml` syntax
304+
- Missing required configuration fields
305+
- Permission issues on mounted volumes
306+
307+
### Cannot Connect to Panel
308+
309+
- Verify port 3002 is exposed: `docker port rustmail`
310+
- Check container is running: `docker ps`
311+
- Verify network connectivity to container
312+
313+
### Database Errors
314+
315+
- Ensure `/app/db` volume is writable
316+
- Check disk space on host
317+
- Verify volume mount is correct
318+
319+
### Permission Denied
320+
321+
The container runs as user `rustmail` (UID 1000). Ensure mounted volumes are accessible:
322+
323+
```bash
324+
# Fix permissions on host
325+
chown -R 1000:1000 /path/to/data
326+
```

0 commit comments

Comments
 (0)