computer-playbook/roles/docker-mailu/README.md

145 lines
4.7 KiB
Markdown
Raw Normal View History

2023-06-29 14:41:16 +02:00
# Mailu Server Docker Role
2020-12-27 13:22:47 +01:00
2023-06-29 14:41:16 +02:00
This guide provides instructions for setting up, operating, and maintaining the Mailu server docker role.
2023-06-29 14:41:16 +02:00
## Table of Contents
2023-06-29 14:41:16 +02:00
- [Setup](#setup)
- [Fetchmail Issues](#fetchmail-issues)
- [Data Deletion](#data-deletion)
- [Port Management](#port-management)
- [Admin Account Creation](#admin-account-creation)
- [CLI User Management](#cli-user-management)
- [Starting the Server](#starting-the-server)
- [Debugging](#debugging)
- [Testing](#testing)
- [Updates](#updates)
- [To-Do](#to-do)
- [References](#references)
2023-06-29 14:41:16 +02:00
## Setup
2023-06-29 14:41:16 +02:00
### Fetchmail Issues
2023-06-29 14:41:16 +02:00
Fetchmail might not work properly with large amounts of data. For more information, refer to this [issue](https://github.com/Mailu/Mailu/issues/1719).
2020-12-27 21:30:44 +01:00
2023-06-29 14:41:16 +02:00
#### Deactivating Fetchmail
Before uninstalling Fetchmail, ensure to remove all fetched accounts from the administration panel.
#### Fetchmail Security Concerns
There are known security concerns with Fetchmail as stated in the [German Wikipedia](https://de.wikipedia.org/wiki/Fetchmail). If you require Fetchmail functions in the future, consider creating a Docker container for [Getmail](https://en.wikipedia.org/wiki/Getmail) as it is considered more secure.
#### Fetchmail Workaround
If you need to receive emails from another account, follow these steps:
1. Redirect your emails to your new email account.
2. Export all data from your original account.
3. Import all data to your new account.
### Data Deletion
To delete all volumes and data, execute the following command with caution:
2020-12-27 21:30:44 +01:00
```bash
2023-06-29 14:41:16 +02:00
rm -vr /etc/mailu/; docker volume rm $(docker volume ls -q | grep mailu_)
2020-12-27 21:30:44 +01:00
```
2023-06-29 14:41:16 +02:00
### Port Management
Check for any port conflicts and manually change the conflicting ports if necessary. Use the following command to verify:
2020-12-27 13:22:47 +01:00
```bash
2023-06-29 14:41:16 +02:00
netstat -tulpn
2020-12-27 13:22:47 +01:00
```
2020-12-27 16:16:12 +01:00
2023-06-29 14:41:16 +02:00
### Admin Account Creation
2020-12-27 16:16:12 +01:00
2023-06-29 14:41:16 +02:00
To use Mailu, create the primary administrator user account, `admin@{{hostname}}`, using the command below. Replace `PASSWORD` with your preferred password:
2020-12-27 16:16:12 +01:00
```bash
2023-06-29 14:41:16 +02:00
docker-compose -p mailu exec admin flask mailu admin {{admin}} {{hostname}} PASSWORD
2020-12-27 16:16:12 +01:00
```
2023-06-29 14:41:16 +02:00
### CLI User Management
For managing users, follow the instructions in the official [Mailu CLI documentation](https://mailu.io/master/cli.html).
### Starting the Server
2020-12-28 16:41:01 +01:00
2023-06-29 14:41:16 +02:00
To start the server, use the following command:
2020-12-27 19:41:35 +01:00
```bash
2023-06-29 14:41:16 +02:00
docker-compose -p mailu up -d
2020-12-27 19:41:35 +01:00
```
2023-04-15 13:24:21 +02:00
2023-06-29 14:41:16 +02:00
## Debugging
### Database Access
To access the database, use the following command:
2023-04-15 13:24:21 +02:00
```bash
2023-06-29 14:41:16 +02:00
docker-compose exec -it database mysql -u root -D mailu -p
2023-04-15 13:24:21 +02:00
```
2023-06-29 14:41:16 +02:00
### Container Access
To access the front container, use this command:
2021-04-05 15:42:10 +02:00
```bash
2023-06-29 14:41:16 +02:00
docker-compose exec -it front /bin/bash
2021-04-05 15:42:10 +02:00
```
2023-06-29 14:41:16 +02:00
### Restarting Services
To restart all services, use the following command:
2021-08-24 22:40:59 +02:00
```bash
2023-06-29 14:41:16 +02:00
docker-compose restart
2021-08-24 22:40:59 +02:00
```
2020-12-27 19:41:35 +01:00
2023-06-29 14:41:16 +02:00
### Resending Queued Mails
To resend queued mails, use this command:
2023-05-25 19:51:44 +02:00
```bash
docker-compose exec -it smtp postqueue -f
```
2023-06-29 14:41:16 +02:00
## Testing
Use the following tools for testing:
- SSL-Tools Mailserver Test (URL: https://de.ssl-tools.net/mailservers/)
- TestEmail.de (URL: http://testemail.de/)
## Updates
For instructions on updating your Mailu setup, follow the official [Mailu maintenance guide](https://mailu.io/master/maintain.html).
## To-Do
- Implement two-factor authentication in Roundcube Webmail. More information can be found [here](https://blog.kuepper.nrw/2019/03/30/roundcube-webmail-mit-zwei-faktor-authentifizierung/).
- Integrate Nextcloud 15 and newer with Mailu. Learn more about this [here](https://mailu.io/master/faq.html#i-want-to-integrate-nextcloud-15-and-newer-with-mailu).
- User authentication with Nextcloud. Find more information [here](https://docs.nextcloud.com/server/9.0/admin_manual/configuration_user/user_auth_ftp_smb_imap.html).
## References
- [Mailu compose setup guide](https://mailu.io/1.7/compose/setup.html)
- [SysPass issue #1299](https://github.com/nuxsmin/sysPass/issues/1299)
- [Mailu issue #1719](https://github.com/Mailu/Mailu/issues/1719)
- [Mailu issue #1171](https://github.com/Mailu/Mailu/issues/1171)
- [Mailu issue #2135](https://github.com/Mailu/Mailu/issues/2135)
- [Mailu issue #2827](https://github.com/Mailu/Mailu/issues/2827)
- [Mailu GitHub repository](https://github.com/Mailu/Mailu)
- [Plesk support article on RoundCube connection issue](https://support.plesk.com/hc/en-us/articles/115001264814-Unable-to-log-into-RoundCube-Connection-to-storage-server-failed)
- [Gist by marienfressinaud](https://gist.github.com/marienfressinaud/f284a59b18aad395eb0de2d22836ae6b)
For more information about this role, visit the [GitHub repository](https://github.com/kevinveenbirkenbach/computer-playbook/tree/master/roles/server_docker-mailu).
This README.md was optimized with [Chat-GPT](https://chat.openai.com/share/d1ad5ce7-3aa1-4a14-a959-63393b39374a)