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 LiteFS Cloud commands #2786

Merged
merged 6 commits into from
Oct 19, 2023
Merged

Add LiteFS Cloud commands #2786

merged 6 commits into from
Oct 19, 2023

Conversation

benbjohnson
Copy link
Contributor

@benbjohnson benbjohnson commented Sep 4, 2023

Change Summary

What and Why: This pull request adds CLI commands for managing LiteFS Cloud clusters. These commands include listing clusters, listing databases, import/exporting databases, & restoring databases.

How: Added a subcommand called litefs-cloud which is also aliased to lfsc for brevity.

Related to: Users have requested CLI access to LiteFS Cloud (superfly/litefs#392).


Documentation

  • Fresh Produce
  • In superfly/docs, or asked for help from docs team

@benbjohnson
Copy link
Contributor Author

@michaeldwan This is my first big PR against flyctl so I'd appreciate any feedback you have regarding conventions. I need to add docs and Fresh Produce and fix up CI but I wanted to push something up for review.

Copy link
Contributor

@tvdfly tvdfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how long can the import/export commands take? if more than a couple seconds is possible, how about displaying a message on stderr about them potentially taking a while?

The fly lfsc clusters list command help was confusing to me. I ran:

% fly lfsc clusters list
Error: no org was provided, and none is available from the environment or fly.toml

then tried appending the org name:

fly lfsc clusters list tvd-testorg
Usage:
  flyctl usage clusters list <clustername> [flags]

Flags:
  -h, --help         help for list
  -j, --json         JSON output
  -o, --org string   The target Fly organization

Global Flags:
  -t, --access-token string   Fly API Access Token
      --debug                 Print additional logs and traces
      --verbose               Verbose output

Error: unknown command "fly" for "flyctl usage clusters list"

I then figured out i was supposed to use --org. I think my intuition is to allow the org name to be passed in as an optional position argument. What if we provide a separate fly lfsc clusters show command for showing info on a single cluster (or fix the usage for the list subcommand)?

I noticed the --json output includes pagination info. What if we show 20 by default and allow devs to pass in a flag that enables showing more (e.g., a --max-cluster or --limit flag or something like that)?

% fly lfsc clusters list -o tvd-testorg --json
{
    "offset": 0,
    "limit": 20,
    "total": 0,
    "clusters": []
}```

@dangra
Copy link
Member

dangra commented Sep 6, 2023

"lfsc" is a bit cryptic for the non-initiated. Can we call the subcommand litefs instead?

@benbjohnson benbjohnson force-pushed the lfsc branch 2 times, most recently from 5c3a95c to 02df2b0 Compare October 18, 2023 22:05
@benbjohnson
Copy link
Contributor Author

I'm finally getting back to this PR after having focus my attention elsewhere. I fixed up the PR and added cluster creation & deletion.

I then figured out i was supposed to use --org. I think my intuition is to allow the org name to be passed in as an optional position argument.

The --org flag is only needed if you're not in an app directory. It'll automatically determine the org if you are.

What if we show 20 by default and allow devs to pass in a flag that enables showing more (e.g., a --max-cluster or --limit flag or something like that)?

I added --offset and --limit args to the clusters list command.

"lfsc" is a bit cryptic for the non-initiated. Can we call the subcommand litefs instead?

I opted for litefs-cloud and lfsc instead of just litefs since LiteFS itself would refer to the users cluster of nodes (rather than the cloud service itself). I could see adding litefs commands for directly communicating with the user's LiteFS instances in the future and then litefs export and litefs-cloud export would be two separate concepts. At least, that's how I think of it in my head.

@benbjohnson benbjohnson merged commit d07b604 into master Oct 19, 2023
@benbjohnson benbjohnson deleted the lfsc branch October 19, 2023 19:55
tqbf pushed a commit that referenced this pull request Oct 26, 2023
* Add LiteFS Cloud commands

* Add lfsc clusters destroy

* Add cluster create and regions commands

* Fix lfsc aliases

* Add pagination to 'lfsc clusters list'

* go mod tidy
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.

3 participants