feat(observability): phase 3 - direct proxy creation with validation

Add standalone proxy management:
- Multi-step validation pipeline (DNS, TCP, HTTP) with diagnostic hints
- Proxy lifecycle: create/update/delete via NPM API with SSL auto-assign
- Periodic health monitoring (5min) with event log on status transitions
- Unified /api/proxies/all endpoint merging standalone + managed proxies
- Frontend types and API functions for downstream UI phases
This commit is contained in:
2026-03-30 11:19:55 +03:00
parent aefecdffdf
commit 7a85441b81
9 changed files with 1076 additions and 1 deletions
+40
View File
@@ -9,11 +9,14 @@ import type {
NpmCertificate,
Project,
ProjectDetail,
ProxyView,
Registry,
RegistryImage,
Settings,
Stage,
StageEnv,
StandaloneProxy,
ValidationResult,
Volume
} from './types';
@@ -365,4 +368,41 @@ export function fetchEventLogStats(): Promise<EventLogStats> {
return get<EventLogStats>('/api/events/log/stats');
}
// ── Proxies ─────────────────────────────────────────────────────────
export function validateProxy(host: string, port: number): Promise<ValidationResult> {
return post<ValidationResult>('/api/proxies/validate', { host, port });
}
export function createProxy(data: {
domain: string;
destination_url: string;
destination_port: number;
}): Promise<StandaloneProxy> {
return post<StandaloneProxy>('/api/proxies', data);
}
export function listProxies(): Promise<StandaloneProxy[]> {
return get<StandaloneProxy[]>('/api/proxies');
}
export function getProxy(id: string): Promise<StandaloneProxy> {
return get<StandaloneProxy>(`/api/proxies/${id}`);
}
export function updateProxy(
id: string,
data: { domain: string; destination_url: string; destination_port: number }
): Promise<StandaloneProxy> {
return put<StandaloneProxy>(`/api/proxies/${id}`, data);
}
export function deleteProxy(id: string): Promise<{ deleted: string }> {
return del<{ deleted: string }>(`/api/proxies/${id}`);
}
export function listAllProxies(): Promise<ProxyView[]> {
return get<ProxyView[]>('/api/proxies/all');
}
export { ApiError };
+32 -1
View File
@@ -198,8 +198,39 @@ export interface StandaloneProxy {
destination_port: number;
ssl_certificate_id: number;
npm_proxy_id: number;
health_status: 'unknown' | 'healthy' | 'unhealthy';
health_status: ProxyHealthStatus;
health_checked_at: string;
created_at: string;
updated_at: string;
}
/** Health status for a proxy. */
export type ProxyHealthStatus = 'unknown' | 'healthy' | 'unhealthy';
/** A single step in the validation pipeline. */
export interface ValidationStep {
name: string;
passed: boolean;
message?: string;
hint?: string;
}
/** Result of the proxy destination validation pipeline. */
export interface ValidationResult {
valid: boolean;
steps: ValidationStep[];
}
/** Unified view of standalone + deploy-managed proxies (from /api/proxies/all). */
export interface ProxyView {
id: string;
domain: string;
destination: string;
type: 'standalone' | 'managed';
project_name?: string;
stage_name?: string;
health_status: ProxyHealthStatus;
ssl_enabled: boolean;
npm_proxy_id: number;
created_at: string;
}