From 2f24c45c4c7d3b59179b62e2e56f020e848cc012 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 5 Nov 2017 21:53:13 +0100 Subject: [PATCH 1/7] Set the statistics endpoint for version 1.5 --- core/admin/mailu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/admin/mailu/__init__.py b/core/admin/mailu/__init__.py index f34a75f1..afb7b1d2 100644 --- a/core/admin/mailu/__init__.py +++ b/core/admin/mailu/__init__.py @@ -19,7 +19,7 @@ default_config = { 'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db', 'SQLALCHEMY_TRACK_MODIFICATIONS': False, 'INSTANCE_ID_PATH': '/data/instance', - 'STATS_ENDPOINT': '0.{}.stats.mailu.io', + 'STATS_ENDPOINT': '15.{}.stats.mailu.io', 'SECRET_KEY': 'changeMe', 'DOCKER_SOCKET': 'unix:///var/run/docker.sock', 'HOSTNAMES': 'mail.mailu.io', From 12447e42ff05b2fbbe1cecafb7f636c15a24a9a8 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 11:41:32 +0100 Subject: [PATCH 2/7] Generate dynamic download links for the configuration (cherry picked from commit 881fae382a63373eb4dab6dc5111b3e7f6f133c4) --- docs/compose/{.env.dist => .env} | 0 ...er-compose.yml.dist => docker-compose.yml} | 9 ------ docs/compose/setup.rst | 29 ++++++++----------- 3 files changed, 12 insertions(+), 26 deletions(-) rename docs/compose/{.env.dist => .env} (100%) rename docs/compose/{docker-compose.yml.dist => docker-compose.yml} (91%) diff --git a/docs/compose/.env.dist b/docs/compose/.env similarity index 100% rename from docs/compose/.env.dist rename to docs/compose/.env diff --git a/docs/compose/docker-compose.yml.dist b/docs/compose/docker-compose.yml similarity index 91% rename from docs/compose/docker-compose.yml.dist rename to docs/compose/docker-compose.yml index c0291070..0900e5b5 100644 --- a/docs/compose/docker-compose.yml.dist +++ b/docs/compose/docker-compose.yml @@ -3,7 +3,6 @@ version: '2' services: front: - # build: nginx image: mailu/nginx:$VERSION restart: always env_file: .env @@ -36,7 +35,6 @@ services: - "$ROOT/redis:/data" imap: - # build: dovecot image: mailu/dovecot:$VERSION restart: always env_file: .env @@ -46,7 +44,6 @@ services: - "$ROOT/overrides:/overrides" smtp: - # build: postfix image: mailu/postfix:$VERSION restart: always env_file: .env @@ -55,7 +52,6 @@ services: - "$ROOT/overrides:/overrides" antispam: - # build: rspamd image: mailu/rspamd:$VERSION restart: always env_file: .env @@ -64,7 +60,6 @@ services: - "$ROOT/overrides/rspamd:/etc/rspamd/override.d" antivirus: - # build: clamav image: mailu/$ANTIVIRUS:$VERSION restart: always env_file: .env @@ -72,7 +67,6 @@ services: - "$ROOT/filter:/data" webdav: - # build: $WEBDAV image: mailu/$WEBDAV:$VERSION restart: always env_file: .env @@ -80,7 +74,6 @@ services: - "$ROOT/dav:/data" admin: - # build: admin image: mailu/admin:$VERSION restart: always env_file: .env @@ -90,7 +83,6 @@ services: - /var/run/docker.sock:/var/run/docker.sock:ro webmail: - # build: "$WEBMAIL" image: "mailu/$WEBMAIL:$VERSION" restart: always env_file: .env @@ -98,7 +90,6 @@ services: - "$ROOT/webmail:/data" fetchmail: - # build: fetchmail image: mailu/fetchmail:$VERSION restart: always env_file: .env diff --git a/docs/compose/setup.rst b/docs/compose/setup.rst index c5ed4529..263ebe51 100644 --- a/docs/compose/setup.rst +++ b/docs/compose/setup.rst @@ -15,21 +15,16 @@ Mailu will store all of its persistent data in a path of your choice Download the initial configuration file --------------------------------------- -Docker Compose configuration is stored in a file named ``docker-compose.yml``. -Additionally, Mailu relies on an environment file for various settings. -Download the proper template files from the git repository. For `stable`: +Docker Compose configuration is stored in a file named +:download:`docker-compose.yml`. Additionally, Mailu +relies on a :download:`.env` file for various settings. Download +the proper template files from the git repository. To download the configuration +for the "|version|" branch, use: -.. code-block:: bash +.. parsed-literal:: - wget -O docker-compose.yml https://raw.githubusercontent.com/Mailu/Mailu/stable/docs/compose/docker-compose.yml.dist - wget -O .env https://raw.githubusercontent.com/Mailu/Mailu/stable/docs/compose/.env.dist - -For the latest version (replace with version number otherwise): - -.. code-block:: bash - - wget -O docker-compose.yml https://raw.githubusercontent.com/Mailu/Mailu/master/docs/compose/docker-compose.yml.dist - wget -O .env https://raw.githubusercontent.com/Mailu/Mailu/master/docs/compose/.env.dist + wget https://mailu.io/|version|/_downloads/docker-compose.yml + wget https://mailu.io/|version|/_downloads/.env Then open the ``.env`` file to setup the mail server. Modify the ``ROOT`` setting to match your setup directory if different from ``/mailu``. @@ -50,11 +45,11 @@ you would simply like the server to listen on all interfaces, use ``0.0.0.0``. Modify ``BIND_ADDRESS6`` to match the public IPv6 address assigned to your server. The behavior is identical to ``BIND_ADDRESS4``. -Set the `TLS_FLAVOR` to one of the following +Set the ``TLS_FLAVOR`` to one of the following values: -- `cert` is the default and requires certificates to be setup manually; -- `letsencrypt` will use the Letsencrypt! CA to generate automatic ceriticates; -- `notls` will disable TLS, this is not recommended except for testing. +- ``cert`` is the default and requires certificates to be setup manually; +- ``letsencrypt`` will use the Letsencrypt! CA to generate automatic ceriticates; +- ``notls`` will disable TLS, this is not recommended except for testing. Enable optional features ------------------------ From e170ecaeee741e6eed31f6e5b37552093f191c58 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 11:42:02 +0100 Subject: [PATCH 3/7] Fix a typo in the release notes and remove the mention of the stable branch (cherry picked from commit 0edd4864d2e6119d6323bd0dc88ac56ada383c5f) --- docs/releases.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/releases.rst b/docs/releases.rst index 7a66c246..64634b01 100644 --- a/docs/releases.rst +++ b/docs/releases.rst @@ -35,21 +35,18 @@ and bug fixes. **If you are upgrading**, please go through the setup guide and download the latest ``docker-compose.yml`` and ``.env``, then update them with your sepcific settings, because more than 50% of these templates was rewritten. -You should then be able to simply pull and start your new e-mail stack with +You should then be able to pull and start your new e-mail stack with no issue, simply remove orphaned container, since some were renamed and others -were simply removed (e.g. rmilter): +were removed (e.g. rmilter): .. code-block:: bash docker-compose pull - docker-compose up -d --remove-oprhans + docker-compose up -d --remove-orphans -If you experience issues when upgrading, feel free to post issues and contact +If you experience problems when upgrading, feel free to post issues and contact us on our chat channel for emergency support. -The branch should be considered stable, but the ``stable`` reference will not -be moved to ``1.5`` until as many users as possible have migrated. - Regarding statistics, Mailu has gone from "no tracker at all" to a tracker that we find is designed to preserve privacy and security as much as possible. Your admin container will now perform DNS requests for a domain that we hold, From 8b9d9ef86dea116c6fa555eab0a50bfd0f05bb4f Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 11:48:39 +0100 Subject: [PATCH 4/7] Use github_version in literals --- docs/compose/setup.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/compose/setup.rst b/docs/compose/setup.rst index 263ebe51..b377e04d 100644 --- a/docs/compose/setup.rst +++ b/docs/compose/setup.rst @@ -19,12 +19,12 @@ Docker Compose configuration is stored in a file named :download:`docker-compose.yml`. Additionally, Mailu relies on a :download:`.env` file for various settings. Download the proper template files from the git repository. To download the configuration -for the "|version|" branch, use: +for the "|github_version|" branch, use: .. parsed-literal:: - wget https://mailu.io/|version|/_downloads/docker-compose.yml - wget https://mailu.io/|version|/_downloads/.env + wget https://mailu.io/|github_version|/_downloads/docker-compose.yml + wget https://mailu.io/|github_version|/_downloads/.env Then open the ``.env`` file to setup the mail server. Modify the ``ROOT`` setting to match your setup directory if different from ``/mailu``. From 30a16571555866d121c490a927bda36e5ebfaa72 Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 12:10:54 +0100 Subject: [PATCH 5/7] Use a custom role for including github_version --- docs/compose/setup.rst | 6 +++--- docs/conf.py | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/compose/setup.rst b/docs/compose/setup.rst index b377e04d..d6f80e09 100644 --- a/docs/compose/setup.rst +++ b/docs/compose/setup.rst @@ -19,12 +19,12 @@ Docker Compose configuration is stored in a file named :download:`docker-compose.yml`. Additionally, Mailu relies on a :download:`.env` file for various settings. Download the proper template files from the git repository. To download the configuration -for the "|github_version|" branch, use: +for the ":var:`github_version`" branch, use: .. parsed-literal:: - wget https://mailu.io/|github_version|/_downloads/docker-compose.yml - wget https://mailu.io/|github_version|/_downloads/.env + wget https://mailu.io/:var:`github_version`/_downloads/docker-compose.yml + wget https://mailu.io/:var:`github_version`/_downloads/.env Then open the ``.env`` file to setup the mail server. Modify the ``ROOT`` setting to match your setup directory if different from ``/mailu``. diff --git a/docs/conf.py b/docs/conf.py index f7aedb53..9d5a7af8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -2,8 +2,10 @@ # -*- coding: utf-8 -*- # -extensions = ['sphinx.ext.imgmath', - 'sphinx.ext.viewcode'] +import os, sys, docutils + +sys.path.append(os.path.dirname(__file__)) +extensions = ['sphinx.ext.imgmath', 'sphinx.ext.viewcode', 'conf'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' @@ -37,6 +39,16 @@ html_context = { 'conf_py_path': '/docs/' } + +def setup(app): + """ The configuration acts as an extension itself. + """ + def var_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + return [docutils.nodes.Text(html_context.get(text, ""))], [] + + app.add_role("var", var_role) + + # Upload function when the script is called directly if __name__ == "__main__": import os, sys, paramiko From 49bfeda3d3cb4b56592f2c2dc2e84ad556c6d7fd Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 12:21:28 +0100 Subject: [PATCH 6/7] Use proper jinja templating inside rst templates --- docs/compose/setup.rst | 10 +++++----- docs/conf.py | 13 +++++++++---- docs/contributors/guide.rst | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/compose/setup.rst b/docs/compose/setup.rst index d6f80e09..4dded51e 100644 --- a/docs/compose/setup.rst +++ b/docs/compose/setup.rst @@ -19,17 +19,17 @@ Docker Compose configuration is stored in a file named :download:`docker-compose.yml`. Additionally, Mailu relies on a :download:`.env` file for various settings. Download the proper template files from the git repository. To download the configuration -for the ":var:`github_version`" branch, use: +for the ``{{ github_version }}`` branch, use: -.. parsed-literal:: +.. code-block:: bash - wget https://mailu.io/:var:`github_version`/_downloads/docker-compose.yml - wget https://mailu.io/:var:`github_version`/_downloads/.env + wget https://mailu.io/{{ github_version }}/_downloads/docker-compose.yml + wget https://mailu.io/{{ github_version }}/_downloads/.env Then open the ``.env`` file to setup the mail server. Modify the ``ROOT`` setting to match your setup directory if different from ``/mailu``. -Mdify the ``VERSION`` configuration in the ``.env`` file to reflect the version you picked.. +Mdify the ``VERSION`` configuration in the ``.env`` file to reflect the version you picked. Set the common configuration values ----------------------------------- diff --git a/docs/conf.py b/docs/conf.py index 9d5a7af8..276d2260 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,12 +41,17 @@ html_context = { def setup(app): - """ The configuration acts as an extension itself. + """ The conf itself is an extension for parsing rst. """ - def var_role(name, rawtext, text, lineno, inliner, options={}, content=[]): - return [docutils.nodes.Text(html_context.get(text, ""))], [] + def rstjinja(app, docname, source): + """ Render our pages as a jinja template for fancy templating. + """ + if app.builder.format != 'html': + return + source[0] = app.builder.templates.render_string( + source[0], app.config.html_context) - app.add_role("var", var_role) + app.connect("source-read", rstjinja) # Upload function when the script is called directly diff --git a/docs/contributors/guide.rst b/docs/contributors/guide.rst index fb5c7320..705af469 100644 --- a/docs/contributors/guide.rst +++ b/docs/contributors/guide.rst @@ -26,7 +26,7 @@ for trust in a specific branch of the project, we can switch to a shared repository and add a couple of trusted committers. Commits -`````` +``````` This is a community project, thus commits should be readable enough for any of the contributors to guess the content by simply reading the comment or find a From ea9f3c0242cc2413f2c7f7398b36d0fe422ef90a Mon Sep 17 00:00:00 2001 From: kaiyou Date: Mon, 6 Nov 2017 12:46:21 +0100 Subject: [PATCH 7/7] Fix a Jinja compilation issue --- docs/contributors/memo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributors/memo.rst b/docs/contributors/memo.rst index e42dfeef..07ac8392 100644 --- a/docs/contributors/memo.rst +++ b/docs/contributors/memo.rst @@ -8,7 +8,7 @@ Mailu uses Babel for internationalization and localization. Before any of your work is merged, you must make sure that your strings are internationalized using Babel. -If you used ``_``, ``{% trans %}`` and other Babel syntaxes in your code, run the +If you used ``_``, ``trans`` blocks and other Babel syntaxes in your code, run the following command to update the POT file: .. code-block:: bash