Files
ServerKit/frontend/src/services/api/proxy.js
T
Juan DenisandClaude Opus 4.8 0e71ab346a feat: make the ingress-plane boundary explicit (host Nginx vs proxy stack)
Both reverse proxies bind 80/443, so pointing the same domain at host Nginx and
a Dockerized proxy stack is an operational footgun. This tags each app with the
plane it expects and surfaces disagreements instead of leaving them implicit.

- Each app carries an `ingress_plane` ('nginx' | 'proxy_stack'); NULL reads as
  the host-Nginx default. New pure helpers in app/utils/ingress.py: only
  container-based services are proxy-stack eligible, and a requested proxy_stack
  is forced back to nginx for PHP/WordPress/static/Python apps. to_dict() also
  exposes `ingress_proxy_eligible`.
- ProxyStackService.ingress_audit(server) reports which of a server's apps
  disagree with its active proxy mode; fleet_overview now includes per-server
  app_count + mismatch_count. New GET /servers/<id>/proxy/ingress-audit.
- Create wizard offers the proxy stack only for Docker/Compose services and
  keeps the default on Nginx; app detail shows an Ingress badge; the fleet proxy
  dashboard flags mismatch counts; the server proxy panel warns and lists the
  specific mismatched apps with reasons.

Migration 035 adds applications.ingress_plane. Backend suite green (incl. 8 new
ingress tests); frontend builds clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 20:57:40 -04:00

53 lines
2.0 KiB
JavaScript

// Managed reverse-proxy stack (opt-in Traefik/Caddy as a Compose stack).
// Host nginx stays the default. Mounted by the backend at /api/v1/servers,
// so paths are /servers/<id>/proxy*.
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).
export async function getFleetProxyOverview() {
return this.request('/servers/proxy/overview');
}
export async function getServerProxyComposePreview(serverId, options = {}) {
const params = new URLSearchParams();
if (options.proxyType) params.set('proxy_type', options.proxyType);
if (options.acmeEmail) params.set('acme_email', options.acmeEmail);
if (options.dashboard) params.set('dashboard', '1');
const qs = params.toString();
return this.request(`/servers/${serverId}/proxy/compose-preview${qs ? `?${qs}` : ''}`);
}
export async function configureServerProxy(serverId, data) {
return this.request(`/servers/${serverId}/proxy/configure`, {
method: 'POST',
body: data,
});
}
export async function regenerateServerProxy(serverId, data = {}) {
return this.request(`/servers/${serverId}/proxy/regenerate`, {
method: 'POST',
body: data,
});
}
export async function switchServerProxy(serverId, proxyType) {
return this.request(`/servers/${serverId}/proxy/switch`, {
method: 'POST',
body: { proxy_type: proxyType },
});
}