Expand description
choir node serve — run the daemon without spelling out its flags.
Starting a node used to mean cargo run -p choir-node -- followed by
a repository root, a port and four --*-file paths, retyped or
copied out of a shell history. Every one of those is derivable from
the layout crate::init already writes, so this derives them: the
command that starts a node takes the same argument as the command
that created one, which is none.
§It does not stay in the middle
On unix this execs the daemon rather than spawning it, so the
process the supervisor watches, the process that receives a signal
and the process in ps are all choir-node itself. A wrapper that
lingered would add a pid that means nothing, swallow the exit code
the daemon uses to ask for supervision (75), and put a second thing
between launchd and the thing it is meant to restart.
§Examples
use choir_cli::serve::Layout;
let layout = Layout::new(std::path::Path::new("/tmp/choir-serve-example"), 8417);
// Derived, not configured: the same paths `choir init` wrote.
assert!(layout.repos.ends_with("repos"));
assert!(layout.auth.ends_with("auth"));Structs§
- Invocation
- The daemon invocation, built but not yet run.
- Layout
- Where a node’s state lives, by the convention
choir initwrites.
Functions§
- exec
- Replaces this process with the daemon.
- find_
daemon - Finds the
choir-nodebinary. - plan
- Builds the daemon invocation for a layout.
- port_of
- The port named by a node URL, if it names one.
- port_
taken - Whether something is already listening on this port.