anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

Add `juvix dev anoma {start, stop, status}` to manage an Anoma client #3183

Closed paulcadman closed 3 days ago

paulcadman commented 4 days ago

This PR adds the juvix dev anoma {start, stop, status} commands to manage a running Anoma client.

The motivation for this is that we can add additional commands (e.g indexer, prove, (mempool)-submit) which interact with the persistent Anoma client.

juvix dev anoma start now writes a configuration file in <juvix_config>/anoma-client/config.yaml which contains the host URL and port of the started Anoma client and the pid of the Anoma client process.

For example:

config.yaml

host:
  port: 58922
  url: localhost
pid: 75299

The anoma stop command kills the Anoma client and the anoma status command shows the config of the currently running client.

There can be at most one Anoma client running when using this mechanism.

Dependency

This PR adds a new dependency on the unix package. This is used for APIs to send signals to processes.

CLI docs

juvix dev anoma

Usage: juvix dev anoma COMMAND

  Subcommands related to the Anoma client

Available options:
  -h,--help                Show this help text

Available commands:
  start                    Start an Anoma client
  status                   Show the status of the Anoma client
  stop                     Stop the Anoma client

juvix dev anoma start

Usage: juvix dev anoma start --anoma-dir ANOMA_DIR [-g|--foreground]
                             [-f|--force]

  Start an Anoma client

Available options:
  --anoma-dir ANOMA_DIR    Path to anoma repository
  -g,--foreground          Start the client in the foreground
  -f,--force               Forcefully start a client, terminating any currently
                           running client if necessary
  -h,--help                Show this help text

juvix dev anoma status

Usage: juvix dev anoma status

  Show the status of the Anoma client

Available options:
  -h,--help                Show this help text

juvix dev anoma stop

Usage: juvix dev anoma stop

  Stop the Anoma client

Available options:
  -h,--help                Show this help text