Skip to content

feat: add prysmctl and client-stats incl install script for service#70

Merged
coincashew merged 1 commit intocoincashew:mainfrom
Jor-Tech:add-prysmctl-clientstats
Apr 22, 2025
Merged

feat: add prysmctl and client-stats incl install script for service#70
coincashew merged 1 commit intocoincashew:mainfrom
Jor-Tech:add-prysmctl-clientstats

Conversation

@Jor-Tech
Copy link
Copy Markdown
Contributor

feat(prysm): add prysmctl & client‑stats binaries + systemd service

Summary

This PR extends the Prysm update flow in update_consensus.sh to also download and install the prysmctl and client‑stats binaries, and to stop/restart a new client‑stats systemd service alongside the existing consensus and validator services. It also adds:

  • client-stats.service – a systemd unit for running the Prysm client‑stats exporter
  • install_client_stats_service.sh – an install script to deploy & enable that service

What’s Changed

  1. update_consensus.sh (Prysm case)

    • Added two new download targets:
      file_client_stats=client-stats-${prysm_version}-${_platform}-${_arch}
      file_prysmctl=prysmctl-${prysm_version}-${_platform}-${_arch}
    • Download both with curl -f -L … and make them executable:
      curl -f -L "https://prysmaticlabs.com/releases/${file_client_stats}" -o client-stats
      curl -f -L "https://prysmaticlabs.com/releases/${file_prysmctl}"     -o prysmctl
      chmod +x client-stats prysmctl
    • Stop/start the client‑stats service in line with consensus & validator:
      sudo systemctl stop client-stats   # before removal/install
      …
      sudo systemctl start client-stats  # after moving binaries
  2. New file: client-stats.service

    [Unit]
    Description=Prysm Client Stats
    Wants=network-online.target
    After=network-online.target
    Requires=validator.service
    
    [Service]
    Type=simple
    User=prysm
    Group=prysm
    Restart=on-failure
    RestartSec=3
    KillSignal=SIGINT
    TimeoutStopSec=900
    ExecStart=/usr/local/bin/client-stats \
      --beacon-node-metrics-url=http://localhost:8080/metrics \
      --validator-metrics-url=http://localhost:8081/metrics \
      --clientstats-api-url=https://beaconcha.in/api/v1/stats/<YOUR_BEACONCHA.IN_API-KEY>/<YOUR_VALIDATOR_NAME> \
      --scrape-interval 3m
    
    [Install]
    WantedBy=multi-user.target
    
    
  3. New file: install_client_stats_service.sh

#!/bin/bash

# Copy the service file to systemd directory
sudo cp client-stats.service /etc/systemd/system/

# Reload systemd to recognize the new service
sudo systemctl daemon-reload

# Enable the service to start on boot
sudo systemctl enable client-stats

# Start the service
sudo systemctl start client-stats

echo "Prysm client-stats service has been installed and started."

Testing & Verification

  1. Run the update script for Prysm:
./update_consensus.sh Prysm
  1. Confirm the new binaries exist and are executable:
ls -l /usr/local/bin/{prysmctl,client-stats}
  1. Verify the client-stats service status:
sudo systemctl status client-stats
  • Service should be loaded, enabled, and running without errors.
  1. (Optional) Tail the logs to confirm metrics scraping and API uploads:
sudo journalctl -u client-stats -f

@coincashew
Copy link
Copy Markdown
Owner

ser, this is the best PR I've ever seen. 🥇

Thank you for your contribution. 👍

Great work.

This would fit nicely into a EthPillar "plugin" template, which friendly prompts for <YOUR_BEACONCHA.IN_API-KEY>/<YOUR_VALIDATOR_NAME>.
I'll add those to the TODO list ;)

Thanks!

@coincashew coincashew merged commit 007c18a into coincashew:main Apr 22, 2025
1 check passed
@Jor-Tech Jor-Tech deleted the add-prysmctl-clientstats branch April 22, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants