Commit Graph

333 Commits

Author SHA1 Message Date
Paul Payne
e5e933a46b feat: Refactor service model to support multiple routes per domain 2026-07-10 05:15:19 +00:00
Paul Payne
ef7203933f Long live Wild Central! Adds watcher. 2026-07-10 04:35:13 +00:00
Paul Payne
28c1d93b17 refactor: Replace reach string with public bool in Central client
Simplifies the service registration contract — reach was only ever
"internal" or "public", so a boolean is clearer for consumers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-10 02:18:02 +00:00
Paul Payne
db26b42a31 feat: Domain-keyed registrations, one per domain
Update Wild Cloud to match Central's new domain-keyed service model:

Client changes:
- Removed Name, ExtraDomains, SourceNode from Service struct
- Added Subdomains bool field
- Added DeregisterBySource(source, backend) for batch cleanup
- DeregisterService uses domain in URL

Registration changes:
- RegisterInstanceWithCentral → RegisterInstanceDomains
- Now makes separate registrations per domain:
  * Primary domain (subdomains:true, reach:public)
  * Internal domain (subdomains:true, reach:internal)
  * Each discovered extra domain (subdomains:false, reach:public)
- Calls DeregisterBySource before re-registering (cleanup)

Handler changes:
- CentralDeregisterInstance uses DeregisterBySource for batch cleanup
- CentralRegistrationStatus queries by domain, not name
- RegisterAppWithCentral uses domain-only Service

All tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 20:35:13 +00:00
Paul Payne
735b4bf03c feat: Discover extra domains from deployed app ingress manifests
When registering an instance with Central, scan deployed app manifests
for ingress hostnames outside the instance's primary domain. These get
added as extraDomains so HAProxy routes them correctly.

For payne-cloud this discovers: payne.io, civilsociety.dev,
mywildcloud.org — domains that apps are actually serving.

Ported discoverExtraDomains, ingressHosts, ingressBaseDomain from the
old handlers_haproxy.go. Removed incorrect baseDomain auto-add that
was causing both instances to claim payne.io.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 15:52:03 +00:00
Paul Payne
ecb3741c2b feat: Auto-register all instances with Central on startup
On startup, Wild Cloud iterates all existing instances and registers
each with Central (DNS, HAProxy SNI routes, split DNS). Idempotent —
safe on every restart.

Also exports RegisterInstanceWithCentral for use from main.go.

This ensures all instances are routable even if Central was restarted
and lost registrations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 15:46:51 +00:00
Paul Payne
97f4be3714 fix: Use Central domain from config for sidebar link
The Wild Central link in the sidebar used VITE_CENTRAL_URL which
defaults to http://localhost:15055 — unreachable from other machines
on the LAN. Now reads cloud.central.domain from the API config and
links to https://<central-domain> instead. Falls back to the env var
for dev when no domain is configured.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 13:56:59 +00:00
Paul Payne
ab2a44c1f2 fix: Read MetalLB LB IP from per-app config file
The load balancer IP is stored in config/apps/metallb/config.yaml
(per-app config), not in the main instance.yaml. The registration
helpers now check all three locations:
1. cluster.loadBalancerIp (main config)
2. apps.metallb.loadBalancerIp (main config apps section)
3. config/apps/metallb/config.yaml (per-app file)

This fixes "Cannot register: LB IP must be configured" when MetalLB
was deployed through the normal app install flow.

Verified: payne-cloud now registers with backendIP=192.168.8.240.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 13:50:33 +00:00
Paul Payne
6539702faa feat: Add Central Registration UI to instance domain config
Add a "Central Registration" card to the CloudComponent page showing
whether the instance is registered with Wild Central for DNS/proxy/TLS.

- Status polling via GET /instances/{id}/central/status
- Register button (disabled when domain or LB IP missing)
- Unregister button (shown when registered)
- Clear messaging for missing prerequisites
- New hook: useCentralRegistration
- New API service: centralApi

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 05:50:35 +00:00
Paul Payne
c2a7d95b9f feat: Add explicit Central registration for instances and app
Instance registration with Central is now explicit and user-controlled:

API endpoints:
- POST   /instances/{name}/central/register  — register instance
- DELETE /instances/{name}/central/register  — deregister
- GET    /instances/{name}/central/status    — check registration

Startup self-registration:
- Wild Cloud registers its own app domain (WILD_CLOUD_DOMAIN env var)
  with Central on startup, idempotently

Changes:
- Removed auto-register from CreateInstance (domain/LB not set yet)
- Added handlers_central.go with register/deregister/status/app-register
- Added ProxyGET to Central client for status checks
- Added WILD_CLOUD_DOMAIN to .envrc

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 05:46:53 +00:00
Paul Payne
1de7ff2c4e feat: Add Domain Config nav item to sidebar
Add explicit sidebar link to /instances/:id/cloud for instance domain
configuration (public domain, internal domain, DNS test). Shows in
both expanded and collapsed sidebar modes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 05:15:40 +00:00
Paul Payne
75d0e4e4e7 fix: Restore instance domain config page at /instances/:id/cloud
The CloudComponent (public domain, internal domain, DNS test buttons)
was incorrectly deleted during Central extraction. This is instance-
scoped config, not Central config.

Restored CloudComponent and CloudPage, routed at
/instances/:instanceId/cloud.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 05:01:48 +00:00
Paul Payne
95bab1a1e8 fix: Restore CentralLayout wrapper for /cloud routes
The Overview page crashed because CentralPage uses usePageHelp which
requires HelpProvider. CentralLayout provides this context.

Restored CentralLayout.tsx and wrapped /cloud routes in it, matching
the original route structure from main.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:59:39 +00:00
Paul Payne
86c117e2dc fix: Restore Overview page with correct component
The /cloud Overview page should show CentralComponent (operator email,
daemon status, Talos client) — not CloudComponent (instance domain
config). CentralComponent is a Cloud meta-config page despite its name.

Removed CloudPage/CloudComponent (instance-scoped, accessible via
Dashboard) and restored CentralPage/CentralComponent at /cloud.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:56:56 +00:00
Paul Payne
3f135c9b89 fix: Restore original sidebar layout with Central link
Restore the sidebar from main and make the minimal change: replace
the Central section's individual nav items with a single "Wild Central"
external link. The layout now matches the original:

  Central → Wild Central (external link)
  Wild Cloud → Overview, Node USB Installer
  Instance Selector
  Dashboard, Cloud (Nodes, Services), Apps, Backups, Advanced

Restored /cloud routes for Overview and ISO pages.
Removed /central/* routes (served by Wild Central's own UI).
Removed Central page imports and redirect children.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:53:49 +00:00
Paul Payne
0b2907128b fix: Restore Overview and Node USB Installer pages
The Central page cleanup incorrectly removed CloudPage/CloudComponent
(instance-level domain/network config) and the Node USB Installer
sidebar link. These are Cloud-specific features, not Central.

- Restored CloudComponent and CloudPage from main
- Added Overview nav item in sidebar
- Added Node USB Installer nav item under Cloud section

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:49:58 +00:00
Paul Payne
94576dd0d8 refactor: Remove Central API proxy from Wild Cloud
Central pages are now served by Wild Central's own UI — no need to
proxy Central API calls through Wild Cloud. The sidebar links to
Wild Central directly via VITE_CENTRAL_URL.

Removed: reverse proxy handler, ReverseProxy method, ProxyRequest
method, unused httputil/url imports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:34:15 +00:00
Paul Payne
05618dc9f1 feat: Remove Central pages from Wild Cloud web app
Central pages (DNS, DHCP, Firewall, VPN, Ingress, CrowdSec) are now
served by the standalone Wild Central web app. Wild Cloud's sidebar
links to Central via VITE_CENTRAL_URL.

Removed: 12 Central pages, 12 Central components, 8 Central hooks,
4 Central API services, CentralLayout router
Added: "Wild Central" external link in sidebar

TypeScript type-check and production build pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 04:11:02 +00:00
Paul Payne
70b6755318 fix: Correct Central proxy path matching for bare paths
PathPrefix("/api/v1/services/") doesn't match "/api/v1/services"
(no trailing slash). Remove trailing slashes from proxy prefixes so
both /api/v1/services and /api/v1/services/foo are forwarded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 03:42:12 +00:00
Paul Payne
8f4c8ba477 feat: Add reverse proxy to forward Central API calls to Wild Central
Wild Cloud's web UI still calls Central-namespaced endpoints (dnsmasq,
vpn, firewall, etc.). Instead of dropping those calls, forward them to
the Wild Central service via a reverse proxy.

Central paths (/api/v1/dnsmasq/*, /api/v1/vpn/*, etc.) are proxied
transparently to WILD_CENTRAL_URL (default http://localhost:5055).

This lets the existing UI work unchanged while Central runs as a
separate service. Set WILD_CENTRAL_URL to point at Central's address.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 03:29:55 +00:00
Paul Payne
0f98163e98 feat: Extract Central networking from Wild Cloud
Remove all Central-specific code from Wild Cloud. Networking concerns
(DNS, HAProxy, nftables, WireGuard, certbot, CrowdSec, DDNS) are now
managed by the standalone Wild Central service.

Wild Cloud now uses a Central client (internal/central/client.go) to
register instance services with Central via HTTP API. When an instance
is created or its domain/LB IP changes, Cloud calls Central's service
registration API instead of managing dnsmasq/HAProxy directly.

Removed: 8 Central handler files, 8 internal packages (~6500 LOC)
Added: Central API client for service registration
Modified: Instance creation and config updates use Central client

All 17 test packages pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-09 00:00:48 +00:00
Paul Payne
43f4d6d306 style: Make instance selector look like a section heading
Remove border, background, and shadow from the instance selector
dropdown so it visually matches the sidebar group labels. Keeps the
chevron as the only hint it's interactive.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 23:30:30 +00:00
Paul Payne
7c651bc992 fix: Remove excess padding around instance selector in sidebar
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 23:27:39 +00:00
Paul Payne
97da18dc8c chore: Remove legacy ddns.cloudflare.apiToken fallback
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 23:26:18 +00:00
Paul Payne
382947eb3a feat: Add Cloudflare integration page and restructure sidebar
Add a dedicated Cloudflare page under Central for API token management
with live verification against the Cloudflare API (token validity, zone
access). Migrate the token secret path from ddns.cloudflare.apiToken to
cloudflare.apiToken with backward-compatible fallback.

Restructure sidebar into two groups: Central (networking platform
services) and Wild Cloud (overview, instance management). The instance
selector now sits inside the Wild Cloud section as a natural divider
between meta and instance-scoped items.

Move Central Domain & TLS config from Overview to the Cloudflare page.
Move Node USB Installer route to /cloud/iso (not instance-scoped).
Fix FirewallComponent Lucide icon title prop type error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 23:24:20 +00:00
Paul Payne
dcbcbe16fa Use warning variant for service badges that indicate a problem
Distinguish between "disabled" (opt-in feature intentionally off, gray)
and "stopped" (expected service not running, yellow warning). Core
services like DNS, HAProxy, CrowdSec show warning when stopped. Opt-in
features like VPN and firewall show warning only when enabled in config
but not actually running. Opt-in features that are simply disabled stay
gray (secondary).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 22:49:08 +00:00
Paul Payne
3ade65f39a fix: Use success variant for all service status badges
Service status badges (Running, Active, Enabled) now consistently use
variant="success" (green bg, white text) instead of variant="default"
(primary color). Fixes visual inconsistency where some status badges
appeared dark/primary while others were green. Also standardizes icon
size to h-3 w-3, removes XCircle from inactive states, and cleans up
bg-green-600 hacks in CloudflareComponent that were working around
the wrong variant choice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 22:44:57 +00:00
Paul Payne
d203969a2f Standardize status badges across all Central pages
Consistent pattern: active state uses variant="default" with CheckCircle
h-3 w-3 icon and gap-1; inactive state uses variant="secondary" with no
icon. Standardize inactive text to "Stopped"/"Disabled" (not "Not running").
Central overview keeps variant="success" as the top-level system health
indicator. Remove unused XCircle import from Ingress.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 22:38:25 +00:00
Paul Payne
d236b36819 Align Central pages UX: consistent feedback, Advanced views, auto VPN firewall port
- Firewall: unified port list showing auto-managed (locked) and user ports,
  raw nftables rules moved to Advanced collapsible, success/error alerts
- Ingress: Advanced collapsible showing generated haproxy.cfg, success/error
  alerts on custom route add/delete
- VPN: auto-apply after config save, Advanced collapsible showing wg status,
  consistent alert styling
- DHCP: success/error alerts on config save and static lease operations
- Central: success/error alerts on operator email and domain saves
- Firewall auto-includes WireGuard listen port when VPN is enabled (backend
  and frontend), VPN config save triggers nftables resync
- Fix HAProxy stats socket path: make it configurable on Manager so tests
  don't hit the real HAProxy on the host
- Fix DDNS checkAndUpdate to skip Cloudflare calls when IP is unchanged

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-07-08 21:23:37 +00:00
Paul Payne
12d78a02ac Fixes node layout in the UI. 2026-07-08 17:21:04 +00:00
Paul Payne
5384d6825e Fixes sidebar A nesting errors. 2026-07-08 15:36:38 +00:00
Paul Payne
a288f23957 Add VPN, TLS certificates, and frontend serving to Wild Central.
WireGuard VPN: API endpoints for server config, key management, peer
CRUD with auto IP assignment, and client config generation with QR
codes. Web UI with full peer management.

TLS certificates: certbot integration with Cloudflare DNS-01 for
provisioning Let's Encrypt certs. HAProxy SNI routing with TLS
termination for the central domain. Web UI for domain config and
cert status.

Frontend architecture: Go API is now the single front door — proxies
to Vite in dev (hot reloads) and serves static files in prod. Removes
nginx dependency. Vite proxy config removed in favor of Go reverse proxy.

APT package: adds wireguard-tools, certbot, python3-certbot-dns-cloudflare
as dependencies. Removes nginx. Adds sudoers, polkit, and directory
setup for VPN and TLS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-08 15:11:10 +00:00
Paul Payne
47772dd60b Make Wild Central a proper network management device. 2026-07-04 07:09:03 +00:00
Paul Payne
57487387a9 Wild Directory Server integration. 2026-07-03 18:40:35 +00:00
Paul Payne
89bec2580f feat(cluster): add kubeconfig certificate expiry checks and related tests 2026-07-02 21:32:07 +00:00
Paul Payne
4935ae04c4 feat(api): enhance app secrets management and deployment process
- Add tests for retrieving and redacting per-app secrets in GetSecrets handler.
- Implement logic to restart workloads when ConfigMaps are updated during app deployment.
- Ensure complete cleanup of app configuration directories upon deletion, including all related files.
- Introduce a filter to skip non-Longhorn PVCs during backup operations.
- Refactor legacy helper functions in context.go to streamline instance path management.
- Update AppDetailPanel component to include action buttons for app lifecycle management and backup operations.
2026-07-02 20:55:16 +00:00
Paul Payne
81a000930d Introduce managers. Backup configuration revision. 2026-06-22 15:28:21 +00:00
Paul Payne
fd36756311 Removes more PXE ghosts. 2026-06-21 20:11:28 +00:00
Paul Payne
4b3093c360 Fixes manifest path bug in API. 2026-06-21 20:04:26 +00:00
Paul Payne
2327257aeb Fully remove deprecated pxe and dhcp code. 2026-06-21 19:36:50 +00:00
Paul Payne
36f7e5d99a Remopes orphaned error tester component. 2026-06-21 19:27:01 +00:00
Paul Payne
a2b9bfdd0b Minor app resiliency improvements. 2026-06-21 19:26:42 +00:00
Paul Payne
e377817103 Eliminate heroicons. 2026-06-21 19:23:53 +00:00
Paul Payne
aa449068c2 Remove debug logs. 2026-06-21 19:22:25 +00:00
Paul Payne
511012ede6 Minor dist udpates. 2026-06-21 19:21:51 +00:00
Paul Payne
3937e4b8fb Remove dev and man-page commands from cli. 2026-06-21 19:19:23 +00:00
Paul Payne
a2a409d892 CORS in API 2026-06-21 19:18:21 +00:00
Paul Payne
3e7e02175c Keep appsMgr in memory 2026-06-21 19:17:32 +00:00
Paul Payne
93582bc43c More logs. 2026-06-21 19:16:29 +00:00
Paul Payne
d8351f0eee any is the new interface{} 2026-06-21 19:13:50 +00:00