Skip to content

Commit

Permalink
CLI v0.6.0 doc update. (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
vhadianto authored Jul 24, 2024
1 parent 89c8dd9 commit 1a5d1cc
Show file tree
Hide file tree
Showing 19 changed files with 95 additions and 15 deletions.
21 changes: 20 additions & 1 deletion docs/build/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ To interact with the various tools and services, Flowpipe also includes an `inte

Sending notifications is a common pattern, and often users will want to route a request to more than one user, group, or channel, and via more than one delivery mechanism. For instance, you may want to request approval via Slack AND email. The `notifier` resource allows you to define a list of integrations to send notifications to. Like `integration`, a `notifier` is an installation-level configuration resource.

Flowpipe [integrations](/docs/reference/config-files/integration/) require callback endpoints, so they only work in [server-mode](/docs/run/server). When you run a pipeline in [client-mode](/docs/run#operating-modes), notifications for [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) steps will only appear on the command line, regardless of your `notifier` and `integration` configuration. To send [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) requests to external services, you must run [Flowpipe server](/docs/run/server)!



## Adding an input step to your pipeline
Expand Down Expand Up @@ -51,7 +53,24 @@ pipeline "play_a_game" {
This pipeline will prompt the user to select a game to play using a `select` box (there are other [input step types](/docs/flowpipe-hcl/step/input#input-types), such as `text`, `button`, and `multiselect`).
After the user selects a game, the pipeline will send back a message with a hyperlink to the selected game.

The `input` and `message` steps route messages to an [integration](/docs/reference/config-files/integration) via a [notifier](/docs/reference/config-files/notifier). You don't need to create these to get started though; Flowpipe creates a default [`http` integration](/docs/reference/config-files/integration/http) as well as a [default notifier](/docs/reference/config-files/notifier#default-notifier) that routes to it.

## Running in Client-Mode

If you run the pipeline in [client-mode](/docs/run#operating-modes), pipes will prompt you on the console and wait for your response.

![](/images/docs/build/input_console_select_game.png)


Once you respond, the pipeline will continue.

![](/images/docs/build/play_game_console.png)


## Running in Server-Mode

Inputs and messages are sent only to the console when running in client-mode, which is suitable for testing your pipelines, or for running pipelines that do not require coordination with others. Running in server-mode, however, allows you to route messages and inputs to external systems and services, like Slack or email.

When running in server-mode, the `input` and `message` steps route messages to an [integration](/docs/reference/config-files/integration) via a [notifier](/docs/reference/config-files/notifier). You don't need to create these to get started though; Flowpipe creates a default [`http` integration](/docs/reference/config-files/integration/http) as well as a [default notifier](/docs/reference/config-files/notifier#default-notifier) that routes to it.

Integrations are only loaded in [server mode](/docs/run/server), so let's start the Flowpipe server:
```bash
Expand Down
37 changes: 32 additions & 5 deletions docs/flowpipe-hcl/step/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ sidebar_label: input

# input

Use the `input` step primitive to prompt for user input. The pipeline will send the prompt to one or more [integrations](/docs/reference/config-files/integration) via a [notifier](/docs/reference/config-files/notifier). It will then pause and wait for a response. When a response is received, the pipeline will continue and the step will return the selected `value`.
Use the `input` step primitive to prompt for user input. When the pipeline reaches an `input` step, it will prompt the user for input and then pause and wait for a response. When a response is received, the pipeline will continue and the step will return the selected `value`.

When you run a pipeline in [client-mode](/docs/run#operating-modes), notifications for `input` steps will only appear on the command line.

In [server-mode](/docs/run/server), notifications for `input` steps are not sent to the console. Instead, they are sent to [integrations](/docs/reference/config-files/integration/) such as Slack or Email via a [notifier](/docs/reference/config-files/notifier), allowing you to create collaborative workflows that integrate with your preferred communication channels.


```hcl
pipeline "my_step" {
Expand Down Expand Up @@ -85,6 +90,10 @@ This step also supports the [common step arguments](/docs/flowpipe-hcl/step#comm
----
### Button - Simple

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_button_simple_console.png)


##### HTTP
![](/images/docs/flowpipe-hcl/input_button_simple_http.png)

Expand Down Expand Up @@ -116,6 +125,9 @@ pipeline "my_pipe" {

### Button - With labels and values

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_button_simple_console.png)

##### HTTP
![](/images/docs/flowpipe-hcl/input_button_simple_http.png)

Expand Down Expand Up @@ -154,6 +166,10 @@ pipeline "my_pipe" {

### Select - basic

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_select_simple_console.png)


##### HTTP
![](/images/docs/flowpipe-hcl/input_select_simple_http_open.png)

Expand All @@ -162,7 +178,7 @@ pipeline "my_pipe" {


```hcl
pipeline "my_pipe" {
pipeline "my_select" {
step "input" "select_region" {
notifier = notifier.default
Expand Down Expand Up @@ -191,6 +207,9 @@ pipeline "my_pipe" {

#### Select - with labels & default selection

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_select_labels_console.png)

##### HTTP
![](/images/docs/flowpipe-hcl/input_select_labels_http_open.png)

Expand All @@ -199,7 +218,7 @@ pipeline "my_pipe" {


```hcl
pipeline "my_pipe" {
pipeline "my_select_labels" {
step "input" "select_region" {
notifier = notifier.default
Expand Down Expand Up @@ -237,6 +256,10 @@ pipeline "my_pipe" {

### Multiselect - basic

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_multiselect_simple_console.png)


##### HTTP
![](/images/docs/flowpipe-hcl/input_multiselect_simple_http_selected.png)

Expand All @@ -245,7 +268,7 @@ pipeline "my_pipe" {


```hcl
pipeline "my_pipe" {
pipeline "my_multi" {
step "input" "select_regions" {
notifier = notifier.default
Expand Down Expand Up @@ -275,6 +298,10 @@ pipeline "my_pipe" {

### Multiselect with labels & default selection

##### Console (Client-Mode)
![](/images/docs/flowpipe-hcl/input_multiselect_labels_console_selected.png)


##### HTTP
![](/images/docs/flowpipe-hcl/input_multiselect_labels_http_selected.png)

Expand All @@ -283,7 +310,7 @@ pipeline "my_pipe" {


```hcl
pipeline "my_pipe" {
pipeline "my_multi_labels" {
step "input" "select_regions" {
notifier = notifier.default
Expand Down
6 changes: 5 additions & 1 deletion docs/flowpipe-hcl/step/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ sidebar_label: message

# message

Use the `message` step to send a message to an [integration](/docs/reference/config-files/integration) via a [notifier](/docs/reference/config-files/notifier).
Use the `message` step to send a one-way notification message from your pipeline.

When you run a pipeline in [client-mode](/docs/run#operating-modes), notifications for `message` steps will only appear on the command line.

In [server-mode](/docs/run/server), notifications for `message` steps are not sent to the console. Instead, they are sent to [integrations](/docs/reference/config-files/integration/) such as Slack or Email via a [notifier](/docs/reference/config-files/notifier), allowing you to create collaborative workflows that integrate with your preferred communication channels.


```hcl
Expand Down
26 changes: 21 additions & 5 deletions docs/learn.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,15 @@ flowpipe pipeline run learn_flowpipe

![](/images/docs/learn/get-ipv4.png)

Flowpipe runs the pipeline and prints information about the currently executing steps. When the pipeline run completes, Flowpipe prints the pipeline's outputs.
Flowpipe runs the pipeline and prints its outputs once it is complete.

When troubleshooting, it's often useful to view more information about the currently executing steps. You can use the `--verbose` flag to show this detailed information.

```bash
flowpipe pipeline run learn_flowpipe --verbose
```

![](/images/docs/learn/get-ipv4-verbose.png)

## Using mods

Expand Down Expand Up @@ -201,9 +209,6 @@ pipeline "learn_flowpipe" {

Now we have a pipeline that can get the local forecast - let's send it somewhere! The [message step](/docs/flowpipe-hcl/step/message) provides a mechanism for sending messages via multiple communication channels, such as Slack and Email.


The `message` step (along with the [`input` step](/docs/build/input)) routes messages to an [integration](/docs/reference/config-files/integration) via a [notifier](/docs/reference/config-files/notifier). You don't need to create these to get started though; Flowpipe creates a default [`http` integration](/docs/reference/config-files/integration/http) as well as a [default notifier](/docs/reference/config-files/notifier#default-notifier) that routes to it.

Add this step to the `learn_flowpipe` pipeline.

```hcl
Expand All @@ -220,8 +225,19 @@ And run the pipeline again.
flowpipe pipeline run learn_flowpipe
```

You should see the message printed to the console when you run the pipeline. You can send it via [Email](/docs/reference/config-files/integration/email), [Slack](/docs/reference/config-files/integration/slack) or [Microsoft Teams](/docs/reference/config-files/integration/msteams) without modifying the pipeline code. Just create the appropriate [integrations](/docs/reference/config-files/integration), add them to the [default notifier](/docs/reference/config-files/notifier#default-notifier), and run the pipeline again!
You should see the message printed to the console when you run the pipeline.

Console messages and inputs are useful, but Flowpipe can also route these input requests, approvals and notifications to external systems like Slack, MS Teams, and Email!

Flowpipe [Integrations](/docs/reference/config-files/integration) allow you to interface with external systems. [Notifiers](/docs/reference/config-files/notifier) allow you to route [message](/docs/flowpipe-hcl/step/message) and [input](/docs/build/input) steps to one or more integrations. Integrations are only loaded in [server-mode](/docs/run/server).


Flowpipe server creates a default [`http` integration](/docs/reference/config-files/integration/http) as well as a [default notifier](/docs/reference/config-files/notifier#default-notifier) that routes to it, but you can send it via [Email](/docs/reference/config-files/integration/email), [Slack](/docs/reference/config-files/integration/slack) or [Microsoft Teams](/docs/reference/config-files/integration/msteams) without modifying the pipeline code. Just create the appropriate [integrations](/docs/reference/config-files/integration), add them to the [default notifier](/docs/reference/config-files/notifier#default-notifier), and run the pipeline again from a server instance!

```bash
flowpipe server &
flowpipe pipeline run learn_flowpipe --host local
```

![](/images/docs/learn/slack-weather-report.png)

8 changes: 8 additions & 0 deletions docs/reference/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ sidebar_label: Flowpipe CLI
</td>
</tr>

<tr>
<td nowrap="true"> <inlineCode>--data-dir</inlineCode> </td>
<td>
Sets the event store data directory. Flowpipe defaults to the `.flowpipe` directory in the current mod directory. This argument allows you to specify a different directory.
</td>
</tr>


<tr>
<td nowrap="true"> <inlineCode>-h</inlineCode>, <inlineCode>--help</inlineCode> </td>
<td> Help for Flowpipe. </td>
Expand Down
1 change: 1 addition & 0 deletions docs/reference/cli/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ flowpipe pipeline run pipeline_name [args]
|-|-|-
| `--arg string=string` | `run` | Specify the value of a pipeline argument. Multiple `--arg` arguments may be passed.
| `--detach` | `run` | Start the pipeline and return immediately. By default, `flowpipe pipeline run` will run the pipeline and wait for the results. You may only use `--detach` when running a pipeline from a server instance (by specifying `--host`, for example).
| `--execution-id` | `run`| Specify pipeline execution id. Execution id will generated if not provided.
| `--var string=string` | `run`| Specify the value of a variable. Multiple `--var` arguments may be passed.
| `--var-file strings`| `run`| Specify an .fpvar file containing variable values.
| `--verbose` | `run` | View detailed event information, including step arguments and attributes.
Expand Down
7 changes: 6 additions & 1 deletion docs/reference/config-files/integration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ sidebar_label: integration

# Integration

Use the `integration` block to configure how pipelines interact with external system, such as Slack or Email, via [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) steps. Integrations are *configuration* resources, defined in configuration files (`.fpc`), not mod files(`.fp`). Here's why:
Use the `integration` block to configure how pipelines interact with an external system, such as Slack or Email, via [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) steps.

Like [triggers](/docs/build/triggers), integrations require callback endpoints, so they only work in [server-mode](/docs/run/server). When you run a pipeline in [client-mode](/docs/run#operating-modes), notifications for [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) steps will only appear on the command line, regardless of your `notifier` and `integration` configuration. To send [input](/docs/flowpipe-hcl/step/input) and [message](/docs/flowpipe-hcl/step/message) requests to your integrations, you must run [Flowpipe server](/docs/run/server)!


Integrations are *configuration* resources, defined in configuration files (`.fpc`), not mod files(`.fp`). Here's why:
- The settings are installation-specific and may contain secrets.
- The settings are usually the same for *all* mods in a given installation.

Expand Down
4 changes: 2 additions & 2 deletions docs/run/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ Flowpipe will load [configuration files](/docs/reference/config-files) (`*.fpc`)

Flowpipe can operate in 2 modes.

By default, Flowpipe runs in **Client-only Mode**. Flowpipe loads the mod, runs the command, and exits. [Triggers](/docs/build/triggers) are not enabled in Client-Only Mode.
By default, Flowpipe runs in **Client-only Mode**. Flowpipe loads the mod, runs the command, and exits. [Triggers](/docs/build/triggers) are not enabled in Client-Only Mode. [Integrations](/docs/reference/config-files/integration/) are not available in Client-Only mode, and all [message](/docs/flowpipe-hcl/step/message) and [input](/docs/flowpipe-hcl/step/input) steps will route to the console.

If you run Flowpipe in **Server Mode** mode, Flowpipe will run an API server (on port `7103` by default). In [this mode](/docs/run/server), you can create [triggers](/docs/flowpipe-hcl/trigger) that run pipelines [on a schedule](/docs/flowpipe-hcl/trigger/schedule) or in response to events such as [webhooks](/docs/flowpipe-hcl/trigger/http). After you start the Flowpipe server, you can run Flowpipe commands against it by specifying the [--host](/docs/reference/cli) argument.
If you run Flowpipe in **[Server Mode](/docs/run/server)** mode, Flowpipe will run an API server (on port `7103` by default). In Server-Mode, you can create [triggers](/docs/flowpipe-hcl/trigger) that run pipelines [on a schedule](/docs/flowpipe-hcl/trigger/schedule) or in response to events such as [webhooks](/docs/flowpipe-hcl/trigger/http). Your pipelines can send [messages](/docs/flowpipe-hcl/step/message) and prompt for [input](/docs/flowpipe-hcl/step/input) via Slack, Email, or other [integrations](/docs/reference/config-files/integration/). After you start the Flowpipe server, you can run Flowpipe commands against it by specifying the [--host](/docs/reference/cli) argument.
Binary file added images/build/input_console_select_game.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/build/play_game_console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/learn/get-ipv4-verbose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/learn/get-ipv4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/learn/reallyfreegeoip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/learn/weather-report.png
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 1a5d1cc

Please sign in to comment.