Deploy new admin interface.

This commit is contained in:
Antoine Nguyen
2021-06-28 15:16:42 +02:00
parent 34c78e67e5
commit 0fe8aa61c7
3 changed files with 32 additions and 3 deletions
+13 -2
View File
@@ -4,7 +4,7 @@
Web server
##########
.. note::
.. note::
The following instructions are meant to help you get your site up
and running quickly. However it is not possible for the people
@@ -128,6 +128,17 @@ following configuration::
autoindex on;
}
location ^~ /new-admin {
alias <modoboa_instance_path>/frontend/;
index index.html;
expires -1;
add_header Pragma "no-cache";
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
try_files $uri $uri/ /index.html = 404;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
@@ -166,7 +177,7 @@ optimize their configuration for your site.
The Django documentation includes the following warning regarding
uwsgi:
.. warning::
.. warning::
Use uwsgi 1.2.6 or newer. If you do not, you *will* run into
problems. Modoboa will fail in obscure ways.
+12 -1
View File
@@ -2,10 +2,10 @@
import getpass
import os
from os.path import isfile
import shutil
import subprocess
import sys
from os.path import isfile
import dj_database_url
@@ -267,3 +267,14 @@ class DeployCommand(Command):
self._exec_django_command(
"set_default_site", parsed_args.name, allowed_host
)
base_frontend_dir = os.path.join(
os.path.dirname(__file__), "../../../frontend/dist/")
frontend_target_dir = "{}/frontend".format(parsed_args.name)
shutil.copytree(base_frontend_dir, frontend_target_dir)
with open("{}/config.json".format(frontend_target_dir), "w") as fp:
fp.write("""{
"API_BASE_URL": "https://%s/api/v2"
}
""" % allowed_host)
+7
View File
@@ -51,6 +51,13 @@
{% endif %}
{% load_optionalmenu user %}
<li class="divider"></li>
{% if user.is_admin %}
<li>
<a name="newadmin" href="/new-admin" target="_blank">
{% trans "New admin" %}
</a>
</li>
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if selection %}{% user_menu user selection %}{% else %}{% user_menu user "" %}{% endif %}