Improve installation visibility, service checks and hosting plan help #132
No files matched your search
@@ -34,6 +34,7 @@ PANEL_UNITS = (
|
|||||||
"coulobre-worker.service",
|
"coulobre-worker.service",
|
||||||
"coulobre-beat.service",
|
"coulobre-beat.service",
|
||||||
)
|
)
|
||||||
|
HEALTH_TIMER = "coulobre-health.timer"
|
||||||
BASE_PACKAGES = (
|
BASE_PACKAGES = (
|
||||||
"apache2",
|
"apache2",
|
||||||
"mariadb-server",
|
"mariadb-server",
|
||||||
@@ -547,6 +548,20 @@ class Installer:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def environment(self):
|
def environment(self):
|
||||||
|
services = [
|
||||||
|
"panel",
|
||||||
|
"worker",
|
||||||
|
"scheduler",
|
||||||
|
"apache",
|
||||||
|
"mariadb",
|
||||||
|
"rabbitmq",
|
||||||
|
]
|
||||||
|
if self.php:
|
||||||
|
services.append("php-fpm")
|
||||||
|
if self.plan.dns.mode == "local":
|
||||||
|
services.append("bind9")
|
||||||
|
if self.plan.mail.mode == "local":
|
||||||
|
services.extend(("postfix", "dovecot", "rspamd", "redis"))
|
||||||
options = {
|
options = {
|
||||||
"DJANGO_SETTINGS_MODULE": "coulobre.settings",
|
"DJANGO_SETTINGS_MODULE": "coulobre.settings",
|
||||||
"COULOBRE_ALLOWED_HOSTS": self.plan.hostname,
|
"COULOBRE_ALLOWED_HOSTS": self.plan.hostname,
|
||||||
@@ -564,6 +579,9 @@ class Installer:
|
|||||||
f"amqp://coulobre:{self.state['broker_password']}@127.0.0.1:5672/coulobre"
|
f"amqp://coulobre:{self.state['broker_password']}@127.0.0.1:5672/coulobre"
|
||||||
),
|
),
|
||||||
"COULOBRE_LOCAL_DATABASE_PROVISIONING": "1",
|
"COULOBRE_LOCAL_DATABASE_PROVISIONING": "1",
|
||||||
|
"COULOBRE_SERVICE_HEALTH": json.dumps(
|
||||||
|
{"panel": {"local": services}}, separators=(",", ":")
|
||||||
|
),
|
||||||
}
|
}
|
||||||
if self.php:
|
if self.php:
|
||||||
options["COULOBRE_LOCAL_WEB_ACTIVATION"] = "1"
|
options["COULOBRE_LOCAL_WEB_ACTIVATION"] = "1"
|
||||||
@@ -829,13 +847,19 @@ class Installer:
|
|||||||
self.prepare_panel()
|
self.prepare_panel()
|
||||||
self.progress("Validating Apache and starting the panel services.")
|
self.progress("Validating Apache and starting the panel services.")
|
||||||
self.apache()
|
self.apache()
|
||||||
for unit in PANEL_UNITS:
|
identity("coulobre-health")
|
||||||
|
for unit in (
|
||||||
|
*PANEL_UNITS,
|
||||||
|
"coulobre-health.service",
|
||||||
|
HEALTH_TIMER,
|
||||||
|
):
|
||||||
install_unit(unit)
|
install_unit(unit)
|
||||||
systemctl("daemon-reload")
|
systemctl("daemon-reload")
|
||||||
systemctl(
|
systemctl(
|
||||||
"enable", "--now", *PANEL_UNITS, *workers, "apache2.service"
|
"enable", "--now", *PANEL_UNITS, *workers, "apache2.service"
|
||||||
)
|
)
|
||||||
systemctl("reload", "apache2.service")
|
systemctl("reload", "apache2.service")
|
||||||
|
systemctl("enable", "--now", HEALTH_TIMER)
|
||||||
self.verify_panel()
|
self.verify_panel()
|
||||||
if self.plan.mail.mode == "local":
|
if self.plan.mail.mode == "local":
|
||||||
with self.step("Checking Postfix for outgoing panel email"):
|
with self.step("Checking Postfix for outgoing panel email"):
|
||||||
|
|||||||
+6
-3
@@ -2470,8 +2470,10 @@ states. Use the corresponding service tests to check mail delivery, DNS
|
|||||||
answers, or website responses. The collector and dashboard both need the
|
answers, or website responses. The collector and dashboard both need the
|
||||||
panel database to record and display observations.
|
panel database to record and display observations.
|
||||||
|
|
||||||
Set `COULOBRE_SERVICE_HEALTH` in `/etc/coulobre/panel.env`. This example checks
|
The installer configures the collector for the services it installs on the
|
||||||
local panel services and two records for remote mail and DNS services.
|
panel host. To enable a collector on an existing host or change the services
|
||||||
|
it monitors, set `COULOBRE_SERVICE_HEALTH` in `/etc/coulobre/panel.env`.
|
||||||
|
This example includes separate mail and DNS nodes.
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
COULOBRE_SERVICE_HEALTH='{"panel-01":{"local":["panel","worker","scheduler","apache","php-fpm","mariadb","rabbitmq"]},"mail-01":{"ssh":["postfix","dovecot"]},"dns-01":{"ssh":["bind9"]}}'
|
COULOBRE_SERVICE_HEALTH='{"panel-01":{"local":["panel","worker","scheduler","apache","php-fpm","mariadb","rabbitmq"]},"mail-01":{"ssh":["postfix","dovecot"]},"dns-01":{"ssh":["bind9"]}}'
|
||||||
@@ -2482,7 +2484,8 @@ starting with a letter. Keep the IDs stable for the same hosts. List one
|
|||||||
`local` node per panel installation and use `ssh` for each additional host.
|
`local` node per panel installation and use `ssh` for each additional host.
|
||||||
Use `php-fpm` under `local` to monitor the installed stable PHP-FPM services.
|
Use `php-fpm` under `local` to monitor the installed stable PHP-FPM services.
|
||||||
The check reports a problem when any of those services is unavailable.
|
The check reports a problem when any of those services is unavailable.
|
||||||
Use `bind9`, `postfix`, `dovecot`, `spamd`, and `spamass-milter` under
|
Use `bind9`, `postfix`, `dovecot`, `rspamd`, `redis`, `spamd`, and
|
||||||
|
`spamass-milter` under
|
||||||
`local` for co-located services or under `ssh` for separate nodes. Only
|
`local` for co-located services or under `ssh` for separate nodes. Only
|
||||||
list the spam filter units where filtering is configured. Update the
|
list the spam filter units where filtering is configured. Update the
|
||||||
Coulobre package on a remote node before adding its filter units. The
|
Coulobre package on a remote node before adding its filter units. The
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
from importlib.metadata import PackageNotFoundError, version
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.views.decorators.cache import never_cache
|
||||||
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from .access import OperatorOnlyMixin
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(never_cache, name="dispatch")
|
||||||
|
class InstallationView(
|
||||||
|
OperatorOnlyMixin, PermissionRequiredMixin, TemplateView
|
||||||
|
):
|
||||||
|
permission_required = "hosting.view_servicehealth"
|
||||||
|
template_name = "hosting/installation.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
try:
|
||||||
|
installed_version = version("coulobre-panel")
|
||||||
|
except PackageNotFoundError:
|
||||||
|
installed_version = "Unavailable"
|
||||||
|
|
||||||
|
features = (
|
||||||
|
("Local website provisioning", settings.LOCAL_WEB_ACTIVATION),
|
||||||
|
("Managed website certificates", settings.LOCAL_WEB_HTTPS),
|
||||||
|
("Website file manager", settings.WEB_FILE_MANAGER),
|
||||||
|
("Website scheduled tasks", settings.WEBSITE_JOBS),
|
||||||
|
("Local DNS publishing", settings.LOCAL_DNS_PUBLISHING),
|
||||||
|
(
|
||||||
|
"Default managed DNS zones for new accounts",
|
||||||
|
settings.LOCAL_DNS_PUBLISHING
|
||||||
|
and settings.HOSTING_NAMESERVERS
|
||||||
|
and settings.HOSTING_PUBLIC_ADDRESSES,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Local mailbox provisioning",
|
||||||
|
settings.LOCAL_MAILBOX_PROVISIONING,
|
||||||
|
),
|
||||||
|
("Managed mail DNS records", settings.MANAGE_MAIL_DNS),
|
||||||
|
(
|
||||||
|
"Local database provisioning",
|
||||||
|
settings.LOCAL_DATABASE_PROVISIONING,
|
||||||
|
),
|
||||||
|
("Local account backups", settings.LOCAL_ACCOUNT_BACKUPS),
|
||||||
|
(
|
||||||
|
"Off-site backup destinations",
|
||||||
|
settings.OFFSITE_BACKUP_DESTINATIONS,
|
||||||
|
),
|
||||||
|
("phpMyAdmin sign-in", settings.PHPMYADMIN_URL),
|
||||||
|
("Roundcube sign-in", settings.ROUNDCUBE_URL),
|
||||||
|
)
|
||||||
|
return super().get_context_data(
|
||||||
|
installed_version=installed_version,
|
||||||
|
features=[
|
||||||
|
(name, bool(configured)) for name, configured in features
|
||||||
|
],
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
let activeHelp;
|
||||||
|
let pinned = false;
|
||||||
|
|
||||||
|
function closeHelp() {
|
||||||
|
if (activeHelp) activeHelp.open = false;
|
||||||
|
activeHelp = undefined;
|
||||||
|
pinned = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function showHelp(help) {
|
||||||
|
if (activeHelp === help) return;
|
||||||
|
closeHelp();
|
||||||
|
help.open = true;
|
||||||
|
activeHelp = help;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const help of document.querySelectorAll("[data-field-help]")) {
|
||||||
|
const summary = help.querySelector("summary");
|
||||||
|
help.addEventListener("pointerenter", (event) => {
|
||||||
|
if (event.pointerType === "mouse" && !pinned) showHelp(help);
|
||||||
|
});
|
||||||
|
help.addEventListener("pointerleave", () => {
|
||||||
|
if (activeHelp === help && !pinned && !summary.matches(":focus-visible")) {
|
||||||
|
closeHelp();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
summary.addEventListener("focus", () => {
|
||||||
|
if (summary.matches(":focus-visible")) showHelp(help);
|
||||||
|
});
|
||||||
|
summary.addEventListener("blur", () => {
|
||||||
|
if (activeHelp === help) closeHelp();
|
||||||
|
});
|
||||||
|
summary.addEventListener("click", (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (activeHelp === help && pinned) {
|
||||||
|
closeHelp();
|
||||||
|
} else {
|
||||||
|
showHelp(help);
|
||||||
|
pinned = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("pointerdown", (event) => {
|
||||||
|
if (activeHelp && !activeHelp.contains(event.target)) closeHelp();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (event.key === "Escape" && activeHelp) closeHelp();
|
||||||
|
});
|
||||||
@@ -273,6 +273,14 @@ button, input, select, textarea {
|
|||||||
linear-gradient(currentColor, currentColor) 75% bottom / 1px 55% no-repeat;
|
linear-gradient(currentColor, currentColor) 75% bottom / 1px 55% no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.nav-icon-information {
|
||||||
|
display: grid;
|
||||||
|
place-content: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.nav-icon-customers {
|
.nav-icon-customers {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 0.46rem;
|
height: 0.46rem;
|
||||||
@@ -720,14 +728,54 @@ dd {
|
|||||||
accent-color: var(--accent);
|
accent-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-help {
|
.plan-field-heading {
|
||||||
padding: 0.65rem 0.75rem;
|
position: relative;
|
||||||
border: 1px solid var(--line);
|
display: flex;
|
||||||
border-radius: var(--radius);
|
align-items: center;
|
||||||
|
gap: 0.35rem;
|
||||||
|
margin-bottom: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-help dt {
|
.plan-field-heading label {
|
||||||
margin-block-start: 0.55rem;
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-help summary {
|
||||||
|
display: grid;
|
||||||
|
width: 1.5rem;
|
||||||
|
height: 1.5rem;
|
||||||
|
place-items: center;
|
||||||
|
border: 1px solid var(--control-line);
|
||||||
|
border-radius: 50%;
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
|
list-style: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-help summary::-webkit-details-marker {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-help summary:hover, .field-help[open] summary {
|
||||||
|
background: var(--control-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-help p {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
inset-block-start: 100%;
|
||||||
|
inset-inline-start: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: min(100%, 25rem);
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.6rem 0.75rem;
|
||||||
|
border: 1px solid var(--control-line);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background: var(--surface);
|
||||||
|
box-shadow: 0 4px 12px var(--surface-shadow);
|
||||||
|
font-size: 0.88rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reseller-editor fieldset {
|
.reseller-editor fieldset {
|
||||||
|
|||||||
@@ -52,8 +52,8 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if group_customer_navigation %}</details>{% endif %}
|
{% if group_customer_navigation %}</details>{% endif %}
|
||||||
{% if is_operator and perms.hosting.view_webprovisioningplan and perms.hosting.view_servicehealth %}
|
{% if is_operator and perms.hosting.view_servicehealth %}
|
||||||
<details class="sidebar-group"{% if panel_section == 'plans' or panel_section == 'service_health' %} open{% endif %}>
|
<details class="sidebar-group"{% if panel_section == 'plans' or panel_section == 'service_health' or panel_section == 'installation' %} open{% endif %}>
|
||||||
<summary>Server and services</summary>
|
<summary>Server and services</summary>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_reseller or is_operator and perms.hosting.view_webprovisioningplan %}
|
{% if is_reseller or is_operator and perms.hosting.view_webprovisioningplan %}
|
||||||
@@ -67,8 +67,12 @@
|
|||||||
<span class="nav-icon nav-icon-health" aria-hidden="true"></span>
|
<span class="nav-icon nav-icon-health" aria-hidden="true"></span>
|
||||||
Service health
|
Service health
|
||||||
</a>
|
</a>
|
||||||
|
<a href="{% url 'panel:installation' %}"{% if current == 'installation' %} aria-current="page"{% endif %}>
|
||||||
|
<span class="nav-icon nav-icon-information" aria-hidden="true">i</span>
|
||||||
|
About Coulobre
|
||||||
|
</a>
|
||||||
|
</details>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if is_operator and perms.hosting.view_webprovisioningplan and perms.hosting.view_servicehealth %}</details>{% endif %}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</nav>
|
</nav>
|
||||||
<div class="sidebar-account">
|
<div class="sidebar-account">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{% extends "hosting/base.html" %}
|
{% extends "hosting/base.html" %}
|
||||||
|
{% load static %}
|
||||||
{% block title %}{{ page_title }} · Coulobre Panel{% endblock %}
|
{% block title %}{{ page_title }} · Coulobre Panel{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<a class="back-link" href="{% url 'panel:hosting_plans' %}">← Hosting plans</a>
|
<a class="back-link" href="{% url 'panel:hosting_plans' %}">← Hosting plans</a>
|
||||||
@@ -6,26 +7,28 @@
|
|||||||
<section class="surface editor-surface">
|
<section class="surface editor-surface">
|
||||||
<form method="post" class="editor">
|
<form method="post" class="editor">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_div }}
|
{{ form.non_field_errors }}
|
||||||
<details class="field-help">
|
{% for field in form.visible_fields %}
|
||||||
<summary>Examples and explanations</summary>
|
<div class="plan-field">
|
||||||
<dl>
|
<div class="plan-field-heading">
|
||||||
<dt>Scheduled tasks per hosting account</dt>
|
{{ field.label_tag }}
|
||||||
<dd>For example, allow up to 10 scripts that run on a schedule, such as a CMS task that runs every 15 minutes.</dd>
|
{% if field.help_text %}
|
||||||
<dt>Website, database and mailbox limits</dt>
|
<details class="field-help" data-field-help>
|
||||||
<dd>The primary site counts toward the website limit. A blank database or mailbox limit allows any number. Zero blocks new requests.</dd>
|
<summary aria-label="Help for {{ field.label }}">?</summary>
|
||||||
<dt>Mailbox and website storage</dt>
|
<p id="{{ field.auto_id }}_helptext">{{ field.help_text }}</p>
|
||||||
<dd>Storage is measured in MiB. Enter 1024 for 1 GiB. The mailbox limit applies to new mailbox requests. The website limit is the default when applying a site quota.</dd>
|
</details>
|
||||||
<dt>Catch-all email</dt>
|
{% endif %}
|
||||||
<dd>Send messages for unknown addresses at a mail domain to a designated mailbox.</dd>
|
</div>
|
||||||
<dt>External mail forwarding</dt>
|
{{ field.errors }}
|
||||||
<dd>Let an alias send a copy of incoming mail to another domain.</dd>
|
{{ field }}
|
||||||
</dl>
|
</div>
|
||||||
</details>
|
{% endfor %}
|
||||||
|
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button class="button primary" type="submit">{{ submit_label }}</button>
|
<button class="button primary" type="submit">{{ submit_label }}</button>
|
||||||
<a class="button secondary" href="{% url 'panel:hosting_plans' %}">Cancel</a>
|
<a class="button secondary" href="{% url 'panel:hosting_plans' %}">Cancel</a>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
<script src="{% static 'hosting/field-help.js' %}" defer></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "hosting/base.html" %}
|
||||||
|
|
||||||
|
{% block title %}About Coulobre · Coulobre Panel{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<header class="page-heading"><h1>About Coulobre</h1></header>
|
||||||
|
<section class="surface" aria-labelledby="installation-heading">
|
||||||
|
<header class="section-heading"><h2 id="installation-heading">Installation</h2></header>
|
||||||
|
<dl class="details">
|
||||||
|
<div><dt>Installed version</dt><dd>{{ installed_version }}</dd></div>
|
||||||
|
<div><dt>Core software license</dt><dd>Apache License 2.0</dd></div>
|
||||||
|
</dl>
|
||||||
|
</section>
|
||||||
|
<section class="surface" aria-labelledby="features-heading">
|
||||||
|
<header class="section-heading">
|
||||||
|
<div>
|
||||||
|
<h2 id="features-heading">Feature configuration</h2>
|
||||||
|
<p class="muted">See <a href="{% url 'panel:service_health' %}">Service health</a> for the latest local and remote checks.</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th scope="col">Feature</th><th scope="col">Configuration</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
{% for name, enabled in features %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{{ name }}</th>
|
||||||
|
<td>{% if enabled %}<span class="status active">Enabled</span>{% else %}Disabled{% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -36,6 +36,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<section class="surface"><p class="empty">No services are configured for health checks.</p></section>
|
<section class="surface">
|
||||||
|
<p class="empty">Set <code>COULOBRE_SERVICE_HEALTH</code> in <code>/etc/coulobre/panel.env</code> and enable <code>coulobre-health.timer</code> to collect service observations.</p>
|
||||||
|
</section>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -25,6 +25,19 @@ class HostingPlanTests(TestCase):
|
|||||||
name="Example hosting", primary_domain="example.org"
|
name="Example hosting", primary_domain="example.org"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_scheduled_task_help_is_associated_with_the_field(self):
|
||||||
|
self.client.force_login(self.operator)
|
||||||
|
response = self.client.get(reverse("panel:hosting_plan_create"))
|
||||||
|
self.assertContains(
|
||||||
|
response, 'aria-describedby="id_website_job_limit_helptext"'
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
'aria-label="Help for Scheduled tasks per hosting account"',
|
||||||
|
)
|
||||||
|
self.assertContains(response, "including paused tasks")
|
||||||
|
self.assertNotContains(response, "Examples and explanations")
|
||||||
|
|
||||||
def test_operator_can_create_assign_and_edit_a_plan(self):
|
def test_operator_can_create_assign_and_edit_a_plan(self):
|
||||||
self.client.force_login(self.operator)
|
self.client.force_login(self.operator)
|
||||||
list_url = reverse("panel:hosting_plans")
|
list_url = reverse("panel:hosting_plans")
|
||||||
|
|||||||
@@ -165,6 +165,37 @@ class ServiceHealthPanelTests(TestCase):
|
|||||||
self.client.force_login(user)
|
self.client.force_login(user)
|
||||||
self.assertEqual(self.client.get(url).status_code, status)
|
self.assertEqual(self.client.get(url).status_code, status)
|
||||||
|
|
||||||
|
@override_settings(
|
||||||
|
LOCAL_DNS_PUBLISHING=True,
|
||||||
|
HOSTING_NAMESERVERS=("ns.example.net",),
|
||||||
|
HOSTING_PUBLIC_ADDRESSES=("192.0.2.20",),
|
||||||
|
ROUNDCUBE_URL="https://webmail.example.net",
|
||||||
|
ROUNDCUBE_BRIDGE_KEY="test-only-bridge-key",
|
||||||
|
)
|
||||||
|
def test_installation_reports_configuration_to_operators(self):
|
||||||
|
url = reverse("panel:installation")
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.get(url), f"{reverse('panel:login')}?next={url}"
|
||||||
|
)
|
||||||
|
for user in (self.viewer, self.customer, self.reseller):
|
||||||
|
with self.subTest(user=user):
|
||||||
|
self.client.force_login(user)
|
||||||
|
self.assertEqual(self.client.get(url).status_code, 403)
|
||||||
|
|
||||||
|
self.client.force_login(self.operator)
|
||||||
|
with patch(
|
||||||
|
"coulobre.hosting.installation_views.version", return_value="1.2.3"
|
||||||
|
):
|
||||||
|
response = self.client.get(url)
|
||||||
|
self.assertContains(response, "1.2.3")
|
||||||
|
self.assertContains(response, "Apache License 2.0")
|
||||||
|
self.assertContains(response, reverse("panel:service_health"))
|
||||||
|
features = dict(response.context["features"])
|
||||||
|
self.assertTrue(features["Default managed DNS zones for new accounts"])
|
||||||
|
self.assertTrue(features["Roundcube sign-in"])
|
||||||
|
self.assertNotContains(response, "test-only-bridge-key")
|
||||||
|
self.assertNotContains(response, "https://webmail.example.net")
|
||||||
|
|
||||||
def test_view_marks_missing_and_old_observations_distinctly(self):
|
def test_view_marks_missing_and_old_observations_distinctly(self):
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
for node, service, result, observed_at in (
|
for node, service, result, observed_at in (
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from .independent_website_views import (
|
|||||||
IndependentWebsiteManifest,
|
IndependentWebsiteManifest,
|
||||||
IndependentWebsiteOperation,
|
IndependentWebsiteOperation,
|
||||||
)
|
)
|
||||||
|
from .installation_views import InstallationView
|
||||||
from .invitations import AcceptInvitation, ManageInvitation
|
from .invitations import AcceptInvitation, ManageInvitation
|
||||||
from .mail_dns_views import MailDnsCheckView, RequestMailDnsSetup
|
from .mail_dns_views import MailDnsCheckView, RequestMailDnsSetup
|
||||||
from .mail_policy_views import MailRoutingEditor, MailVacationEditor
|
from .mail_policy_views import MailRoutingEditor, MailVacationEditor
|
||||||
@@ -67,6 +68,7 @@ urlpatterns = [
|
|||||||
path(
|
path(
|
||||||
"service-health/", ServiceHealthView.as_view(), name="service_health"
|
"service-health/", ServiceHealthView.as_view(), name="service_health"
|
||||||
),
|
),
|
||||||
|
path("about/", InstallationView.as_view(), name="installation"),
|
||||||
path("sign-in/", PanelLoginView.as_view(), name="login"),
|
path("sign-in/", PanelLoginView.as_view(), name="login"),
|
||||||
path(
|
path(
|
||||||
"welcome/<uidb64>/<token>/",
|
"welcome/<uidb64>/<token>/",
|
||||||
|
|||||||
@@ -2233,8 +2233,24 @@ class HostingPlanEditor:
|
|||||||
jobs.label = "Scheduled tasks per hosting account"
|
jobs.label = "Scheduled tasks per hosting account"
|
||||||
jobs.help_text = (
|
jobs.help_text = (
|
||||||
"Counts saved tasks across all websites, including paused tasks. "
|
"Counts saved tasks across all websites, including paused tasks. "
|
||||||
"Enter 0 to disable scheduling."
|
"Enter 0 to disable scheduling. With a limit of 10, a CMS "
|
||||||
|
"task that runs every 15 minutes uses one of the 10 slots."
|
||||||
)
|
)
|
||||||
|
for field in ("mailbox_quota_mib", "website_storage_limit_mib"):
|
||||||
|
form.fields[field].help_text += " Enter 1024 for 1 GiB."
|
||||||
|
php_help = {
|
||||||
|
"php_memory_limit_mib": "Memory a PHP script can use.",
|
||||||
|
"php_upload_limit_mib": "Maximum size of an uploaded file.",
|
||||||
|
"php_request_timeout_seconds": (
|
||||||
|
"How long PHP-FPM lets a request run before stopping it."
|
||||||
|
),
|
||||||
|
"php_max_children": (
|
||||||
|
"How many PHP requests a website can process at once."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
for name, description in php_help.items():
|
||||||
|
field = form.fields[name]
|
||||||
|
field.help_text = f"{description} {field.help_text}"
|
||||||
return form
|
return form
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ SERVICES = {
|
|||||||
"bind9": ("BIND9", "named.service"),
|
"bind9": ("BIND9", "named.service"),
|
||||||
"postfix": ("Postfix", "postfix.service"),
|
"postfix": ("Postfix", "postfix.service"),
|
||||||
"dovecot": ("Dovecot", "dovecot.service"),
|
"dovecot": ("Dovecot", "dovecot.service"),
|
||||||
|
"rspamd": ("Rspamd", "rspamd.service"),
|
||||||
|
"redis": ("Redis", "redis-server.service"),
|
||||||
"spamd": ("SpamAssassin", "spamd.service"),
|
"spamd": ("SpamAssassin", "spamd.service"),
|
||||||
"spamass-milter": ("SpamAssassin milter", "spamass-milter.service"),
|
"spamass-milter": ("SpamAssassin milter", "spamass-milter.service"),
|
||||||
"firewall": ("Coulobre firewall", "coulobre-firewall.service"),
|
"firewall": ("Coulobre firewall", "coulobre-firewall.service"),
|
||||||
@@ -38,6 +40,8 @@ REMOTE_SERVICES = (
|
|||||||
"bind9",
|
"bind9",
|
||||||
"postfix",
|
"postfix",
|
||||||
"dovecot",
|
"dovecot",
|
||||||
|
"rspamd",
|
||||||
|
"redis",
|
||||||
"spamd",
|
"spamd",
|
||||||
"spamass-milter",
|
"spamass-milter",
|
||||||
"firewall",
|
"firewall",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import json
|
||||||
import stat
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
@@ -12,6 +13,7 @@ from deploy.panel_installer.config import (
|
|||||||
read_password,
|
read_password,
|
||||||
read_plan,
|
read_plan,
|
||||||
)
|
)
|
||||||
|
from deploy.panel_installer.engine import Installer
|
||||||
from deploy.panel_installer.web import Wizard, WizardHandler, form_plan
|
from deploy.panel_installer.web import Wizard, WizardHandler, form_plan
|
||||||
|
|
||||||
PROXY = {
|
PROXY = {
|
||||||
@@ -24,6 +26,53 @@ ADMIN = {"username": "operator", "email": "ops@example.net"}
|
|||||||
|
|
||||||
|
|
||||||
class InstallerParametersTests(unittest.TestCase):
|
class InstallerParametersTests(unittest.TestCase):
|
||||||
|
def test_default_health_targets_follow_locally_installed_roles(self):
|
||||||
|
cases = (
|
||||||
|
({}, None, []),
|
||||||
|
(
|
||||||
|
{
|
||||||
|
"dns": {"mode": "local"},
|
||||||
|
"mail": {
|
||||||
|
"mode": "local",
|
||||||
|
"host": "panel.example.net",
|
||||||
|
"tls": "acme",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"8.5",
|
||||||
|
["php-fpm", "bind9", "postfix", "dovecot", "rspamd", "redis"],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for roles, php, extras in cases:
|
||||||
|
with (
|
||||||
|
self.subTest(roles=roles),
|
||||||
|
patch(
|
||||||
|
"deploy.panel_installer.engine.platform_settings",
|
||||||
|
return_value=(php, True),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
plan = parse_plan({"panel": PROXY, "admin": ADMIN, **roles})
|
||||||
|
installer = Installer(plan, "test-only", Mock())
|
||||||
|
installer.state = dict.fromkeys(
|
||||||
|
("secret_key", "database_password", "broker_password"),
|
||||||
|
"test-only",
|
||||||
|
)
|
||||||
|
env = dict(
|
||||||
|
line.split("=", 1)
|
||||||
|
for line in installer.environment().splitlines()
|
||||||
|
)
|
||||||
|
base = [
|
||||||
|
"panel",
|
||||||
|
"worker",
|
||||||
|
"scheduler",
|
||||||
|
"apache",
|
||||||
|
"mariadb",
|
||||||
|
"rabbitmq",
|
||||||
|
]
|
||||||
|
self.assertEqual(
|
||||||
|
json.loads(env["COULOBRE_SERVICE_HEALTH"]),
|
||||||
|
{"panel": {"local": base + extras}},
|
||||||
|
)
|
||||||
|
|
||||||
def test_interactive_export_reuses_the_same_plan(self):
|
def test_interactive_export_reuses_the_same_plan(self):
|
||||||
plan = parse_plan(
|
plan = parse_plan(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user