diff --git a/docs/index.rst b/docs/index.rst index 42098ee..2531f79 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -660,14 +660,95 @@ Configure Davmail by creating a ``davmail.properties`` file ############################################################# -Run Davmail + +Running DavMail as a systemd service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Use systemd to run ``davmail`` as a service and process reports as they +arrive. + + +Create a system user .. code-block:: bash - ./davmail.sh + sudo useradd davmail -r -s /bin/false + +Protect the ``davmail`` configuration file from prying eyes + +.. code-block:: bash + + sudo chown root:davmail /opt/davmail/davmail.properties + sudo chmod u=rw,g=r,o= /opt/davmail/davmail.properties + +Create the service configuration file + +.. code-block:: bash + + sudo nano /etc/systemd/system/davmail.service + +.. code-block:: ini + + [Unit] + Description=DavMail gateway service + Documentation=https://sourceforge.net/projects/davmail/ + Wants=network-online.target + After=syslog.target network.target + + [Service] + ExecStart=/opt/davmail/davmail /opt/davmail/davmail.properties + User=davmail + Group=davmail + Restart=always + RestartSec=5m + + [Install] + WantedBy=multi-user.target + +Then, enable the service + +.. code-block:: bash + + sudo systemctl daemon-reload + sudo systemctl enable parsedmarc.service + sudo service davmail restart + +.. note:: + + You must also run the above commands whenever you edit + ``davmail.service``. + +.. warning:: + + Always restart the service every time you upgrade to a new version of + ``davmail``: + + .. code-block:: bash + + sudo service davmail restart + +To check the status of the service, run: + +.. code-block:: bash + + service davmail status + +.. note:: + + In the event of a crash, systemd will restart the service after 5 minutes, + but the `service davmail status` command will only show the logs for the + current process. To vew the logs for previous runs as well as the + current process (newest to oldest), run: + + .. code-block:: bash + + journalctl -u davmail.service -r -Because you are interacting with Davmail server over the loopback +Configuring parsedmarc for DavMail +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Because you are interacting with DavMail server over the loopback (i.e. ``127.0.0.1``), add the following options to ``parsedmarc.ini`` config file: @@ -677,7 +758,7 @@ config file: host=127.0.0.1 port=1143 ssl=False - watch = True + watch=True Elasticsearch and Kibana ------------------------ @@ -1023,89 +1104,6 @@ To check the status of the service, run: .. code-block:: bash journalctl -u parsedmarc.service -r - -Running DavMail as a systemd service ---------------------------------------- - -Use systemd to run ``davmail`` as a service and process reports as they -arrive. - - -Create a system user - -.. code-block:: bash - - sudo useradd davmail -r -s /bin/false - -Protect the ``davmail`` configuration file from prying eyes - -.. code-block:: bash - - sudo chown root:davmail /opt/davmail/davmail.properties - sudo chmod u=rw,g=r,o= /opt/davmail/davmail.properties - -Create the service configuration file - -.. code-block:: bash - - sudo nano /etc/systemd/system/davmail.service - -.. code-block:: ini - - [Unit] - Description=DavMail gateway service - Documentation=https://sourceforge.net/projects/davmail/ - Wants=network-online.target - After=syslog.target network.target - - [Service] - ExecStart=/opt/davmail/davmail /opt/davmail/davmail.properties - User=davmail - Group=davmail - Restart=always - RestartSec=5m - - [Install] - WantedBy=multi-user.target - -Then, enable the service - -.. code-block:: bash - - sudo systemctl daemon-reload - sudo systemctl enable parsedmarc.service - sudo service davmail restart - -.. note:: - - You must also run the above commands whenever you edit - ``davmail.service``. - -.. warning:: - - Always restart the service every time you upgrade to a new version of - ``davmail``: - - .. code-block:: bash - - sudo service davmail restart - -To check the status of the service, run: - -.. code-block:: bash - - service davmail status - -.. note:: - - In the event of a crash, systemd will restart the service after 10 minutes, - but the `service davmail status` command will only show the logs for the - current process. To vew the logs for previous runs as well as the - current process (newest to oldest), run: - - .. code-block:: bash - - journalctl -u davmail.service -r Using the Kibana dashboards