Files
miner/examples/systemd/overrides/10-shared-hardware.conf
T
Nikolaus Heger 8d0c9f8023 docs: update systemd example for the serve CLI with required node auth (#86)
* docs: update systemd example for the serve CLI with required node auth

The unit and readme still described the old HTTP-API miner (MINER_PORT,
MINER_ENGINE, no subcommand). Update ExecStart to 'serve' and document the
now-required MINER_AUTH_TOKEN_FILE / MINER_TLS_CERT_SHA256_FILE, including
how to copy the node's miner-auth-token and miner-tls-cert-sha256 files
past ProtectHome=true, and refresh the env var reference to the current
CLI.

* docs: fix env-file example and CPU-worker claims per review

- Move inline comments off the env assignments: systemd EnvironmentFile=
  keeps inline '# ...' text as part of the value, so the copied example fed
  Clap unparseable values and the unit crash-looped under Restart=always.
- Describe the real worker behavior: CPUs are counted via the process
  affinity mask (num_cpus); unset MINER_CPU_WORKERS auto-detects ~50%, and
  an explicit value is used as-is — there is no clamp or warning.
- Drop the 'logs the detected cpuset mask' claim from the unit and override
  comments; no such logging exists in the miner.

* docs: metrics exporter is always on; purge-chain does not rotate credentials

- The Prometheus exporter starts unconditionally and binds plaintext HTTP on
  0.0.0.0:9900 by default; MINER_METRICS_PORT only changes the port. Say so
  everywhere instead of 'when metrics are enabled', and add a hardening note
  to firewall the port.
- Rephrase the credential-rotation pitfall: purge-chain removes only the
  database, so the node reloads the same miner-auth-token and TLS cert;
  rotation only happens when the base path changes or the files themselves
  are deleted.
2026-08-14 11:46:35 +08:00

53 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Drop-in override: conservative CPU affinity for shared hardware (node + miner)
# Place this file at:
# /etc/systemd/system/quantus-miner.service.d/10-shared-hardware.conf
#
# Then reload and restart:
# sudo systemctl daemon-reload
# sudo systemctl restart quantus-miner
#
# Rationale:
# - On shared hosts where the node and miner co-exist, bind the miner to a subset
# of logical CPUs, leaving the remainder for the node (and the OS scheduler).
# - Use a slightly lower CPU priority and moderate CPU weight so the node remains
# responsive under load.
#
# Notes:
# - CPUAffinity must be a subset of the service’s allowed cpuset (e.g., cgroups).
# - The miner counts CPUs via the process affinity mask and exports a
# miner_effective_cpus gauge on the always-on metrics endpoint.
# - Adjust the CPU list and worker count to match your hardware and cpuset.
#
# Example below assumes an 8‑way logical CPU system (IDs 0‑7).
# Reserve CPUs 0‑3 for the node and bind the miner to CPUs 4‑7.
[Service]
# Bind miner to specific CPUs (edit to match your topology).
# Check `lscpu` and any cpuset constraints (cgroup v2: /sys/fs/cgroup/cpuset.cpus.effective).
CPUAffinity=4 5 6 7
# Keep the node responsive; slightly lower miner priority (higher niceness value).
Nice=5
# If using cgroup v2, weight the miner below default (1–10000, default ~100).
# This helps the node compete for CPU on shared hardware.
CPUWeight=70
# I/O scheduling: best-effort with moderate priority.
IOSchedulingClass=best-effort
IOSchedulingPriority=4
# Default time-sharing policy is fine for CPU-bound workloads when pinned.
CPUSchedulingPolicy=other
# Optional: pin worker count and change the metrics port (uncomment and adjust as needed).
# Environment=MINER_CPU_WORKERS=4
# Environment=MINER_METRICS_PORT=9900
# Environment=RUST_LOG=info,miner=debug
# Optional: tighten memory/task limits if desired (ensure they fit your environment).
# MemoryAccounting=true
# TasksAccounting=true
# MemoryMax=infinity
# TasksMax=infinity