Skip to content

Accept service names in service start and stop - #1364

Open
tidelit4 wants to merge 2 commits into
rocket-pool:masterfrom
tidelit4:feat/service-start-stop-names
Open

tidelit4 wants to merge 2 commits into
rocket-pool:masterfrom
tidelit4:feat/service-start-stop-names

Conversation

@tidelit4

@tidelit4 tidelit4 commented Dec 2, 2026

Copy link
Copy Markdown

rocketpool service start and rocketpool service stop now take optional service names, the same way service logs does. They're passed to docker compose up -d and docker compose stop, so you can stop or start a single container without touching the rest of the stack:

rocketpool service stop grafana
rocketpool service start grafana
rocketpool service stop cc vc

The ec/cc/vc (and el, cl, bn, ...) aliases from service logs work here too. The alias switch moved out of serviceLogs into a small resolveServiceNames helper so all three commands share it.

Without service names both commands run exactly the same compose command as before.

service start with names still runs every check it runs today (config validation, the upgrade prompt, the anti-slashing delay when the validator client changed, the IPv6 network check). Only the final docker compose up is narrowed. Compose also starts the listed services' depends_on services, so start validator can bring eth2 up too. Unknown names are rejected by compose (no such service).

service stop with names asks "Are you sure you want to pause grafana? ...". The warning says that stopping the EC, CC or VC will cause penalties. Without names the prompt is unchanged.

Tested with unit tests for the compose arguments and the alias mapping, go build ./..., go vet and golangci-lint. I also checked the generated up/stop commands against a throwaway busybox compose project: stopping one service left the other running, and up with a name started only that one again. CI run: https://github.com/tidelit4/smartnode/actions/runs/46820740605. Not tested on a live node.

Closes #357

AI disclosure: written with help from an AI coding assistant (Claude); I reviewed the change and the tests.

`rocketpool service start` and `rocketpool service stop` now take optional
service names, like `service logs` already does, and pass them to
`docker compose up` / `docker compose stop`. Without names, both commands
behave exactly as before. The ec/cc/vc aliases from `service logs` are
shared through a small helper.

Closes rocket-pool#357

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xfornax

0xfornax commented Dec 3, 2026

Copy link
Copy Markdown
Member

Hey, thanks for the recent submissions! I have a couple concerns with this PR:

  • startService does the IPv6 network drift check even when you only asked to start one service. If that check fires, recreateDockerNetwork stops and removes every container, and then it only brings back the ones named. So rocketpool service start grafana (especially with -y) could take down the EC/CC/VC and leave them stopped. Maybe it should bail out of a partial start in that case and tell the user to run a full service start instead

  • a successful single service start, say service start grafana, after an upgrade still calls RemoveUpgradeFlagFile, and it can run UpdateDefaults for the whole stack. The next full start then won't offer the upgrade prompt. I'd only do that flow when no service names were given.

`rocketpool service start <names>` now only acts on the named services:

- If the IPv6 setting no longer matches the live Docker network, a
  partial start stops with an error asking for a full
  `rocketpool service start`, instead of recreating the network (which
  stops and removes every container and would only bring back the named
  ones).
- The upgrade flow (prompt, UpdateDefaults, RemoveUpgradeFlagFile) only
  runs on a full start. A partial start after an upgrade prints a note,
  keeps the current settings and leaves the upgrade flag in place, so the
  next full start still offers the prompt.
- The validator client-swap check, which can stop the running validator
  and wait out the slashing delay, and the doppelganger note only apply
  when the validator is among the services being started.
- `--remove-orphans` is only passed on a full start, since it acts on the
  whole compose project.

Full starts (no service names) behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tidelit4

tidelit4 commented Dec 4, 2026

Copy link
Copy Markdown
Author

Thanks, both good catches. Fixed in 1605a20:

  • IPv6 network drift. The drift check now runs before anything is stopped (hasIPv6NetworkDrift, rocketpool-cli/service/service.go:761-771, 847). If service names were given and the network would have to be recreated, the partial start stops with an error saying the network needs recreating, which restarts every container, and asks for a full rocketpool service start. -y doesn't bypass this. A full start still prompts and recreates as before (service.go:797).
  • Upgrade flow. The prompt, UpdateDefaults/SaveConfig and RemoveUpgradeFlagFile now only run on a full start (service.go:710 and 833). A partial start after an upgrade prints a note that the new defaults are applied by a full service start, starts the named services with the current settings, and leaves the flag in place, so the next full start still shows the upgrade prompt.

While going through startService I found two more steps that act on the whole stack, and changed them the same way:

  • checkForValidatorChange can stop the running validator and then wait out the 15 minute slashing delay. On service start grafana that would leave the VC stopped. It now only runs when the validator is among the services being started (service.go:777, startsValidator at :841). The doppelganger note is gated the same way (service.go:812).
  • --remove-orphans acts on the whole compose project, so a partial start no longer passes it (shared/services/rocketpool/client.go:452, startArgs).

The Prometheus/Alertmanager config writes and the compose file regeneration still run on a partial start. They only write files from the current config and don't touch running containers, so I left them as they are. Full starts (no names) behave as before, and service stop had no whole-stack steps.

Verification: added unit tests for startsValidator and startArgs. CI on our fork ran this commit: gofmt, go build ./..., go vet on both packages, the full go test suite (minus bindings, same as unit-tests.yml) and golangci-lint v2.14.0 with the repo config all passed (0 issues). Run: https://github.com/tidelit4/smartnode/actions/runs/47405266143. The Docker paths (drift abort, upgrade flag) were checked by reading the code, not by running them against a live node.

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.

[Feature Request] Add optional argument to rocketpool service start

2 participants