|
| 1 | +# launchd |
| 2 | +Deterministic deploy orchestrator for single-binary Go services anchored to Linux systemd. launchd operationalizes a minimal, auditable deploy surface by composing battle-tested primitives: the resident Go toolchain for compilation, OpenSSH for transport and privileged control, systemd for service lifecycle, an optional migrator for schema evolution, and an HTTP health contract for liveness attestation. The objective function is predictability under duress, not novelty; the codebase is dependency-thin and tuned for reproducible behavior across heterogeneous fleet baselines. |
| 3 | + |
| 4 | +## Conceptual Premise |
| 5 | + |
| 6 | +The dominant substrate for “small-but-critical” services is a single daemon under systemd supervision. For these domains, heavyweight CI/CD machinery introduces variance without proportional utility. launchd prefers an austere convergence model: converge a binary onto a machine, converge a unit into systemd, converge the database state via idempotent migrations, and converge process readiness via health probes. Each convergence step is a transparent syscall to a canonical tool, yielding failure surfaces that are legible to any seasoned operator. |
| 7 | + |
| 8 | +Assumptions: |
| 9 | +- A Go main package constitutes the service. |
| 10 | +- SSH reachability with privilege elevation exists to manage units. |
| 11 | +- The service exposes `/health` on a chosen TCP port. |
| 12 | + |
| 13 | +## MVP Scope |
| 14 | + |
| 15 | +- CLI: `launchd deploy --host <ip> --user <ssh-user> --app ./path/to/app --port <port> [--timeout <dur>]`. |
| 16 | +- Pipeline: Compile ➝ Transfer ➝ systemd Provision ➝ Migrate (optional) ➝ Health Gate. |
| 17 | +- Properties: idempotent (safe re-entrance), deterministic (explicit tooling), strict error surfacing, and minimal environmental preconditions (Go + OpenSSH). |
| 18 | + |
| 19 | +### Stage Semantics |
| 20 | +- Compile: `go build -o /tmp/<app>` using the resident toolchain; no hermetic wrapper. |
| 21 | +- Transfer: `scp` to `/usr/local/bin/<app>` after ensuring parent directory ownership is sane. |
| 22 | +- systemd: materialize a unit, `daemon-reload`, `enable`, `restart`—idempotent operations. |
| 23 | +- Migrations: opportunistic `migrate up` if a migrator exists on the target PATH. |
| 24 | +- Health: poll `http://<host>:<port>/health` until success or deadline expiry. |
| 25 | + |
| 26 | +## Example Usage |
| 27 | + |
| 28 | +```bash |
| 29 | +launchd deploy --host 203.0.113.10 --user ubuntu --app ./examples/hello --port 8080 --timeout 60s |
| 30 | +``` |
| 31 | + |
| 32 | +On completion, the service is registered as `<app>.service`, executes `/usr/local/bin/<app> --port=<port>`, and is enabled for boot. |
| 33 | + |
| 34 | +## Design Guarantees |
| 35 | + |
| 36 | +- Determinism: all side effects mediated by explicit tools (`go`, `scp`, `ssh`, `systemctl`). |
| 37 | +- Idempotence: repeated invocations converge; non-destructive `enable`, guarded migrations. |
| 38 | +- Failure Locality: stages short-circuit with precise logging; no ambiguous partial states. |
| 39 | +- Observability: microsecond timestamps and stage banners designed for operator cognition. |
| 40 | +- Minimality: no bespoke protocol layers; everything deferential to Unix contracts. |
| 41 | + |
| 42 | +## Future Roadmap |
| 43 | + |
| 44 | +- Artifact integrity: checksums, content-addressed remote layout, atomic swaps. |
| 45 | +- Principle of Least Privilege: dedicated system users, hardening of unit sandboxing. |
| 46 | +- Transport hardening: native SSH client (keyboard-interactive, agent-forwarding policies) while preserving zero-daemon requirements. |
| 47 | +- Policy engines: JSON-structured logs, exponential backoff policies, retry budgets. |
| 48 | +- Migration adapters: goose, golang-migrate, app-native hooks with transactional guards. |
| 49 | + |
| 50 | +## Organizational Context |
| 51 | + |
| 52 | +This codebase is authored under the goVerta collective and aspires to the production rigor expected of core-infra artifacts. The project is intentionally conservative in feature accretion, biasing toward operability, determinism, and testable failure semantics over breadth. |
| 53 | + |
| 54 | +## Contributors and Roles |
| 55 | + |
| 56 | +- Saad H. Tiwana — lead author, deployment pipeline, systemd strategy, reliability posture |
| 57 | + GitHub: https://github.com/saadhtiwana |
| 58 | +- Ahmad Mustafa — SSH/SCP transport hardening, testing harnesses |
| 59 | + GitHub: https://github.com/ahmadmustafa02 |
| 60 | +- Majid Farooq Qureshi — QA and Toolsmith, Makefile/CI touchpoints, documentation QA |
| 61 | + GitHub: https://github.com/Majid-Farooq-Qureshi |
| 62 | + |
| 63 | +Saad authored the core code; Ahmad and Majid contributed engineering and QA functions across transport, tests, and docs. |
| 64 | + |
| 65 | +— saad and gang is who build this |
0 commit comments