Skip to content

[Feature Request]: Add remote planet root managementΒ #946

Description

@dadastory

πŸš€ Feature Summary

Manage remote ZeroTier planet root servers directly from the ZTNET admin UI β€” provision them over SSH, generate/distribute a custom planet, monitor health, and (separately) edit the local controller's local.conf from the panel.

πŸ“ Detailed Description

This adds an end-to-end workflow for running your own planet roots on remote machines, plus local controller configuration. Implemented across a new Prisma schema, a dedicated tRPC router (remoteRootRouter), a set of focused services, a periodic health cron, and an admin UI under Admin β†’ Controller.

Data model (new Prisma models/enums)

  • RemoteRootNode β€” a managed remote root: SSH connection (host, sshPort, sshUser), ZeroTier state (zerotierInstalled, zerotierVersion, serviceStatus, startupStatus), aggregate status (UNKNOWN/HEALTHY/DEGRADED/OFFLINE/ERROR), local.conf-derived fields (primaryPort, secondaryPort, allowSecondaryPort, portMappingEnabled, interfacePrefixBlacklist, bindAddresses, allowManagementFrom, defaultBondingPolicy, multithreaded, linuxKernelMode), endpoint resolution (endpointSource = MANUAL_IP/DOMAIN, domainName, selectedIps, resolvedIps, endpointCandidates), and planet tracking (remotePlanetHash, remoteOfficialPlanetHash, planetStatus).
  • RemoteRootCredential β€” per-node managed SSH key. Private key stored encrypted at rest (encryptedPrivateKey), with publicKey exposed so the operator can authorize it on the target.
  • RemoteRootTask β€” async task records (type, status, logs, timestamps) for the long-running operations below.
  • Enums: RemoteRootTaskType (CHECK, INSTALL_ZEROTIER, UPGRADE_ZEROTIER, READ_CONFIG, GENERATE_PLANET_ENTRY, RESTART_ZEROTIER, CHANGE_PORT, SAVE_CONFIG, DISTRIBUTE_PLANET, RESTORE_OFFICIAL_PLANET), RemoteRootTaskStatus, RemoteRootStatus, RemoteRootEndpointSource, RemoteRootCredentialAuthType.

API (remoteRootRouter, all admin-only)

  • CRUD: list, getById, create, update, delete
  • Connectivity: resolveDomain, testSsh
  • Provisioning over SSH: installZerotier, upgradeZerotier, restartZerotier, changeZerotierPort
  • Config: readRemoteConfig, saveRemoteConfig
  • Planet: buildPlanetRootEntry, buildPlanetRootEntries, distributePlanet, restoreOfficialPlanet
  • Health: checkHealth

Services (separated by concern, each unit-tested)

  • remoteRootSshService β€” SSH transport (managed-key auth).
  • remoteRootCredentialService β€” generate/encrypt/decrypt the managed SSH key pair.
  • remoteRootProvisioningService β€” install/upgrade/restart ZeroTier, change port on the remote host.
  • remoteRootConfigGuardService β€” validate/guard local.conf edits.
  • remoteRootDnsService β€” resolve a domain to candidate endpoint IPs.
  • remoteRootPlanetService / remoteRootPlanetStatusService β€” build planet root entries, distribute the custom planet, and compare remote planet hashes vs official.
  • remoteRootHealthService / remoteRootHealthTaskService β€” multi-dimension health (SSH / service / startup / panel) and task logging.
  • remoteRootTaskLogService + remoteRootTaskLogFormatter β€” structured task logs surfaced in the UI.

Background health monitoring

  • A cron job (CheckRemoteRoots, every 5 minutes) refreshes each enabled node's health and status so the panel reflects live state without manual checks.

Admin UI (Admin β†’ Controller)

  • remoteRoots.tsx β€” manage remote roots: add/edit/delete, run SSH test, install/upgrade ZeroTier, edit config, change port, generate & distribute the planet, restore the official planet, and view per-task logs and health badges.
  • localZerotierConfig.tsx β€” edit the local controller's local.conf (ports, bindings, management allow-list, bonding, etc.) directly from the panel, backed by localZerotierConfigService and new adminRoute procedures.
  • Planet generation hooks (api/mkworld/config.ts, api/planet.ts) updated to incorporate remote roots, with a planetDownloadAuthMode option (GlobalOptions).

i18n β€” full translations added for all 11 shipped locales (en, de, es, fr, no, pl, ru, ua, zh, zh-tw).

Tests β€” component tests (remoteRoots, rootForm, controllerLayout, localZerotierConfig), service tests for every service above, translation-completeness tests, and API tests for planet generation.

🎯 Use Case

ZTNET can already create a custom planet, but the planet roots themselves still have to be installed, configured, and kept healthy by hand on each server. Operators running a self-hosted ZeroTier network (e.g. across multiple regions/clouds) want to:

  • Bring up a new root server without manually SSHing in to install ZeroTier and edit local.conf.
  • Generate the planet entry from a root's real identity/endpoints and distribute the resulting planet to all roots consistently.
  • See at a glance whether each root is reachable, running, and serving the expected planet β€” and be alerted (status badges) when one drifts (DEGRADED/OFFLINE).
  • Roll back to the official planet if a custom setup needs to be abandoned.
  • Adjust the local controller's local.conf from the same panel instead of editing files on the host.

This turns multi-root planet operations into a UI-driven workflow.

πŸ’‘ Willing to Contribute

Yes β€” this is already implemented and I'm preparing a PR against main.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpinnedDoes not stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions