Multi-Target Deployment Compiler ================================= Fleetmesh nodes are deployed across diverse computing environments—from large enterprise Kubernetes clusters to edge IoT devices running rootless Podman or raw systemd. To eliminate brittle configuration drift between environments, `meshctl export` serves as a **multi-target deployment compiler**. It ingests standard `apiVersion: fleetmesh.org/v1alpha1` manifests and compiles them into production-hardened templates for target orchestrators. Compilation Targets ------------------- The compiler supports four primary target architectures: .. list-table:: :widths: 20 20 60 :header-rows: 1 * - Target Identifier - Platform - Generated Artifacts * - ``--target=k8s`` - Kubernetes - Deployments, ClusterIP/NodePort Services, ConfigMaps, and Secret references. * - ``--target=quadlet`` - Podman Quadlet - Rootless systemd ``.container`` units, user namespaces, and security opt-ins. * - ``--target=systemd`` - Linux systemd - Hardened ``.service`` and ``.timer`` unit files with Linux namespace sandboxing. * - ``--target=compose`` - Docker Compose - Multi-container topology definitions (``docker-compose.yaml``) with isolated networks. Kubernetes (``--target=k8s``) ----------------------------- Compiling to Kubernetes generates fully qualified Kubernetes manifests incorporating recommended cloud-native patterns: .. code-block:: sh meshctl export -f manifests/meshnode.yaml --target k8s > k8s-meshnode.yaml Key features of the generated Kubernetes manifest: - **Stateful Persistence**: Mounts persistent volumes for ``/var/lib/fleetmesh`` to ensure cryptographic keys (``keys.json``) and databases (``store.sqlite``, ``grants.sqlite``) survive pod rescheduling. - **Port Mapping**: Exposes required transport ports: - UDP port ``11801`` for Iroh QUIC transport. - TCP port ``7777`` for WebSocket relay bridging. - TCP port ``8000`` for HTTP/Blossom storage and JSON-LD endpoints. - **Liveness & Readiness Probes**: Leverages the ``meshctl status`` command to provide deterministic Kubernetes health probes over the control socket. Podman Quadlet (``--target=quadlet``) ------------------------------------- For rootless container execution on modern Linux distributions (Fedora CoreOS, RHEL, openSUSE MicroOS), Podman Quadlet translates ``.container`` files directly into user-mode systemd services: .. code-block:: sh meshctl export -f manifests/meshnode.yaml --target quadlet > ~/.config/containers/systemd/node.container Generated configuration includes: - Rootless user namespace remapping (``UserNS=auto``). - Memory and CPU limits derived from manifest capacity declarations. - Direct host network passthrough option for high-throughput QUIC packet processing. - Automatic integration with ``systemctl --user start node.service``. Hardened systemd (``--target=systemd``) --------------------------------------- When running directly on bare metal or virtual machines without container virtualization, `meshctl export --target=systemd` produces systemd service units fortified with defense-in-depth Linux isolation primitives: .. code-block:: sh meshctl export -f manifests/meshnode.yaml --target systemd > /etc/systemd/system/meshnode.service Security hardening directives applied automatically: .. code-block:: ini [Service] Type=simple User=fleetmesh Group=fleetmesh ExecStart=/usr/local/bin/meshnode /var/lib/fleetmesh run Restart=always RestartSec=5s # Sandboxing & Security Controls ProtectSystem=strict ProtectHome=true NoNewPrivileges=true PrivateTmp=true ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 ReadWritePaths=/var/lib/fleetmesh Docker Compose (``--target=compose``) ------------------------------------- For local development clusters and automated integration testbeds, `meshctl export --target=compose` outputs a self-contained ``docker-compose.yaml`` file: .. code-block:: sh meshctl export -f manifests/fleet-cluster.yaml --target compose > docker-compose.yaml docker compose up -d Features: - Configures bridge networks with deterministic internal IP addressing. - Sets up local volume mounts for easy log and database inspection. - Provisions sidecar containers (e.g., local strfry relay or Blossom storage nodes) automatically when specified in manifest extensions.