Skip to content

Instantly share code, notes, and snippets.

@bixu
Last active June 7, 2018 17:31
Show Gist options
  • Save bixu/06eeb1036357837ef3a6fd8b574a87ad to your computer and use it in GitHub Desktop.
Save bixu/06eeb1036357837ef3a6fd8b574a87ad to your computer and use it in GitHub Desktop.
thoughts on service interactions for the Habitat CLI

Habitat CLI UX

What’s confusing now:

  • start does not load a service, but load starts one…
  • historically, start or load would also install a service, but this is no longer the case for start

Possible alternatives, with an imaginary workflow:

$ hab search/provides <ident>

$ hab install <ident>

$ hab start <ident>

Each of the above steps can be considered a set of nested sets representing service state:

——————————————————————————————————
——————————————————————————        |
————————————————          |       |
search/provides | install | start | 
————————————————          |       |
——————————————————————————        |
——————————————————————————————————

If user input is needed, like if we choose to start a not-yet-installed service, we should be present with a confirmation prompt and an optional auto-accept flag for automation:

$ hab start <ident>

<ident> is not installed. Do you want to install it now?
yes/no

$ hab start <ident> --yes

Prior Art

svcadm commands

enable [–s] Enables the service instances specified by the operands. For each service instance, the assigned restarter will try to bring it to the online state. If the –s option is specified, svcadm enables each service instance and then waits for each service instance to enter the online or degraded state. svcadm will return early if it determines that the service cannot reach these states without administrator intervention.

disable [–s] Disables the service instance specified by the operands.

restart [–s] Requests that the service instances specified by the operands be restarted.

refresh [–s] For each service instance specified by the operands, requests that the assigned restarter update the service's running configuration snapshot with the values from the current configuration.

clear [–s] For each service instance specified by the operands, if the instance is in the maintenance state, signal to the assigned restarter that the service has been repaired.

systemctl unit commands:

start Start (activate) one or more units specified on the command line.

stop Stop (deactivate) one or more units specified on the command line.

reload Asks all units listed on the command line to reload their configuration.

restart Stop and then start one or more units specified on the command line.

status Show terse runtime status information about one or more units, followed by most recent log data from the journal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment