WIP: microservice rearchitecture #35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "new-arch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Splits the monolithic myfs-lib binary into a JSON-RPC microservice topology and follows up with bug fixes identified by full end-to-end testing of every scenario in docs/PROJECT_OVERVIEW.md.
Architecture (feat)
myfs-server— canonical JSON-RPC 2.0 daemon over a Unix socket; the only process that touches stores, FUSE, and fungi metadata.myfs-sdk— typed client + #[rpc] trait (health, version, pack/unpack, mount/umount, clone, merge, sync, container, upload/download, exists, flist_tree/inspect/preview,block_get/exists, upload_dir, website_publish). Everything routes through this.
myfs-hub— REST API + JWT auth + website serving, using the SDK (no in-process fungi).myfs-hub-api— shared wire types extracted from the hub.myfs-ui— Axum+Askama dashboard split out of the old hub.myfs-cli(new) andmyfs-tool(rewritten) — both pure SDK consumers.hero_proclifecycle — myfs --start/--stop registers server+hub+ui as supervised actions with health checks and auto-generated hub.tomlAdds one-command service orchestration: 'myfs --start' registers a 'myfs' service with hero_proc containing three supervised actions (myfs-server, myfs-hub, myfs-ui), each with retry policy, SIGTERM stop signal, and socket-based health checks. 'myfs --stop' tears everything down. - myfs-lib/src/lifecycle.rs: self_start() builds the ServiceSpec via hero_proc_sdk::ActionBuilder + ServiceBuilder; restart_service on the factory. self_stop() stops the service. Socket paths resolve from \$HERO_SOCKET_DIR/myfs/{rpc,hub,ui}.sock with \$HOME fallback. - myfs-lib/src/main.rs: adds exclusive --start / --stop top-level flags; wraps command: Option<Commands> so lifecycle can run without a subcommand. - myfs-lib/Cargo.toml: adds hero_proc_sdk.workspace dep. - Cargo.toml: hero_proc_sdk workspace dependency (git, development branch). - Makefile: 'make run' = install + myfs --start; 'make stop' = myfs --stop. Health checks: myfs-server uses openrpc_socket (JSON-RPC health method); myfs-hub and myfs-ui use http_url (/health GET endpoint) combined with their respective socket paths for HTTP-over-UDS probes. myfs binary size: 5.2 MB (up from 2.5 MB after adding hero_proc_sdk). Related: ADR-010, PRD 0001 phase 6.new-archto wip: new-arch`TempDir::new("myfs-container").path().with_extension("fl")` produced the fixed `/tmp/myfs-container.fl` for every call, ignoring `--store` and overwriting on the next run. Sanitize the image name, drop the registry-host prefix, and write into the first `dir://` entry of `--store` when available; otherwise use a uniquely-named tempfile that survives the working tempdir.The preview handler was passing the joined {flist_dir}{captured} string through validate_flist_path, which assumes a relative flist_dir and rejects absolute paths. Since the captured portion is already guaranteed relative and .. -free by the wildcard guard, skip the legacy validator and check component count directly.wip: new-archto WIP: wip: new-archWIP: wip: new-archto microservice rearchitecturedon't merge this, talk to me first please
microservice rearchitectureto WIP: microservice rearchitecturemyfs-cli/src/main.rs grew to ~600 lines with mixed concerns. Split into: cli.rs clap structs, with a shared ServerOpts flattened into upload-dir / flist-create / website-publish util.rs abs_path / abs_store / default_parallel / emit (+ 4 tests) lifecycle.rs three near-identical ActionBuilder blocks collapsed into one build_action(ActionPlan) helper; the four HERO_*_DIR fallbacks share one hero_subdir helper main.rs thin dispatcher (223 lines) Correctness fixes: - Remove `download-dir` subcommand. The SDK has no download_dir method; it was silently aliased to download and never worked end-to-end. - Rename MyFS_TOKEN → MYFS_TOKEN everywhere (cli / hub / tool / lib / docs / tests). Linux env vars are case-sensitive and every other var in the project is all-caps; this was a long-standing drift. - Delete stale `// NOTE: ... SDK gap` comments whose referenced fields are already plumbed through. Docs / tests: - Drop download-dir from user-facing docs and architecture overview. - Rewrite the syncing-files tutorial verification step and the two e2e test functions (directory download, parallel download perf) to use the `download <flist-hash>` + `unpack --meta` flow — the actual supported path. - docs/plans/* left alone (historical intent). Breaking: - MyFS_TOKEN env var must be renamed to MYFS_TOKEN. - `myfs download-dir` is gone; use `myfs download <flist-hash> -o f.fl && myfs unpack --meta f.fl --target dir/`.- flist_inspect/flist_tree: collect walk results into the RPC response instead of printing to server stdout and returning a placeholder. - Download remote flists via tempfile::NamedTempFile (RAII cleanup, unique path) to replace /tmp/flist_*_{target}.fl which was both injectable via caller input and leaked on error paths. - shutdown_all_mounts: cancel in parallel via JoinSet, bounded by a 10s timeout with abort_all() for stragglers so a stuck FUSE task cannot hang process exit.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.