Skip to content

Commit

Permalink
feat: copy to clipboard with custom behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoBorai committed Jun 3, 2024
1 parent a2e55d9 commit b14aba7
Show file tree
Hide file tree
Showing 28 changed files with 648 additions and 174 deletions.
15 changes: 5 additions & 10 deletions docs/fluvio/concepts/advanced/install-on-rancher.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ Please make sure that the container runtime is `dockerd (moby)`. That configurat

You can start a Fluvio cluster by running `fluvio cluster start`.

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster start --k8 --use-k8-port-forwarding
```

If rancher desktop is configured to manage a kubernetes cluster on a non-local host or ip, the `--proxy-addr` argument needs to provide that host dns name, or ip of that cluster.

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster start --k8 --proxy-addr HOSTNAME_OR_IP
```

Expand All @@ -56,8 +54,7 @@ Let's use the Fluvio CLI to play with some basic functionality.

The first thing we need to do is create a [topic].

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create greetings
topic greetings created
```
Expand All @@ -66,15 +63,13 @@ Now that we have a topic, we can [produce] some messages!

Use the following command to send a message to the `greetings` topic:

%copy first-line%
```bash
```bash copy="fl"
$ echo Hello, Fluvio | fluvio produce greetings
```

Finally, we can [consume] messages back from the topic

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consume greetings -B -d
Consuming records from the beginning of topic 'greetings'
Hello, Fluvio
Expand Down
15 changes: 5 additions & 10 deletions docs/fluvio/concepts/advanced/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ If you run into any problems along the way, make sure to check out our [troubles

This command will install Fluvio and it's dependencies in the default namespace. This method works with many but not all kubernetes cluster types and is an opinionated set of configurations for a simple, working fluvio cluster.

%copy first-line%
```shell
```shell copy="fl"
$ fluvio cluster start --k8
```

For installing on a remote Kubernetes cluster where the machine running the CLI is not the local host, consider using the `--proxy-addr <DNS or IP>` option which will access the fluvio app endpoints through the specified proxy address.

%copy first-line%
```shell
```shell copy="fl"
$ fluvio cluster start --k8 --proxy-addr <DNS or IP>
```

Expand All @@ -39,8 +37,7 @@ to a working `kubectl` context. The charts are available in the [fluvio reposito

There are two charts. First is the `fluvio-sys` chart which is common to all Fluvio instances. Second is a `fluvio-app` chart which can be configured for one or more instances of clusters

%copy first-line%
```bash
```bash copy="fl"
helm upgrade --install fluvio-sys ./k8-util/helm/fluvio-sys
```

Expand All @@ -63,8 +60,7 @@ the scope of this guide and require modification of the helm chart values. Feel

First, install the `fluvio-sys` chart. This only has to be done once.

%copy first-line%
```bash
```bash copy="fl"
helm upgrade --install fluvio-sys ./k8-util/helm/fluvio-sys
```

Expand Down Expand Up @@ -110,8 +106,7 @@ and so forth.

To delete a Fluvio instances, supply namespace as an argument.

%copy first-line%
```shell
```shell copy="fl"
$ fluvio cluster delete --k8 --namespace first
```

Expand Down
3 changes: 1 addition & 2 deletions docs/fluvio/concepts/architecture/replica-assignment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ Replicas are evenly distributed across SPUs. Racks with a higher number of SPUs

The following command creates a topic from a **replica assignment file**:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create custom-topic --replica-assignment ./my-assignment
```

Expand Down
27 changes: 9 additions & 18 deletions docs/fluvio/concepts/operations/data-retention.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,35 @@ The default retention time is `7 days`
### Example retention configurations
* Delete old segments that are `6 hours` old

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create test1 --retention-time "6h"
```

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic list
NAME TYPE PARTITIONS REPLICAS RETENTION TIME STATUS REASON
test1 computed 1 1 6h resolution::provisioned
```

* Delete old segments that are a day old

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create test2 --retention-time "1d"
```

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic list
NAME TYPE PARTITIONS REPLICAS RETENTION TIME STATUS REASON
test2 computed 1 1 1day resolution::provisioned
```

* A very specific duration that is 1 day, 2 hours, 3 minutes and 4 seconds long

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create test3 --retention-time "1d 2h 3m 4s"
```

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic list
NAME TYPE PARTITIONS REPLICAS RETENTION TIME STATUS REASON
test3 computed 1 1 1day 2h 3m 4s resolution::provisioned
Expand All @@ -101,15 +95,13 @@ The default segment size is `1 GB`
### Example retention configurations
* 25 MB segment size w/ 7 day retention time

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create test4 --segment-size 25000000
```

* 36 GB segment size w/ 12 hr retention time

%copy first-line%
```bash
```bash copy="fl"
$ fluvio topic create test5 --segment-size "36 GB" --retention-time 12h
```

Expand All @@ -134,8 +126,7 @@ The max partition size must not be less than segment size.

* 10 GB max partition size w/ 1 GB segment size (only 10 segments are allowed at any time)

%copy first-line%
```bash
```bash copy="fl"
fluvio topic create test6 --max-partition-size '10 GB' --segment-size '1 GB'
```

Expand Down
6 changes: 2 additions & 4 deletions docs/fluvio/concepts/operations/monitor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ These objects represent the state of the Fluvio cluster.

Example:

%copy first-line%
```bash
```bash copy="fl"
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
fluvio-sc-6458d598d6-qq2td 1/1 Running 0 3m35s
Expand All @@ -24,8 +23,7 @@ fluvio-spg-main-0 1/1 Running 0 3m28s

Example:

%copy first-line%
```bash
```bash copy="fl"
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
fluvio-sc-internal ClusterIP 10.96.41.31 <none> 9004/TCP 4m18s
Expand Down
11 changes: 5 additions & 6 deletions docs/fluvio/concepts/operations/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ To diagnose abnormal behavior, a good first step is to run `fluvio cluster check

If everything is configured properly, you should see a result like this:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster check
Running pre-startup checks...
✅ Kubernetes config is loadable
Expand All @@ -31,13 +30,13 @@ next: run `fluvio cluster start`
To discover errors, you should examine logs from the following components:

### SC
%copy first-line%
```bash

```bash copy="fl"
kubectl logs -l app=fluvio-sc
```
### SPU
%copy first-line%
```bash

```bash copy="fl"
kubectl logs -l app=spu
```

Expand Down
12 changes: 4 additions & 8 deletions docs/fluvio/concepts/operations/upgrade.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ is [update the Fluvio CLI] using the following command:

[update the Fluvio CLI]:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio update
```

After updating the CLI, we can upgrade the Fluvio _cluster_ using this command:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster upgrade
```

Expand All @@ -29,8 +27,7 @@ your Kubernetes cluster.
You may optionally specify a specific Fluvio chart version by adding
the `--chart-version` argument to the upgrade command, such as the following:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster upgrade --chart-version=0.8.3
```

Expand All @@ -40,7 +37,6 @@ The possible versions you may pass to `--chart-version` correspond to the
available helm charts published on the Fluvio chart museum. You may view
this list of releases quickly with the command:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio cluster releases list
```
21 changes: 7 additions & 14 deletions docs/fluvio/concepts/produce-consume.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,15 @@ $ echo "Two" | fluvio produce hello-topic
```
Ok, now let's read the topic from the beginning on behalf of consumer `c1`:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consume hello-topic -c c1 -Bd
Consuming records from 'hello-topic' starting from the beginning of log
One
Two
```
From now we can see our `c1` consumer in the consumers list:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consumer list
CONSUMER TOPIC PARTITION OFFSET LAST SEEN
c1 hello-topic 0 1 4m 14s
Expand All @@ -80,23 +78,20 @@ The offset here denotes the last seen offset for the given consumer in the given

Let's add another record to the topic:

%copy first-line%
```bash
```bash copy="fl"
$ echo "Three" | fluvio produce hello-topic
```
and read the topic again from the beginning for the same consumer:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consume hello-topic -c c1 -Bd
Consuming records from 'hello-topic' starting from the beginning of log
Three
```
we get only one "unseen" record which is correct.
Now if you try another consumer `c2`, you get all the records:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consume hello-topic -c c2 -Bd
Consuming records from 'hello-topic' starting from the beginning of log
One
Expand All @@ -106,8 +101,7 @@ Three

The consumer list now shows us two consumers:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consumer list
CONSUMER TOPIC PARTITION OFFSET LAST SEEN
c1 hello-topic 0 2 3m 51s
Expand All @@ -116,8 +110,7 @@ $ fluvio consumer list

We can delete them now:

%copy first-line%
```bash
```bash copy="fl"
$ fluvio consumer delete c1
consumer "c1" on topic "hello-topic" and partition "0" deleted
$ fluvio consumer delete c2
Expand Down
Loading

0 comments on commit b14aba7

Please sign in to comment.