Skip to content

Commit

Permalink
Update README and minor fixes (#72)
Browse files Browse the repository at this point in the history
* Update README and minor fixes

* Update brew command
  • Loading branch information
cdavid authored Feb 27, 2023
1 parent 5f9f5f6 commit b3a9a0d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 94 deletions.
109 changes: 17 additions & 92 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@ A CLI implementation for YB Managed.

# Install with brew

- `export HOMEBREW_GITHUB_API_TOKEN=<GITHUB_API_TOKEN>`
- Github allows the creation of fine-grained personal access tokens. The details can be found [here](https://github.com/settings/personal-access-tokens/new). Please ensure that the token has READ ONLY access only to the `Contents` section of the `ybm-cli` repository.
- `brew tap yugabyte/ybm-cli https://github.com/yugabyte/ybm-cli.git`
- `brew install ybm-cli`
- `brew install yugabyte/yugabytedb/ybm`

# Global configuration
This CLI support 3 possibles configurations:
* Passing values as flags
```shell
```sh
ybm --apiKey AWERDFSSS --host cloud.yugabyte.com cluster get
```

* Using a configuration file called `.ybm-cli.yaml` under your `$HOME` directory.
You can use the command `ybm configure` to help to setup the file

* Using environment variables (all need to start with `YBM_`)
```shell
export YBM_APIKEY=AWERDFSSS
export YBM_HOST=cloud.yugabyte.com
ybm cluster get
```
```sh
export YBM_APIKEY=AWERDFSSS
export YBM_HOST=cloud.yugabyte.com
ybm cluster get
```

By default, `https` will be added to the host if no scheme are provided if you want to use `http`
just add it to the host `http://cloud.yugabyte.com`

![Demo of the CLI](./resources/demo.gif)

## Sample Commands:

Expand All @@ -37,15 +36,15 @@ just add it to the host `http://cloud.yugabyte.com`
```sh
ybm cluster create \
--cluster-name=test-cluster \
--credentials=username=anonymous,password=password123
--credentials=username=admin,password=YBM.Is.Always.Great!
```

This will use configured default values to spawn the cluster. A single node synchronous cluster will be provisioned in AWS in the `us-west-2` region with 2 vCPUs, 4GB RAM and 10GB disk.
##### All possibilities
```sh
ybm cluster create
--cluster-name=test-cluster \
--credentials=username=anonymous,password=password123 \
--credentials=username=admin,password=YBM.Is.Always.Great! \
--cloud-type=[AWS or GCP] \
--cluster-type=[SYNCHRONOUS or GEO_PARTITIONED] \
--node-config=num-cores=<num-cores>,disk-size-gb=<disk-size-gb> \
Expand Down Expand Up @@ -89,7 +88,7 @@ ybm network-allow-list get

#### Get Network Allow List
```sh
ybm network-allow-list get
ybm network-allow-list get \
--name=admins
```

Expand All @@ -102,7 +101,7 @@ ybm cluster assign network-allow-list \

#### Delete Network Allow List
```sh
ybm network-allow-list delete
ybm network-allow-list delete \
--name=admins
```

Expand Down Expand Up @@ -144,7 +143,7 @@ All the read replicas will be deleted. To delete only specific read replicas, us
ybm vpc create \
--name=demo-vpc \
--cloud=GCP \
--global-cidr=10.0.0.0/18 \
--global-cidr=10.0.0.0/18
```

#### List VPCs
Expand Down Expand Up @@ -185,88 +184,16 @@ ybm vpc-peering get

#### Get VPC Peering
```sh
ybm vpc-peering get
ybm vpc-peering get \
--name=demo-peer
```

#### Delete VPC Peering
```sh
ybm vpc-peering delete
ybm vpc-peering delete \
--name=demo-peer
```

### CDC Sink

#### Create CDC Sink
```sh
ybm cdc-sink create \
--name=sink-2 \
--hostname=kafka.self.us \
--auth-type=BASIC \
--cdc-sink-type=KAFKA \
--username=something \
--password=something \
```

#### List CDC Sinks
```sh
ybm cdc-sink get
```
#### Get CDC Sink
```sh
ybm cdc-sink get \
--name=sink-2
```
#### Update CDC Sink

```sh
ybm cdc-sink update \
--name=sink-2 \
--new-name=new-sink-2
```

#### Delete CDC Sink
```sh
ybm cdc-sink delete \
--name=sink-2
```

### CDC Stream

#### Create CDC Stream
```sh
ybm cdc-stream create \
--name=cdc-stream-1 \
--cluster-name=test-cluster-2 \
--db-name=yugabyte \
--kafka-prefix=kafkaPrefix \
--sink=cdc-sink \
--tables=public.dept
```

#### List CDC Streams

```sh
ybm cdc-stream get
```

#### Get CDC Stream
```sh
ybm cdc-stream get \
--name=cdc-stream-1
```

#### Update CDC Stream
```sh
ybm cdc-stream update \
--name=cdc-stream-1 \
--tables=public.emp
```
#### Delete CDC Stream
```sh
ybm cdc-stream delete \
--name=cdc-stream-1
```
### Wait

All the long running commands like the cluster creation, cluster deletion etc have the `--wait` option to wait until the operation is completed.
Expand All @@ -280,9 +207,7 @@ ybm cluster delete \
If you are using the CLI with the `--wait` flag in your CI system you can specify the environment variable `YBM_CI` to `true` to avoid
generating unnecessary logs lines.

[![asciicast](https://asciinema.org/a/dUSEfk4cJKdsxsZ8gnIU4l4lY.svg)](https://asciinema.org/a/dUSEfk4cJKdsxsZ8gnIU4l4lY)

## Update CLI
## Update REST API Client
- make update-cli


6 changes: 5 additions & 1 deletion cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package cmd
import (
"fmt"
"os"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -34,8 +35,11 @@ var configureCmd = &cobra.Command{
var host string
fmt.Scanln(&apiKey)
viper.GetViper().Set("apikey", &apiKey)
fmt.Print("Enter Host: ")
fmt.Print("Enter Host (leave empty for default cloud.yugabyte.com): ")
fmt.Scanln(&host)
if strings.TrimSpace(host) == "" {
host = "cloud.yugabyte.com"
}
viper.GetViper().Set("host", &host)
err := viper.WriteConfig()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
ybmAuthClient "github.com/yugabyte/ybm-cli/internal/client"
)

var version = "v0.1.0"
var version = "v0.0.1-dev"

func main() {
ybmAuthClient.SetVersion(version)
Expand Down
Binary file added resources/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b3a9a0d

Please sign in to comment.