Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented Nov 21, 2024

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

@paulcadman paulcadman added this to the 0.6.9 milestone Nov 21, 2024
@paulcadman paulcadman self-assigned this Nov 21, 2024
@paulcadman paulcadman marked this pull request as draft November 21, 2024 16:16
@paulcadman paulcadman marked this pull request as ready for review November 21, 2024 17:22
This PR makes the `juvix dev anoma {start, stop, status}` commands
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.
Querying the pid is error-prone because the pid may refer to a different
process.
@paulcadman paulcadman force-pushed the anoma-client-commands branch from 6b38abe to 8f7b6e6 Compare November 22, 2024 14:40
@paulcadman paulcadman merged commit 669474f into main Nov 22, 2024
4 checks passed
@paulcadman paulcadman deleted the anoma-client-commands branch November 22, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants