edge / cli

Command line interface for the Edge network

Home Page:https://files.edge.network/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

edge device remove to be given an option that just removes the container

adamkdean opened this issue · comments

edge device remove to be given an option that just removes the container, not the stake too --container-only etc

commented

I've created a PR to meet this requirement, but the value added isn't clear to me.

device remove is primarily intended to decouple a device from the network and free its stake. It includes stopping/removing the container as a side effect, as the service would not be usable after stake dissociation. It also destroys the data volume with the device identity.

In adding the --container-only option, device remove becomes dual-purpose - it can be used to either remove the stake & device identity (and stop service in the process), or - just stop the service. If we aren't doing anything with the stake or data volume, then the command's behaviour is identical to device stop resulting in duplicate functionality.

I've done the work in #93 to show this requirement can be (and is!) met, but I don't think it should be merged in its current form. Potential routes forward:

  1. Close PR and this issue
  2. In place of --container-only use an --offline option to tells the command to skip updating blockchain and only remove the container and device identity. This preserves the distinction between remove (for device teardown) and stop while adding a useful failsafe

@annybs the --container-only option just needs to mimic docker stop edge-x & docker rm edge-x etc

commented

I hear you, but I'm saying the device stop command already does precisely that:

cli/src/device/cli.ts

Lines 384 to 387 in a9308a6

log.debug('stopping container', { id: info.Id })
await container.stop()
log.debug('removing container', { id: info.Id })
await container.remove()

So, as you're describing it (and as I've done it in the PR) we are duplicating functionality. device remove --container-only would be identical to device stop. We don't need two commands that do the exact same thing. The two options I've proposed are ways to avoid that ambiguity.

commented

We've discussed further on Discord and find there was a slight misunderstanding, NBD, the outcome of which is we no longer require this change. I'm now closing this issue and the PR.

The idea of device remove --offline is still faintly appealing but I'm not sure what edge case it serves so it remains out of scope for now.