ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat: make the ingress-plane boundary explicit (host Nginx vs proxy stack)
Juan Denis0e71ab346add
diff --git a/backend/app/api/apps.py b/backend/app/api/apps.pyindex 099bd4c6..c1e9e59f 100644--- a/backend/app/api/apps.py+++ b/backend/app/api/apps.py@@ -458,6 +458,18 @@ def _resolve_project_env(data, workspace_id):return project.id, environment_id+def _resolve_ingress_plane(data, app_type, managed_by=None):+ """Resolve the ingress plane ('nginx' | 'proxy_stack') for a new app.++ Defaults to host Nginx. A requested 'proxy_stack' is only honored for+ container-based services; for every other type it falls back to nginx, so+ the boundary between the two reverse proxies stays explicit and a PHP/+ WordPress/static/Python app can never be tagged for a Dockerized proxy.+ """+ from app.utils.ingress import normalize_ingress_plane+ return normalize_ingress_plane(data.get('ingress_plane'), app_type, managed_by)++def _can_access_app(user, app):"""Read access (#33 ACL) — delegates to the shared seam."""from app.services.resource_grant_service import ResourceGrantService@@ -686,6 +698,7 @@ def create_app_from_repository():buildpack_type=buildpack_type,buildpack_plan=json.dumps(buildpack_plan) if buildpack_plan else None,buildpack_overrides=json.dumps(buildpack_overrides) if buildpack_overrides else None,+ ingress_plane=_resolve_ingress_plane(data, resolved_app_type),project_id=project_id,environment_id=environment_id,)@@ -790,6 +803,7 @@ def create_app():compose_file=data.get('compose_file'),systemd_unit=data.get('systemd_unit'),managed_by=data.get('managed_by'),+ ingress_plane=_resolve_ingress_plane(data, app_type, data.get('managed_by')),user_id=current_user_id,workspace_id=ws_id,project_id=project_id,@@ -873,6 +887,7 @@ def create_manual_app():compose_file=compose_file,systemd_unit=systemd_unit,managed_by=managed_by,+ ingress_plane=_resolve_ingress_plane(data, app_type, managed_by),user_id=current_user_id,workspace_id=ws_id,project_id=project_id,@@ -991,6 +1006,10 @@ def upload_app_archive():root_path=current_dir,compose_file=compose_file,managed_by='docker_compose' if detected == 'docker' else None,+ ingress_plane=_resolve_ingress_plane(+ request.form, detected,+ 'docker_compose' if detected == 'docker' else None,+ ),version=new_version,upload_path=upload_archive_path,user_id=current_user_id,diff --git a/backend/app/api/proxy.py b/backend/app/api/proxy.pyindex d49c0156..88f00335 100644--- a/backend/app/api/proxy.py+++ b/backend/app/api/proxy.py@@ -51,6 +51,21 @@ def get_proxy(server_id):return jsonify(ProxyStackService.status(server_id))+@proxy_bp.route('/<server_id>/proxy/ingress-audit', methods=['GET'])+@jwt_required()+def ingress_audit(server_id):+ """Which of a server's apps disagree with its configured proxy mode.++ Returns the expected ingress plane for the server plus a per-app list with+ a ``mismatch`` flag, so the UI can warn when host-Nginx apps are running on+ a server whose active proxy is a Dockerized stack (or vice versa).+ """+ _, err = _require_server(server_id)+ if err:+ return err+ return jsonify(ProxyStackService.ingress_audit(server_id))++@proxy_bp.route('/<server_id>/proxy/compose-preview', methods=['GET'])@jwt_required()def compose_preview(server_id):diff --git a/backend/app/models/application.py b/backend/app/models/application.pyindex 4d25a429..eb0519cc 100644--- a/backend/app/models/application.py+++ b/backend/app/models/application.py@@ -7,6 +7,10 @@ from app import db# FK targets resolvable regardless of import order.from app.models import project as _project # noqa: F401from app.models import environment as _environment # noqa: F401+from app.utils.ingress import (+ default_ingress_plane as _default_ingress_plane,+ proxy_eligible as _proxy_eligible,+)class Application(db.Model):@@ -43,6 +47,11 @@ class Application(db.Model):systemd_unit = db.Column(db.String(100), nullable=True)managed_by = db.Column(db.String(20), nullable=True) # 'docker_compose', 'systemd'+ # Ingress plane: which reverse proxy is expected to serve this app —+ # 'nginx' (host Nginx, the default) or 'proxy_stack' (Dockerized+ # Traefik/Caddy). NULL is treated as the default. See app/utils/ingress.py.+ ingress_plane = db.Column(db.String(20), nullable=True)+# Upload versioningversion = db.Column(db.Integer, default=0, nullable=False)upload_path = db.Column(db.String(500), nullable=True)@@ -98,6 +107,8 @@ class Application(db.Model):'compose_file': self.compose_file,'systemd_unit': self.systemd_unit,'managed_by': self.managed_by,+ 'ingress_plane': self.ingress_plane or _default_ingress_plane(self.app_type, self.managed_by),+ 'ingress_proxy_eligible': _proxy_eligible(self.app_type, self.managed_by),'version': self.version,'upload_path': self.upload_path,'private_slug': self.private_slug,diff --git a/backend/app/services/proxy_stack_service.py b/backend/app/services/proxy_stack_service.pyindex eb1e0e88..788b4faf 100644--- a/backend/app/services/proxy_stack_service.py+++ b/backend/app/services/proxy_stack_service.py@@ -512,20 +512,30 @@ class ProxyStackService:except Exception as e: # pragma: no cover - DB guardlogger.warning(f"fleet_overview stack query failed: {e}")+ # One query for every server-bound app, grouped by server, so each row+ # can report how many of its apps disagree with the server's proxy mode.+ apps_by_server = ProxyStackService._apps_by_server()+overview = []for server in servers:stack = stacks_by_server.get(server.id)+ proxy_type = (stack.proxy_type if stack else 'nginx') or 'nginx'+ app_count, mismatch_count = ProxyStackService._ingress_counts(+ proxy_type, apps_by_server.get(server.id, [])+ )if stack is not None:overview.append({'server_id': server.id,'server_name': server.name,- 'proxy_type': stack.proxy_type or 'nginx',+ 'proxy_type': proxy_type,'status': stack.status or 'unknown','last_regenerated_at': (stack.last_regenerated_at.isoformat()if stack.last_regenerated_at else None),'networks_count': len(stack.networks_list()),+ 'app_count': app_count,+ 'mismatch_count': mismatch_count,})else:# No managed stack → host nginx is in charge. 'host' is a@@ -538,10 +548,98 @@ class ProxyStackService:'status': 'host','last_regenerated_at': None,'networks_count': 0,+ 'app_count': app_count,+ 'mismatch_count': mismatch_count,})return overview+ # ------------------------------------------------------------------+ # Ingress-plane reconciliation (which proxy is expected to serve an app)+ # ------------------------------------------------------------------++ @staticmethod+ def _apps_by_server():+ """Map server_id -> [Application] for every server-bound app. Guarded."""+ grouped = {}+ try:+ from app.models.application import Application+ apps = Application.query.filter(Application.server_id.isnot(None)).all()+ except Exception as e: # pragma: no cover - DB guard+ logger.warning(f"_apps_by_server query failed: {e}")+ return grouped+ for app in apps:+ grouped.setdefault(app.server_id, []).append(app)+ return grouped++ @staticmethod+ def _ingress_counts(proxy_type, apps):+ """(app_count, mismatch_count) for a server's apps vs its proxy mode."""+ from app.utils.ingress import expected_plane_for_proxy, default_ingress_plane+ expected = expected_plane_for_proxy(proxy_type)+ mismatches = 0+ for app in apps:+ plane = app.ingress_plane or default_ingress_plane(app.app_type, app.managed_by)+ if plane != expected:+ mismatches += 1+ return len(apps), mismatches++ @staticmethod+ def ingress_audit(server_id):+ """Per-server ingress reconciliation: which apps disagree with the+ server's configured proxy mode.++ A host can only run one ingress plane on 80/443, so an app tagged for+ the *other* plane than the server's active proxy would either be+ unreachable or collide. This surfaces those so the operator can fix the+ boundary (move the app, or switch the server's proxy). Best-effort.+ """+ from app.utils.ingress import expected_plane_for_proxy, default_ingress_plane++ server = None+ proxy_type = 'nginx'+ apps = []+ try:+ from app.models.server import Server+ from app.models.proxy_stack import ProxyStack+ from app.models.application import Application+ server = Server.query.get(server_id)+ stack = ProxyStack.query.filter_by(server_id=server_id).first()+ proxy_type = (stack.proxy_type if stack else 'nginx') or 'nginx'+ apps = Application.query.filter_by(server_id=server_id).all()+ except Exception as e: # pragma: no cover - DB guard+ logger.warning(f"ingress_audit query failed: {e}")++ expected = expected_plane_for_proxy(proxy_type)+ rows = []+ mismatches = 0+ for app in apps:+ plane = app.ingress_plane or default_ingress_plane(app.app_type, app.managed_by)+ mismatch = plane != expected+ if mismatch:+ mismatches += 1+ rows.append({+ 'id': app.id,+ 'name': app.name,+ 'app_type': app.app_type,+ 'ingress_plane': plane,+ 'mismatch': mismatch,+ 'reason': (+ f"App expects '{plane}' but this server's proxy is "+ f"'{proxy_type}' (expects '{expected}')."+ ) if mismatch else None,+ })++ return {+ 'server_id': server_id,+ 'server_name': server.name if server else None,+ 'proxy_type': proxy_type,+ 'expected_plane': expected,+ 'app_count': len(apps),+ 'mismatch_count': mismatches,+ 'apps': rows,+ }+@staticmethoddef status(server_id):"""Best-effort runtime status of the proxy stack.diff --git a/backend/app/utils/ingress.py b/backend/app/utils/ingress.pynew file mode 100644index 00000000..e6318eaf--- /dev/null+++ b/backend/app/utils/ingress.py@@ -0,0 +1,66 @@+"""Ingress plane — which reverse proxy is expected to serve an app.++ServerKit runs two ingress planes that both bind the public ports (80/443):++ * ``nginx`` — the host Nginx (the default; superior for PHP/WordPress+ /static and Python-behind-gunicorn).+ * ``proxy_stack`` — an opt-in Dockerized proxy (Traefik/Caddy) per server.++A host can only run one of them on 80/443 at a time, so pointing the same+domain at both is an operational footgun. Tagging each app with the plane it+expects keeps the boundary explicit and lets the UI warn when a server's+configured proxy disagrees with the apps running on it.++These helpers are pure (no DB / no I/O) so they are trivially unit-testable and+safe to import anywhere.+"""++INGRESS_NGINX = 'nginx'+INGRESS_PROXY = 'proxy_stack'+INGRESS_PLANES = (INGRESS_NGINX, INGRESS_PROXY)++# Container-based services can be routed by a Dockerized proxy stack. Everything+# else — PHP, WordPress, static sites, Python/gunicorn — is served by the host+# Nginx and is NOT eligible for the proxy stack.+PROXY_ELIGIBLE_APP_TYPES = frozenset({'docker'})+++def proxy_eligible(app_type, managed_by=None):+ """True if an app of this type can be served by a Dockerized proxy stack."""+ if (app_type or '').lower() in PROXY_ELIGIBLE_APP_TYPES:+ return True+ return (managed_by or '').lower() == 'docker_compose'+++def default_ingress_plane(app_type=None, managed_by=None):+ """Default ingress plane for a new app.++ Always the host Nginx — the proxy stack is strictly opt-in, even for+ eligible (container) apps. This keeps the default create flow on Nginx for+ every app type, as intended.+ """+ return INGRESS_NGINX+++def normalize_ingress_plane(value, app_type, managed_by=None):+ """Coerce a requested ingress plane to a valid one for this app type.++ - Unknown / empty -> the default plane.+ - ``proxy_stack`` requested for a non-eligible type -> falls back to+ ``nginx`` (you can't route a PHP/WordPress/static/Python app through a+ container proxy stack here).+ """+ plane = (value or '').lower()+ if plane not in INGRESS_PLANES:+ return default_ingress_plane(app_type, managed_by)+ if plane == INGRESS_PROXY and not proxy_eligible(app_type, managed_by):+ return INGRESS_NGINX+ return plane+++def expected_plane_for_proxy(proxy_type):+ """Given a server's active proxy type, the plane its apps should use.++ Host nginx -> ``nginx``; a stack proxy (traefik/caddy) -> ``proxy_stack``.+ """+ return INGRESS_NGINX if (proxy_type or 'nginx').lower() == 'nginx' else INGRESS_PROXYdiff --git a/backend/migrations/versions/035_app_ingress_plane.py b/backend/migrations/versions/035_app_ingress_plane.pynew file mode 100644index 00000000..6d227800--- /dev/null+++ b/backend/migrations/versions/035_app_ingress_plane.py@@ -0,0 +1,42 @@+"""App ingress plane.++Adds:+- applications.ingress_plane ('nginx' | 'proxy_stack', NULL = default nginx)++Makes the reverse-proxy boundary explicit per app so the UI can warn when a+server's configured proxy stack disagrees with the apps running on it.++Idempotent: MigrationService runs _fix_missing_columns() + db.create_all() on boot+before Alembic, so guard on the live schema.++Revision ID: 035_app_ingress_plane+Revises: 034_proxy_stacks+Create Date: 2026-06-23+"""+from alembic import op+import sqlalchemy as sa++revision = '035_app_ingress_plane'+down_revision = '034_proxy_stacks'+branch_labels = None+depends_on = None+++def upgrade():+ conn = op.get_bind()+ inspector = sa.inspect(conn)+ existing = set(inspector.get_table_names())+ if 'applications' in existing:+ cols = {c['name'] for c in inspector.get_columns('applications')}+ if 'ingress_plane' not in cols:+ op.add_column('applications', sa.Column('ingress_plane', sa.String(20), nullable=True))+++def downgrade():+ conn = op.get_bind()+ inspector = sa.inspect(conn)+ existing = set(inspector.get_table_names())+ if 'applications' in existing:+ cols = {c['name'] for c in inspector.get_columns('applications')}+ if 'ingress_plane' in cols:+ op.drop_column('applications', 'ingress_plane')diff --git a/backend/tests/test_fleet_proxy.py b/backend/tests/test_fleet_proxy.pyindex 8f065f97..ae9d7678 100644--- a/backend/tests/test_fleet_proxy.py+++ b/backend/tests/test_fleet_proxy.py@@ -43,11 +43,13 @@ def test_fleet_overview_one_row_per_server(app):ids = {row['server_id'] for row in overview}assert ids == {sid_a, sid_b, sid_c}- # Each row carries the expected flat shape.+ # Each row carries the expected flat shape (incl. ingress reconciliation+ # counts so the dashboard can flag apps that disagree with the proxy).row = overview[0]assert set(row.keys()) == {'server_id', 'server_name', 'proxy_type', 'status','last_regenerated_at', 'networks_count',+ 'app_count', 'mismatch_count',}diff --git a/backend/tests/test_ingress_plane.py b/backend/tests/test_ingress_plane.pynew file mode 100644index 00000000..bb0e529d--- /dev/null+++ b/backend/tests/test_ingress_plane.py@@ -0,0 +1,121 @@+"""Ingress-plane boundary: defaults, eligibility, and proxy/app mismatch audit."""+import pytest++from app.utils.ingress import (+ INGRESS_NGINX, INGRESS_PROXY,+ proxy_eligible, default_ingress_plane, normalize_ingress_plane,+ expected_plane_for_proxy,+)+++# ---- pure helpers -------------------------------------------------------++def test_default_plane_is_always_nginx():+ for t in ('php', 'wordpress', 'static', 'flask', 'django', 'docker'):+ assert default_ingress_plane(t) == INGRESS_NGINX+++def test_only_container_apps_are_proxy_eligible():+ assert proxy_eligible('docker') is True+ assert proxy_eligible('php') is False+ assert proxy_eligible('wordpress') is False+ assert proxy_eligible('static') is False+ assert proxy_eligible('flask') is False+ # compose-managed non-docker app type is still eligible+ assert proxy_eligible('generic', managed_by='docker_compose') is True+++def test_normalize_rejects_proxy_for_ineligible_types():+ # WordPress/PHP/static can never be tagged for the proxy stack+ assert normalize_ingress_plane('proxy_stack', 'wordpress') == INGRESS_NGINX+ assert normalize_ingress_plane('proxy_stack', 'php') == INGRESS_NGINX+ assert normalize_ingress_plane('proxy_stack', 'static') == INGRESS_NGINX+ # Docker can opt in+ assert normalize_ingress_plane('proxy_stack', 'docker') == INGRESS_PROXY+ # Unknown / empty -> default nginx+ assert normalize_ingress_plane('', 'docker') == INGRESS_NGINX+ assert normalize_ingress_plane('bogus', 'docker') == INGRESS_NGINX+ assert normalize_ingress_plane(None, 'docker') == INGRESS_NGINX+++def test_expected_plane_for_proxy():+ assert expected_plane_for_proxy('nginx') == INGRESS_NGINX+ assert expected_plane_for_proxy(None) == INGRESS_NGINX+ assert expected_plane_for_proxy('traefik') == INGRESS_PROXY+ assert expected_plane_for_proxy('caddy') == INGRESS_PROXY+++# ---- DB-backed audit ----------------------------------------------------++def _make_server(app, name='srv'):+ from app import db+ from app.models.server import Server+ s = Server(name=name, status='online')+ db.session.add(s)+ db.session.commit()+ return s+++def _make_app(server_id, app_type='docker', ingress_plane=None, name='a'):+ from app import db+ from app.models.application import Application+ a = Application(+ name=name, app_type=app_type, status='running',+ server_id=server_id, user_id=1, ingress_plane=ingress_plane,+ )+ db.session.add(a)+ db.session.commit()+ return a+++def test_audit_no_mismatch_on_default_nginx_server(app):+ from app.services.proxy_stack_service import ProxyStackService+ with app.app_context():+ s = _make_server(app, 'nginx-srv')+ _make_app(s.id, 'wordpress') # nginx plane (default)+ _make_app(s.id, 'docker') # nginx plane (default — opt-in only)+ audit = ProxyStackService.ingress_audit(s.id)+ assert audit['proxy_type'] == 'nginx'+ assert audit['expected_plane'] == INGRESS_NGINX+ assert audit['app_count'] == 2+ assert audit['mismatch_count'] == 0+++def test_audit_flags_nginx_app_on_proxy_server(app):+ from app.services.proxy_stack_service import ProxyStackService+ with app.app_context():+ s = _make_server(app, 'traefik-srv')+ ProxyStackService.switch(s.id, 'traefik') # server now expects proxy_stack+ wp = _make_app(s.id, 'wordpress', name='wp') # expects nginx -> mismatch+ svc = _make_app(s.id, 'docker', ingress_plane='proxy_stack', name='svc') # matches+ audit = ProxyStackService.ingress_audit(s.id)+ assert audit['expected_plane'] == INGRESS_PROXY+ assert audit['app_count'] == 2+ assert audit['mismatch_count'] == 1+ by_name = {r['name']: r for r in audit['apps']}+ assert by_name['wp']['mismatch'] is True+ assert by_name['wp']['reason']+ assert by_name['svc']['mismatch'] is False+++def test_fleet_overview_reports_mismatch_counts(app):+ from app.services.proxy_stack_service import ProxyStackService+ with app.app_context():+ s = _make_server(app, 'fleet-srv')+ ProxyStackService.switch(s.id, 'caddy')+ _make_app(s.id, 'php', name='php-site') # nginx plane on a caddy server -> mismatch+ rows = {r['server_id']: r for r in ProxyStackService.fleet_overview()}+ row = rows[s.id]+ assert row['proxy_type'] == 'caddy'+ assert row['app_count'] == 1+ assert row['mismatch_count'] == 1+++def test_audit_endpoint_resolves(app, client, auth_headers):+ with app.app_context():+ s = _make_server(app, 'ep-srv')+ sid = s.id # capture before the context (and the row) detaches+ res = client.get(f'/api/v1/servers/{sid}/proxy/ingress-audit', headers=auth_headers)+ assert res.status_code == 200+ body = res.get_json()+ assert 'expected_plane' in body and 'apps' in bodydiff --git a/frontend/src/components/proxy/ProxyStackPanel.jsx b/frontend/src/components/proxy/ProxyStackPanel.jsxindex a34cfd74..23c09841 100644--- a/frontend/src/components/proxy/ProxyStackPanel.jsx+++ b/frontend/src/components/proxy/ProxyStackPanel.jsx@@ -1,11 +1,18 @@import React, { useState, useEffect, useCallback } from 'react';+import { Link } from 'react-router-dom';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';import { Button } from '@/components/ui/button';import { Textarea } from '@/components/ui/textarea';import { Pill, SegControl } from '../ds';import EmptyState from '../EmptyState';-import { Network } from 'lucide-react';+import { AlertTriangle, CheckCircle2, Network } from 'lucide-react';++// Human label for an ingress plane, used in the mismatch banner copy.+const PLANE_LABEL = {+ nginx: 'host Nginx',+ proxy_stack: 'the proxy stack',+};// Managed reverse-proxy stack panel for a server.//@@ -40,6 +47,10 @@ const ProxyStackPanel = ({ serverId }) => {const [preview, setPreview] = useState(null);const [busy, setBusy] = useState(false);+ // Ingress-plane audit: which apps expect a plane that disagrees with the+ // server's active proxy. Refreshed on mount and after any proxy mutation.+ const [audit, setAudit] = useState(null);+const load = useCallback(async () => {setLoading(true);try {@@ -59,6 +70,22 @@ const ProxyStackPanel = ({ serverId }) => {load();}, [load]);+ // Best-effort ingress-plane audit. Never blocks the panel; on failure the+ // banner simply stays hidden.+ const loadAudit = useCallback(async () => {+ try {+ const data = await api.getServerIngressAudit(serverId);+ setAudit(data);+ } catch (err) {+ console.error('Failed to load ingress audit:', err);+ setAudit(null);+ }+ }, [serverId]);++ useEffect(() => {+ loadAudit();+ }, [loadAudit]);+// Refresh the compose preview whenever the selected type changes.const loadPreview = useCallback(async (proxyType) => {try {@@ -83,6 +110,7 @@ const ProxyStackPanel = ({ serverId }) => {await api.switchServerProxy(serverId, selectedType);toast.success(`Switched to ${selectedType}`);await load();+ await loadAudit();} catch (err) {toast.error(err.message || 'Failed to switch proxy');} finally {@@ -113,6 +141,7 @@ const ProxyStackPanel = ({ serverId }) => {toast.error(res.error || 'Regenerate failed');}await load();+ await loadAudit();} catch (err) {toast.error(err.message || 'Failed to regenerate config');} finally {@@ -134,6 +163,7 @@ const ProxyStackPanel = ({ serverId }) => {toast.success('Stack deployed');}await load();+ await loadAudit();} catch (err) {toast.error(err.message || 'Failed to deploy stack');} finally {@@ -177,6 +207,39 @@ const ProxyStackPanel = ({ serverId }) => {opt into a Dockerized Traefik or Caddy proxy deployed as a Compose stack.</p>+ {audit && audit.mismatch_count > 0 && (+ <div className="proxy-panel__ingress-warning" role="alert">+ <div className="proxy-panel__ingress-warning-head">+ <AlertTriangle size={16} />+ <strong>+ {audit.mismatch_count} app{audit.mismatch_count === 1 ? '' : 's'} on the wrong ingress plane+ </strong>+ </div>+ <p className="proxy-panel__ingress-warning-text">+ This server's active proxy is <strong>{audit.proxy_type}</strong>, which+ expects <strong>{PLANE_LABEL[audit.expected_plane] || audit.expected_plane}</strong>.+ The apps below expect the other plane:+ </p>+ <ul className="proxy-panel__ingress-list">+ {(audit.apps || []).filter(a => a.mismatch).map(a => (+ <li key={a.id} className="proxy-panel__ingress-item">+ <Link to={`/apps/${a.id}`} className="proxy-panel__ingress-link">+ {a.name}+ </Link>+ {a.reason && <span className="proxy-panel__ingress-reason">{a.reason}</span>}+ </li>+ ))}+ </ul>+ </div>+ )}++ {audit && audit.mismatch_count === 0 && audit.app_count > 0 && (+ <div className="proxy-panel__ingress-ok">+ <CheckCircle2 size={14} />+ All {audit.app_count} app{audit.app_count === 1 ? '' : 's'} aligned with this server's ingress plane.+ </div>+ )}+<section className="proxy-panel__section"><label className="proxy-panel__label">Proxy type</label><SegControldiff --git a/frontend/src/pages/ApplicationDetail.jsx b/frontend/src/pages/ApplicationDetail.jsxindex d86de6fd..971bdfaf 100644--- a/frontend/src/pages/ApplicationDetail.jsx+++ b/frontend/src/pages/ApplicationDetail.jsx@@ -38,6 +38,14 @@ const STATUS_PILL = {failed: 'red',};+// Ingress plane → label + Pill kind. Host Nginx is the neutral default;+// a managed proxy stack reads as the accent (cyan) choice. NULL/undefined+// reads as host Nginx, matching the backend.+const INGRESS_META = {+ proxy_stack: { label: 'Proxy stack', kind: 'cyan' },+ nginx: { label: 'Nginx', kind: 'gray' },+};+const ApplicationDetail = () => {const { id } = useParams();const navigate = useNavigate();@@ -125,6 +133,7 @@ const ApplicationDetail = () => {const isRunning = app.status === 'running';const typeInfo = getServiceType(app.app_type);const statusInfo = getStatusConfig(app.status);+ const ingressMeta = INGRESS_META[app.ingress_plane] || INGRESS_META.nginx;return (<div className="page-container app-detail-page">@@ -190,6 +199,7 @@ const ApplicationDetail = () => {<h1>{app.name}<Pill kind={STATUS_PILL[statusInfo.dotClass] || 'gray'}>{statusInfo.label}</Pill>+ <Pill kind={ingressMeta.kind} dot={false}>{ingressMeta.label}</Pill>{app.environment_type && app.environment_type !== 'standalone' && (<EnvTag env={app.environment_type}>{app.environment_type === 'production' ? 'PROD' :diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsxindex abb983fb..72e9d06c 100644--- a/frontend/src/pages/FleetProxy.jsx+++ b/frontend/src/pages/FleetProxy.jsx@@ -1,6 +1,6 @@import { useState, useEffect, useCallback, useMemo } from 'react';import { Link } from 'react-router-dom';-import { Network, RefreshCw, Server as ServerIcon } from 'lucide-react';+import { AlertTriangle, Boxes, Network, RefreshCw, Server as ServerIcon } from 'lucide-react';import api from '../services/api';import { useToast } from '../contexts/ToastContext';import { useTopbarActions } from '@/hooks/useTopbarActions';@@ -85,27 +85,39 @@ const FleetProxy = () => {</Button>), [loading]);- // Summary counts by proxy type for the header.+ // Summary counts by proxy type for the header, plus fleet-wide app and+ // ingress-mismatch totals (each server row carries app_count / mismatch_count).const summary = useMemo(() => {- const counts = { total: rows.length, nginx: 0, traefik: 0, caddy: 0 };+ const counts = { total: rows.length, nginx: 0, traefik: 0, caddy: 0, apps: 0, mismatches: 0 };rows.forEach((row) => {const type = row.proxy_type || 'nginx';if (counts[type] != null) counts[type] += 1;+ counts.apps += row.app_count || 0;+ counts.mismatches += row.mismatch_count || 0;});return counts;}, [rows]);const summaryTiles = [{ key: 'total', label: 'Servers', value: summary.total, icon: ServerIcon, meta: typeMeta('nginx') },- { key: 'nginx', label: 'Host Nginx', value: summary.nginx, meta: typeMeta('nginx') },+ { key: 'apps', label: 'Apps', value: summary.apps, icon: Boxes, meta: typeMeta('nginx') },{ key: 'traefik', label: 'Traefik', value: summary.traefik, meta: typeMeta('traefik') },{ key: 'caddy', label: 'Caddy', value: summary.caddy, meta: typeMeta('caddy') },+ {+ key: 'mismatches',+ label: 'Ingress mismatches',+ value: summary.mismatches,+ icon: AlertTriangle,+ meta: typeMeta('nginx'),+ warn: summary.mismatches > 0,+ },];const columns = [{ key: 'server', header: 'Server' },{ key: 'type', header: 'Proxy type' },{ key: 'status', header: 'Status' },+ { key: 'apps', header: 'Apps' },{ key: 'lastRegenerated', header: 'Last regenerated' },{ key: 'networks', header: 'Networks' },{ key: 'actions', header: '', className: 'fleet-proxy__col-actions' },@@ -131,7 +143,10 @@ const FleetProxy = () => {{summaryTiles.map((tile) => {const Icon = tile.icon;return (- <div key={tile.key} className="fleet-proxy__summary-tile">+ <div+ key={tile.key}+ className={`fleet-proxy__summary-tile${tile.warn ? ' fleet-proxy__summary-tile--warn' : ''}`}+ ><span className="fleet-proxy__summary-label">{Icon ? <Icon size={14} /> : (<span className={`fleet-proxy__swatch fleet-proxy__swatch--${tile.meta.kind}`} />@@ -185,6 +200,17 @@ const FleetProxy = () => {{STATUS_LABEL[row.status] || row.status || 'Unknown'}</Pill></td>+ <td>+ <div className="fleet-proxy__apps">+ <span className="fleet-proxy__muted">{row.app_count ?? 0}</span>+ {row.mismatch_count > 0 && (+ <Pill kind="amber" dot={false}>+ <AlertTriangle size={12} />+ {row.mismatch_count} ingress mismatch{row.mismatch_count === 1 ? '' : 'es'}+ </Pill>+ )}+ </div>+ </td><td className="fleet-proxy__muted">{formatTimestamp(row.last_regenerated_at)}</td>diff --git a/frontend/src/pages/NewService.jsx b/frontend/src/pages/NewService.jsxindex 3f2a5b11..a5a7b7ba 100644--- a/frontend/src/pages/NewService.jsx+++ b/frontend/src/pages/NewService.jsx@@ -9,6 +9,7 @@ import {GitBranch,Link2,Lock,+ Network,Package,RefreshCw,Rocket,@@ -135,6 +136,10 @@ const NewService = () => {const [appType, setAppType] = useState('auto');const [buildMethod, setBuildMethod] = useState('auto');const [port, setPort] = useState('');+ // Ingress plane: 'nginx' (host Nginx, the default) or 'proxy_stack' (a+ // Dockerized Traefik/Caddy stack). Only honored by the backend for+ // container-eligible app types; everything else is forced to host Nginx.+ const [ingressPlane, setIngressPlane] = useState('nginx');const [autoDeploy, setAutoDeploy] = useState(true);const [advancedOpen, setAdvancedOpen] = useState(false);const [submitting, setSubmitting] = useState(false);@@ -185,6 +190,15 @@ const NewService = () => {? `Auto -> ${formatBuildMethod(recommended.build_method)}`: formatBuildMethod(buildMethod);+ // A managed proxy stack only routes container-based services. The "Proxy+ // stack" ingress option is offered when the selected type resolves to a+ // container: Docker explicitly, Auto-detect (which may resolve to a+ // container), or a Compose-managed local service. Every other type+ // (PHP/Python/static) is served by host Nginx and the backend forces it.+ const ingressProxyEligible = appType === 'docker'+ || appType === 'auto'+ || (sourceMode === 'local' && managedBy === 'docker_compose');+const loadGithubStatus = useCallback(async () => {try {const data = await api.getGithubSourceStatus();@@ -223,6 +237,14 @@ const NewService = () => {loadGithubStatus();}, [loadGithubStatus]);+ // Keep the ingress choice valid: if the selected type is no longer+ // proxy-eligible, snap back to host Nginx (the forced default).+ useEffect(() => {+ if (!ingressProxyEligible && ingressPlane !== 'nginx') {+ setIngressPlane('nginx');+ }+ }, [ingressProxyEligible, ingressPlane]);+// Load projects for the optional Project / Environment selector. Best-effort:// if it fails the selector simply stays empty and creation is unaffected.useEffect(() => {@@ -440,6 +462,7 @@ const NewService = () => {compose_file: composeFile.trim() || undefined,systemd_unit: systemdUnit.trim() || undefined,managed_by: managedBy === 'auto' ? undefined : managedBy,+ ingress_plane: ingressProxyEligible ? ingressPlane : 'nginx',...projectEnvPayload,};const result = await api.createManualApp(payload);@@ -451,6 +474,7 @@ const NewService = () => {formData.append('name', serviceName);formData.append('app_type', appType);formData.append('auto_deploy', autoDeploy ? 'true' : 'false');+ formData.append('ingress_plane', ingressProxyEligible ? ingressPlane : 'nginx');if (projectEnvPayload.project_id) formData.append('project_id', projectEnvPayload.project_id);if (projectEnvPayload.environment_id) formData.append('environment_id', projectEnvPayload.environment_id);const result = await api.uploadAppZip(formData);@@ -464,6 +488,7 @@ const NewService = () => {build_method: buildMethod,port: port ? Number(port) : null,auto_deploy: autoDeploy,+ ingress_plane: ingressProxyEligible ? ingressPlane : 'nginx',...projectEnvPayload,};if (recommended.dockerfile_path) payload.dockerfile_path = recommended.dockerfile_path;@@ -995,6 +1020,14 @@ const NewService = () => {<strong>{autoDeploy ? 'On' : 'Off'}</strong></div>)}+ <div>+ <span>Ingress</span>+ <strong>+ {ingressProxyEligible && ingressPlane === 'proxy_stack'+ ? 'Proxy stack'+ : 'Host Nginx'}+ </strong>+ </div></div><button@@ -1107,6 +1140,25 @@ const NewService = () => {)}</div>+ <div className="new-service-page__field">+ <Label htmlFor="ingress-plane">Ingress</Label>+ {ingressProxyEligible ? (+ <select+ id="ingress-plane"+ value={ingressPlane}+ onChange={(e) => setIngressPlane(e.target.value)}+ >+ <option value="nginx">Host Nginx (default)</option>+ <option value="proxy_stack">Proxy stack (Traefik / Caddy)</option>+ </select>+ ) : (+ <div className="new-service-page__note">+ <Network size={16} />+ <span>Served by host Nginx</span>+ </div>+ )}+ </div>+{projects.length > 0 && (<div className="new-service-page__two-col"><div className="new-service-page__field">diff --git a/frontend/src/services/api/proxy.js b/frontend/src/services/api/proxy.jsindex b976dddc..cf59b059 100644--- a/frontend/src/services/api/proxy.js+++ b/frontend/src/services/api/proxy.js@@ -6,6 +6,14 @@ export async function getServerProxy(serverId) {return this.request(`/servers/${serverId}/proxy`);}+// Ingress-plane audit for a single server: compares each app's expected ingress+// plane against the server's active proxy. Returns+// { server_id, server_name, proxy_type, expected_plane, app_count,+// mismatch_count, apps: [{ id, name, app_type, ingress_plane, mismatch, reason }] }.+export async function getServerIngressAudit(serverId) {+ return this.request(`/servers/${serverId}/proxy/ingress-audit`);+}+// Fleet-wide proxy posture: one row per server. Returns { servers: [...] }.// Backed by GET /api/v1/servers/proxy/overview (a static prefix that never// collides with the per-server /servers/<id>/proxy route).diff --git a/frontend/src/styles/components/_proxy.scss b/frontend/src/styles/components/_proxy.scssindex f4cb8a1a..5b7e4edb 100644--- a/frontend/src/styles/components/_proxy.scss+++ b/frontend/src/styles/components/_proxy.scss@@ -98,4 +98,81 @@color: $danger-color;font-size: $font-size-sm;}++ // Ingress-plane mismatch banner: apps whose expected plane disagrees with+ // the server's active proxy.+ &__ingress-warning {+ display: flex;+ flex-direction: column;+ gap: $space-2;+ padding: $space-4;+ background: $warning-bg;+ border: 1px solid $warning-border;+ border-radius: $radius-lg;+ }++ &__ingress-warning-head {+ display: flex;+ align-items: center;+ gap: $space-2;+ color: $warning;++ strong {+ font-size: $font-size-sm;+ font-weight: $font-weight-semibold;+ color: $text-primary;+ }+ }++ &__ingress-warning-text {+ margin: 0;+ font-size: $font-size-sm;+ color: $text-secondary;+ line-height: 1.5;++ strong {+ color: $text-primary;+ }+ }++ &__ingress-list {+ margin: 0;+ padding: 0;+ list-style: none;+ display: flex;+ flex-direction: column;+ gap: $space-1;+ }++ &__ingress-item {+ display: flex;+ align-items: baseline;+ flex-wrap: wrap;+ gap: $space-2;+ font-size: $font-size-sm;+ }++ &__ingress-link {+ font-weight: $font-weight-medium;+ color: $accent-primary;+ text-decoration: none;++ &:hover {+ text-decoration: underline;+ }+ }++ &__ingress-reason {+ color: $text-tertiary;+ font-size: $font-size-xs;+ }++ // Subtle "all aligned" note when there are apps but no mismatches.+ &__ingress-ok {+ display: inline-flex;+ align-items: center;+ gap: $space-2;+ font-size: $font-size-sm;+ color: $success;+ }}diff --git a/frontend/src/styles/pages/_fleet-proxy.scss b/frontend/src/styles/pages/_fleet-proxy.scssindex 429ce9a3..ed2e7847 100644--- a/frontend/src/styles/pages/_fleet-proxy.scss+++ b/frontend/src/styles/pages/_fleet-proxy.scss@@ -44,10 +44,11 @@}}- // Summary strip: counts by proxy type.+ // Summary strip: counts by proxy type, fleet app total, and ingress+ // mismatches. Auto-fit so the row reflows as tiles are added.&__summary {display: grid;- grid-template-columns: repeat(4, 1fr);+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));gap: $space-3;@media (max-width: $breakpoint-md) {@@ -63,6 +64,29 @@background: $bg-elevated;border: 1px solid $border-subtle;border-radius: $radius-md;++ // Mismatch tile when the fleet has at least one ingress mismatch.+ &--warn {+ background: $warning-bg;+ border-color: $warning-border;++ .fleet-proxy__summary-label,+ .fleet-proxy__summary-value {+ color: $warning;+ }+ }+ }++ // "Apps" cell: count plus an optional amber mismatch pill.+ &__apps {+ display: inline-flex;+ align-items: center;+ gap: $space-2;+ flex-wrap: wrap;++ .sk-pill svg {+ margin-right: 2px;+ }}&__summary-label {