Background run + logging (lcpd-grpcd)
This doc describes practical ways to:- run
lcpd-grpcdin the background - keep logs on disk (with basic rotation)
lcpd-grpcd is designed to avoid logging raw prompts/outputs, but logs still contain metadata
(peer ids, job ids, prices, timings). See Logging & privacy.
For long-running infrastructure, use a service manager (systemd/launchd).
For “keep running after I close my terminal”, the repo script is usually enough.
Option A (recommended for quick use): repo script + log file
The repo ships a small runner script:0) Build the daemon binary (one-time)
1) Configure environment
You can keep startup parameters and secrets out of your shell history by using direnv (.envrc, recommended). If you don’t use direnv, export LCPD_* env vars
in your shell or service manager configuration.
Option A: direnv (.envrc)
.envrc to add your LCPD_* settings.
Requester-only (no Provider execution) tip:
- If you run from a directory containing
config.yaml,lcpd-grpcdwill use it by default. - This repo’s
go-lcpd/config.yamlkeeps the Provider disabled by default. - If you have a different
config.yamlthat enables the Provider (or you’re running from another working directory), you can force Provider disabled by settingLCPD_PROVIDER_CONFIG_PATH=/dev/null(empty YAML).
2) Start / stop
Start (background):Sanity checks
Quick status checks:LCPD_GRPCD_GRPC_ADDR=127.0.0.1:15051), adjust the port accordingly.
Logs + rotation behavior
- Log link path default:
./.data/lcpd-grpcd/logs/lcpd-grpcd.log(gitignored) - PID file:
./.data/lcpd-grpcd/pids/lcpd-grpcd.pid - At each startup, a new dated log file is created (e.g.
lcpd-grpcd.YYYYmmdd-HHMMSS.<pid>.<rand>.log). lcpd-grpcd.logis a symlink pointing at the current run’s log file.- Only the newest
LCPD_GRPCD_LOG_KEEP_ROTATEDrun logs are kept (default 10).
Option B: systemd (Linux)
systemd gives you:- auto-restart on crashes
- boot-time startup
- robust log retention via journald
lnd certs/macaroons live under your home directory):
- Write
~/.config/systemd/user/lcpd-grpcd.service:
- Start + enable:
- Logs:
Option C: launchd (macOS)
launchd is the macOS service manager. For background + auto-restart, use a LaunchAgent (runs as your user).- Create
~/Library/LaunchAgents/com.bruwbird.lcpd-grpcd.plist(adjust absolute paths):
- Load it:
- Inspect status:
- The plist uses
direnv execso you can keep credentials out of the plist itself (store secrets in.envrc). - macOS does not rotate these log files automatically; use
newsyslogor periodically archive/delete old logs.