Skip to content

Commit

Permalink
Change wording
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Jun 3, 2024
1 parent 6cf6726 commit 16f3ff6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
10 changes: 4 additions & 6 deletions using-gatewayd/Act.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ parent: Using GatewayD

# Act

Act, a core component of GatewayD, is a policy engine that supports signals, policies and actions. It is used to automate the execution of business rules. The business rules are currently written as expressions in the [Expr](https://github.com/expr-lang/expr) language, with support for external policy engines to come.
The expressions are evaluated against the signals received from the plugins. If the policy expressions evaluate to true (boolean) or any other type recognized by the corresponding action, then the action will be executed or, if configured, related data and parameters will be published to a redis Pub/Sub queue
enabling external systems and plugins to subscribe to it and run any arbitrary actions necessary based on the parameters.
Act, a core component of GatewayD, is a policy engine that supports signals, policies and actions. It enables a range of functionalities by automating the execution of business rules. The business rules are currently written as expressions in the [Expr](https://github.com/expr-lang/expr) language, with support for external policy engines to come. The expressions are evaluated against the signals received from the plugins (and possibly other sources). If the policy expressions evaluate to `true` (boolean) or any other type recognized by the corresponding action, then the action will be executed. Alternatively, Act can publish the result of policy evaluation to a Redis Pub/Sub queue in the [`Output`](https://github.com/gatewayd-io/gatewayd-plugin-sdk/blob/bc5513b395c6622b10db02b6608a972cef909e3d/act/io.go#L18-L24) format. This enables plugins and external systems to subscribe to the events published on that channel and run any arbitrary actions necessary based on the given parameters.

Previously, there were only a single signal, policy and action, called the `terminatePolicy`, which were hard-coded into the GatewayD codebase. This made it difficult to extend and customize the behavior of GatewayD. With the new Act, based on [this proposal](https://github.com/gatewayd-io/proposals/issues/5), the signals, policies and actions are pluggable and can be extended to support custom requirements. This opens up a wide range of possibilities for customizing the behavior of GatewayD to suit the needs of different use cases. For example, a policy can be written to check if the request is coming from a specific IP address, and if so, the action can be to terminate the request.

Expand Down Expand Up @@ -88,9 +86,9 @@ The `Hook` field is a map that contains the following fields:

## Actions

The action can be run in sync or async mode, and it can return a result or an error.
Async actions can be configured to be published to a redis channel instead of running in a background goroutine.
To configure Act to publish async actions to a redis channel, use `actionRedis` value of [general configuration](/using-gatewayd/plugins-configuration/general-configurations#Configuration parameters)
The action can be run in sync or async mode, and it can return a result or an error.
Async actions can be configured to be published to a Redis channel instead of running in a background goroutine.
To configure Act to publish async actions to a Redis channel, use `actionRedis` value of [general configuration](/using-gatewayd/plugins-configuration/general-configurations#Configuration parameters)
The actions are executed, or published, if the policy expressions evaluate to true (boolean) or any other type recognized by the action. The actions have the following fields:

1. `name`: The name of the action, such as `terminate`, `log`, etc.
Expand Down
12 changes: 6 additions & 6 deletions using-gatewayd/plugins-configuration/general-configurations.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
last_modified_date: 2024-05-31 20:16:38
last_modified_date: 2024-06-03 22:00:55
layout: default
title: General configurations
description: General configurations for plugins
Expand All @@ -13,7 +13,7 @@ grand_parent: Using GatewayD
## Configuration parameters

| Name | Type | Default value | Possible values | Description |
|---------------------|---------|------------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ------------------- | ------- | ---------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| compatibilityPolicy | string | strict | strict, loose | The compatibility policy controls how GatewayD treats plugins' requirements. If a plugin requires a specific version of another plugin, the compatibility policy controls whether to allow or reject the plugin.<br/>- strict (default): the plugin is rejected if it requires a specific version of another plugin and that version is not the one currently loaded.<br/>- loose: the plugin is allowed to run even if it requires a specific version of another plugin and that version is not the one currently loaded. |
| enableMetricsMerger | boolean | True | True, False | If enabled, GatewayD will merge the Prometheus metrics of all plugins over Unix domain socket. The metrics are merged and exposed via the GatewayD [metrics](/global-configuration/metrics) endpoint via HTTP. |
| metricsMergerPeriod | string | 5s | Valid duration strings | The metrics merger period controls how often the metrics merger should collect and merge metrics from plugins. |
Expand All @@ -24,10 +24,10 @@ grand_parent: Using GatewayD
| policyTimeout | string | 30s | Valid duration strings | The policy timeout controls how long to wait for a policy to evaluate before timing out. |
| policies | array | [] | An array of objects | The policies are a set of rules that are evaluated against the signals to determine whether the actions should be executed. |
| actionTimeout | string | 30s | Valid duration strings | The actionTimeout will set a default timeout for all the actions that are going to be executed. Action specific timeout has priority over this value. Set to `0` to remove default action timeout. |
| actionRedis | object | | | The actionRedis provides a redis connection to be used by act system to publish async actions to. If not given, or not enabled, async actions will run in a background goroutine. |
| actionRedis.enabled | boolean | False | True, False | If enabled, will use configuration to connect to a redis Pub/Sub channel and publish async actions data. |
| actionRedis.address | string | localhost:6379 | Valid redis connection url | URL used to connect to async action redis. |
| actionRedis.channel | string | gatewayd-actions | Any valid redis channel name | Name of the channel that async actions will be published to. |
| actionRedis | object | | | The actionRedis provides a Redis connection to be used by Act system to publish async actions to. If not given, or not enabled, async actions will run in a background goroutine. |
| actionRedis.enabled | boolean | False | True, False | If enabled, will use configuration to connect to a Redis Pub/Sub channel and publish async actions data. |
| actionRedis.address | string | localhost:6379 | Valid Redis connection url | URL used to connect to async action Redis. |
| actionRedis.channel | string | gatewayd-actions | Any valid Redis channel name | Name of the channel that async actions will be published to. |

## Example configuration

Expand Down

0 comments on commit 16f3ff6

Please sign in to comment.