1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-16 10:59:53 +02:00
Mailu/docs/compose/setup.rst

114 lines
4.6 KiB
ReStructuredText
Raw Normal View History

2017-11-01 21:12:17 +02:00
Docker Compose setup
====================
Prepare the environment
-----------------------
Mailu will store all of its persistent data in a path of your choice
(``/mailu`` by default) simply create the directory and move there:
.. code-block:: bash
mkdir /mailu
cd /mailu
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
Create the configuration files
------------------------------
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
Docker Compose configuration is stored in a file named ``docker-compose.yml``.
Additionally, Mailu relies on a ``mailu.env`` file for various settings.
Both files can be generated by the `mailu setup utility`_. The setup utility
is mostly self-explanatory, with some more additional information in this section.
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
.. _`mailu setup utility`: https://setup.mailu.io
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
.. _tls_flavor:
2017-11-01 21:12:17 +02:00
TLS certificates
````````````````
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
Sets the ``TLS_FLAVOR`` to one of the following
2017-11-01 21:12:17 +02:00
values:
2017-11-07 17:16:41 +02:00
- ``cert`` is the default and requires certificates to be setup manually;
2020-08-24 02:21:14 +02:00
- ``letsencrypt`` will use the *Letsencrypt!* CA to generate automatic certificates;
2017-11-07 17:16:41 +02:00
- ``mail`` is similar to ``cert`` except that TLS will only be served for
emails (IMAP and SMTP), not HTTP (use it behind reverse proxies);
2017-12-05 01:21:58 +02:00
- ``mail-letsencrypt`` is similar to ``letsencrypt`` except that TLS will only be served for
emails (IMAP and SMTP), not HTTP (use it behind reverse proxies);
2018-10-11 17:33:58 +02:00
- ``notls`` will disable TLS, this is not recommended except for testing.
.. note::
When using *Letsencrypt!* you have to make sure that the DNS ``A`` and ``AAAA`` records for the
all hostnames mentioned in the ``HOSTNAMES`` variable match with the ip adresses of you server.
Or else certificate generation will fail! See also: :ref:`dns_setup`.
Bind address
````````````
2019-01-16 21:01:09 +02:00
The bind addresses need to match the public IP addresses assigned to your server. For IPv6 you will need the ``<global>`` scope address.
You can find those addresses by running the following:
.. code-block:: bash
[root@mailu ~]$ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 125.189.138.127 netmask 255.255.255.0 broadcast 5.189.138.255
inet6 fd21:aab2:717c:cc5a::1 prefixlen 64 scopeid 0x0<global>
inet6 fe2f:2a73:43a8:7a1b::1 prefixlen 64 scopeid 0x20<link>
ether 00:50:56:3c:b2:23 txqueuelen 1000 (Ethernet)
RX packets 174866612 bytes 127773819607 (118.9 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 19905110 bytes 2191519656 (2.0 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
If the address is not configured directly (NAT) on any of the network interfaces or if
you would simply like the server to listen on all interfaces, use ``0.0.0.0`` and ``::``. Note that running is this mode is not supported and can lead to `issues`_.
.. _issues: https://github.com/Mailu/Mailu/issues/641
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
Review configuration variables
------------------------------
2017-11-01 21:12:17 +02:00
2019-01-16 21:01:09 +02:00
After downloading the files, open ``mailu.env`` and review the variable settings.
Make sure to read the comments in the file and instructions from the :ref:`common_cfg` page.
2017-12-05 01:21:58 +02:00
2017-11-01 21:12:17 +02:00
Finish setting up TLS
---------------------
Mailu relies heavily on TLS and must have a key pair and a certificate
2019-01-16 21:01:09 +02:00
available, at least for the hostname configured in the ``mailu.env`` file.
2017-11-01 21:12:17 +02:00
If you set ``TLS_FLAVOR`` to ``cert`` or ``mail`` then you must create a ``certs`` directory
2017-11-01 21:12:17 +02:00
in your root path and setup a key-certificate pair there:
- ``cert.pem`` contains the certificate (override with ``TLS_CERT_FILENAME``),
- ``key.pem`` contains the key pair (override with ``TLS_KEYPAIR_FILENAME``).
2017-11-01 21:12:17 +02:00
Start Mailu
-----------
You may now start Mailu. Move the to the Mailu directory and run:
.. code-block:: bash
docker-compose up -d
2017-11-01 21:12:17 +02:00
Finally, you need an admin user account.
You can have the system create it automatically:
use the environment variables ``INITIAL_ACCOUNT*`` as described in :ref:`admin_account`
You should set ``INITIAL_ADMIN_MODE`` also to either ``update`` or ``ifmissing``. Leaving it with the default value could cause errors when restarting the system.
Else, if you don't go with the automatic way, you need to manually create the admin account now:
2017-11-01 21:12:17 +02:00
.. code-block:: bash
2020-02-07 18:14:09 +02:00
docker-compose exec admin flask mailu admin me example.net 'password'
2017-11-01 21:12:17 +02:00
2018-11-08 22:35:41 +02:00
This will create a user named ``me@example.net`` with password ``password`` and administration privileges. Connect to the Web admin interface and change the password to a strong one.
2019-01-16 21:01:09 +02:00
.. note:: It is vitally important that either a user with the same email as ``POSTMASTER`` in your ``mailu.env`` exists, or you remember to create an alias with this name after you log in. All kinds of strange errors will occur as a result of not doing so!