Skip to main content

Background run + logging (lcpd-grpcd)

This doc describes practical ways to:
  • run lcpd-grpcd in the background
  • keep logs on disk (with basic rotation)
Note: logs are sensitive. 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. 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)

Then edit .envrc to add your LCPD_* settings. Requester-only (no Provider execution) tip:
  • If you run from a directory containing config.yaml, lcpd-grpcd will use it by default.
  • This repo’s go-lcpd/config.yaml keeps the Provider disabled by default.
  • If you have a different config.yaml that enables the Provider (or you’re running from another working directory), you can force Provider disabled by setting LCPD_PROVIDER_CONFIG_PATH=/dev/null (empty YAML).

2) Start / stop

Start (background):
Status:
Tail logs:
Stop (graceful SIGINT):

Sanity checks

Quick status checks:
Port-level checks (pick one):
If you override the listen address (e.g. 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.log is a symlink pointing at the current run’s log file.
  • Only the newest LCPD_GRPCD_LOG_KEEP_ROTATED run logs are kept (default 10).

Option B: systemd (Linux)

systemd gives you:
  • auto-restart on crashes
  • boot-time startup
  • robust log retention via journald
Minimal user service example (recommended when lnd certs/macaroons live under your home directory):
  1. Write ~/.config/systemd/user/lcpd-grpcd.service:
  1. Start + enable:
  1. Logs:
To keep user services running across reboots without an active login session, you may need:

Option C: launchd (macOS)

launchd is the macOS service manager. For background + auto-restart, use a LaunchAgent (runs as your user).
  1. Create ~/Library/LaunchAgents/com.bruwbird.lcpd-grpcd.plist (adjust absolute paths):
  1. Load it:
  1. Inspect status:
Notes:
  • The plist uses direnv exec so you can keep credentials out of the plist itself (store secrets in .envrc).
  • macOS does not rotate these log files automatically; use newsyslog or periodically archive/delete old logs.