From 4f709852e60ebaae9828450ef351777cafe27a07 Mon Sep 17 00:00:00 2001 From: Spitap Date: Sat, 11 Feb 2023 16:10:55 +0100 Subject: [PATCH 1/4] Updated doc --- doc/upgrade.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/upgrade.rst b/doc/upgrade.rst index 5097873b8..e34a106f4 100644 --- a/doc/upgrade.rst +++ b/doc/upgrade.rst @@ -50,6 +50,18 @@ Make sure to use root privileges and run the following command: Then, reload postfix. +New-admin interface +=================== + +New admin interface won't update by itself. To do so, run the following commands: + +.. sourcecode:: bash + + > sudo -u -i bash + > cd + > rm -rf frontend + > cp -R /lib/pythonX.X/site-packages/modoboa/frontend_dist/ frontend/ + Extensions ********** From 5e7087c3351b88af816ef41a99e7ccc045fe7185 Mon Sep 17 00:00:00 2001 From: Spitap Date: Sat, 11 Feb 2023 16:36:03 +0100 Subject: [PATCH 2/4] fix documentation formating, use of a symbolic link for frontend deployment --- doc/rest_api.rst | 3 ++- doc/upgrade.rst | 16 +++++++++------- modoboa/core/commands/deploy.py | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/rest_api.rst b/doc/rest_api.rst index 13cb23ef7..74159185f 100644 --- a/doc/rest_api.rst +++ b/doc/rest_api.rst @@ -11,13 +11,14 @@ documentation. **You will find them using the following url patterns:** * New API+Docs: *https:///api/schema-v2/swagger/* -* Old API: *http:///api/v1/ +* Old API: *http:///api/v1/* * (Old) Documentation: *http:///docs/api/* **Examples:** * `new example `_ * `old example `_ + documentation is available on the official demo. Using this API requires an authentication and for now, only a token diff --git a/doc/upgrade.rst b/doc/upgrade.rst index e34a106f4..79275a8b3 100644 --- a/doc/upgrade.rst +++ b/doc/upgrade.rst @@ -53,14 +53,17 @@ Then, reload postfix. New-admin interface =================== -New admin interface won't update by itself. To do so, run the following commands: +.. note:: + You don't need to perform these actions if you installed modoboa after 2.0.5. + +New admin interface won't update by itself. To fix this, run the following commands (you need to perform this only one time): .. sourcecode:: bash > sudo -u -i bash > cd > rm -rf frontend - > cp -R /lib/pythonX.X/site-packages/modoboa/frontend_dist/ frontend/ + > ln -s /lib/pythonX.X/site-packages/modoboa/frontend_dist/ frontend/ Extensions ********** @@ -136,13 +139,13 @@ The following modifications must be applied to the :file:`settings.py` file: ] -* Add the following variable:: +* Add the following variable: .. sourcecode:: python PID_FILE_STORAGE_PATH = '/var/run' -* Update ``LOGGING`` variable to define an address for ``syslog-auth`` handler:: +* Update ``LOGGING`` variable to define an address for ``syslog-auth`` handler: .. sourcecode:: python @@ -154,9 +157,8 @@ The following modifications must be applied to the :file:`settings.py` file: }, -* You now have the possibility to customize the url of the new-admin -interface. To do so please head up to :ref:`the custom configuration -chapter ` (advanced user). +* You now have the possibility to customize the url of the new-admin interface. + To do so please head up to :ref:`the custom configuration chapter ` (advanced user). * Add ``DEFAULT_THROTTLE_RATES`` to ``REST_FRAMEWORK``: diff --git a/modoboa/core/commands/deploy.py b/modoboa/core/commands/deploy.py index dc6e1b8b3..86287e9c5 100644 --- a/modoboa/core/commands/deploy.py +++ b/modoboa/core/commands/deploy.py @@ -273,7 +273,7 @@ class DeployCommand(Command): if not os.path.exists(base_frontend_dir): return frontend_target_dir = "{}/frontend".format(parsed_args.name) - shutil.copytree(base_frontend_dir, frontend_target_dir) + os.symlink(base_frontend_dir, frontend_target_dir, True) with open("{}/config.json".format(frontend_target_dir), "w") as fp: fp.write("""{ From 30a8a59906ee727c3e99322f7aeaf280a211bafa Mon Sep 17 00:00:00 2001 From: Spitap Date: Sat, 11 Feb 2023 16:41:44 +0100 Subject: [PATCH 3/4] Fixed default new-admin url --- modoboa/core/commands/templates/settings.py.tpl | 2 +- modoboa/core/context_processors.py | 2 +- test_project/test_project/settings.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modoboa/core/commands/templates/settings.py.tpl b/modoboa/core/commands/templates/settings.py.tpl index 22bf058ee..3c46fb253 100644 --- a/modoboa/core/commands/templates/settings.py.tpl +++ b/modoboa/core/commands/templates/settings.py.tpl @@ -213,7 +213,7 @@ REST_FRAMEWORK = { } # Uncomment if you need a custom sub url for new_admin interface -# NEW_ADMIN_URL = 'new_admin' +# NEW_ADMIN_URL = 'new-admin' SPECTACULAR_SETTINGS = { 'SCHEMA_PATH_PREFIX': r'/api/v[0-9]', diff --git a/modoboa/core/context_processors.py b/modoboa/core/context_processors.py index 2f9126ec4..6b967b758 100644 --- a/modoboa/core/context_processors.py +++ b/modoboa/core/context_processors.py @@ -25,5 +25,5 @@ def top_notifications(request): def new_admin_url(*args): """A context processor to include new admin url.""" return { - "new_admin": getattr(settings, "NEW_ADMIN_URL", "new_admin") + "new_admin": getattr(settings, "NEW_ADMIN_URL", "new-admin") } diff --git a/test_project/test_project/settings.py b/test_project/test_project/settings.py index f0d1b63de..19ce64b57 100644 --- a/test_project/test_project/settings.py +++ b/test_project/test_project/settings.py @@ -205,7 +205,7 @@ REST_FRAMEWORK = { } # Uncomment if you need a custom sub url for new_admin interface -# NEW_ADMIN_URL = 'new_admin' +# NEW_ADMIN_URL = 'new-admin' SPECTACULAR_SETTINGS = { 'SCHEMA_PATH_PREFIX': r'/api/v[0-9]', From 0f8105985b89f626bb43e6f0fa27db51d184a807 Mon Sep 17 00:00:00 2001 From: Spitap Date: Thu, 16 Feb 2023 14:49:47 +0100 Subject: [PATCH 4/4] removed symbolic link use --- doc/upgrade.rst | 10 ++++++---- modoboa/core/commands/deploy.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/upgrade.rst b/doc/upgrade.rst index 79275a8b3..8245b937f 100644 --- a/doc/upgrade.rst +++ b/doc/upgrade.rst @@ -54,17 +54,19 @@ New-admin interface =================== .. note:: - You don't need to perform these actions if you installed modoboa after 2.0.5. + You don't need to perform these actions if you use the installer to upgrade your instance. -New admin interface won't update by itself. To fix this, run the following commands (you need to perform this only one time): +New admin interface won't update by itself. Run the following commands to update it: .. sourcecode:: bash > sudo -u -i bash > cd + > cp frontend/config.json ./ > rm -rf frontend - > ln -s /lib/pythonX.X/site-packages/modoboa/frontend_dist/ frontend/ - + > cp -R /lib/pythonX.X/site-packages/modoboa/frontend_dist/ frontend/ + > cp ./config.json frontend/config.json + Extensions ********** diff --git a/modoboa/core/commands/deploy.py b/modoboa/core/commands/deploy.py index 86287e9c5..dc6e1b8b3 100644 --- a/modoboa/core/commands/deploy.py +++ b/modoboa/core/commands/deploy.py @@ -273,7 +273,7 @@ class DeployCommand(Command): if not os.path.exists(base_frontend_dir): return frontend_target_dir = "{}/frontend".format(parsed_args.name) - os.symlink(base_frontend_dir, frontend_target_dir, True) + shutil.copytree(base_frontend_dir, frontend_target_dir) with open("{}/config.json".format(frontend_target_dir), "w") as fp: fp.write("""{