diff --git a/docs/deployment.md b/docs/deployment.md index ddb5e27..b8a5782 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -3728,6 +3728,14 @@ then the secondary query IP, separated by a comma. Restart the panel and select **Check replication** from a DNS zone to compare live authoritative SOA serials. +**Connected Nodes** shows separately the primary publisher and the secondary +transfer address reported from a Coulobre-managed primary. For an older +primary that does not report its catalog configuration, the panel uses the +configured replication addresses if present. It does not infer a managed +secondary from public NS records. The address report alone cannot verify +the secondary's release or service health, which are shown as unchecked. +Use **Check replication** to verify zone answers and confirm transfer health. + ## Enable local operator actions The operator action worker handles allowlisted service reloads and restarts, diff --git a/src/coulobre/hosting/connected_inventory.py b/src/coulobre/hosting/connected_inventory.py new file mode 100644 index 0000000..d3dedc2 --- /dev/null +++ b/src/coulobre/hosting/connected_inventory.py @@ -0,0 +1,59 @@ +"""Show configured service roles separately from health observations.""" + +from ipaddress import ip_address + +ROLE_LABELS = { + "dns": "DNS primary", + "dns-secondary": "DNS secondary", + "mail": "Mail", +} + + +def host_key(host): + try: + return str(ip_address(host)) + except ValueError: + return host.removesuffix(".").lower() + + +def inventory_rows(nodes, replication_addresses): + rows = {} + secondaries = [] + observed_primary = False + + def add(host, role, release=None, state="not checked", *, local=False): + key = host_key(host) + row = rows.setdefault( + key, {"host": key, "local": False, "services": {}} + ) + row["local"] |= local + row["services"].setdefault( + role, + {"role": ROLE_LABELS[role], "release": release, "state": state}, + ) + + for node in nodes: + role = node["role"] + host = node["host"] + add( + host, + role, + node.get("release"), + node.get("state") or "unavailable", + local=node.get("local", False), + ) + if role == "dns": + observed_primary = True + peer = node.get("dns_secondary") + if peer and host_key(peer) != host_key(host): + secondaries.append(peer) + if not secondaries and replication_addresses: + primary, secondary = map(str, replication_addresses) + if not observed_primary: + add(primary, "dns") + secondaries.append(secondary) + for host in secondaries: + row = rows.get(host_key(host)) + if row is None or "dns" not in row["services"]: + add(host, "dns-secondary") + return rows.values() diff --git a/src/coulobre/hosting/operator_tools.py b/src/coulobre/hosting/operator_tools.py index b99bd1d..0641dec 100644 --- a/src/coulobre/hosting/operator_tools.py +++ b/src/coulobre/hosting/operator_tools.py @@ -26,9 +26,14 @@ from coulobre.operator_node import ( from coulobre.release_updates import UpdateError from .account_administration import OperatorAuthorization +from .connected_inventory import inventory_rows from .models import OperatorOperation from .tasks import OPERATOR_OPERATION_LEASE, run_operator_operation -from .update_views import inspect_linked_nodes, request_updater +from .update_views import ( + inspect_linked_nodes, + inspect_node_inventory, + request_updater, +) ACTION_LABELS = { "package-preview": "Check for package updates", @@ -274,8 +279,16 @@ class ConnectedNodesView(OperatorAuthorization, TemplateView): template_name = "hosting/connected_nodes.html" def get_context_data(self, **kwargs): + topology = inspect_node_inventory() + nodes = inventory_rows( + topology.get("nodes", []), settings.DNS_REPLICATION_ADDRESSES + ) return super().get_context_data( - topology=inspect_linked_nodes(), + topology=topology, + nodes=nodes, + has_secondary=any( + "dns-secondary" in node["services"] for node in nodes + ), deploy_enabled=remote_deployment.SOCKET.is_socket(), peering_available=bool(settings.PASSWORD_RESET_ORIGIN), **kwargs, diff --git a/src/coulobre/hosting/templates/hosting/connected_nodes.html b/src/coulobre/hosting/templates/hosting/connected_nodes.html index d27fea0..3b0b536 100644 --- a/src/coulobre/hosting/templates/hosting/connected_nodes.html +++ b/src/coulobre/hosting/templates/hosting/connected_nodes.html @@ -1,6 +1,7 @@ {% extends "hosting/workspace_page.html" %} {% block title %}Connected Nodes ยท Coulobre Panel{% endblock %} {% block page_title %}Connected Nodes{% endblock %} +{% block page_metadata %}
{% endblock %} {% block page_actions %} {% if deploy_enabled %}Install a remote server{% endif %} {% if peering_available %}Enrolled panels{% endif %} @@ -8,11 +9,16 @@ {% endblock %} {% block page_content %} {% if topology.problem %}{{ topology.problem }}
{% endif %} -| Role | Host | Release | State |
|---|---|---|---|
| {{ node.role|upper }} | {{ node.host }} | {{ node.release|default:"Unknown" }} | {{ node.state|capfirst }} |
| No linked mail or DNS receivers reported. | |||
| Host | Role | Observed release | State |
{{ node.host }}{% if node.local %}This panel {% endif %} |
+ {% for service in node.services.values %} {{ service.role }} {% endfor %} |
+ {% for service in node.services.values %} {{ service.release|default:"Unknown" }} {% endfor %} |
+ {% for service in node.services.values %} {{ service.state|capfirst }} {% endfor %} |
+
| No mail or DNS service nodes reported. | |||
A secondary can be listed before its release or replication status has been checked. Use Check replication on a DNS zone to compare authoritative answers.
{% endif %}