From 79d7605614f8c4f86ee588a56730625a88700cc8 Mon Sep 17 00:00:00 2001 From: pulak-opti Date: Wed, 7 Feb 2024 00:06:25 +0600 Subject: [PATCH 1/6] update webhook doc --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index b2dcbeb0..f93e5d03 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,29 @@ To accept webhook requests Agent must be configured by mapping an Optimizely Pro with the associated secret used for validating the inbound request. An example webhook configuration can be found in the the provided [config.yaml](./config.yaml). +When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook notification is received. By default, only one Agent node or instance will receive the webhook notification. A pubsub . + +Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their datafiles accordingly. + +To set up Redis as a relay, you need to configure the datafile syncer in your Optimizely Agent configuration. The datafile syncer uses the PubSub feature of Redis to publish the webhook notifications to all subscribed Agent nodes. + +Here's an example of how you can configure the datafile syncer with Redis: + +```yaml +## synchronization should be enabled when features for multiple nodes like notification streaming are deployed +synchronization: + pubsub: + redis: + host: "localhost:6379" + password: "" + database: 0 + ## if datafile synchronization is enabled, then for each webhook API call + ## the datafile will be sent to all available replicas to achieve better eventual consistency + datafile: + enable: true + default: "redis" +``` + ## Admin API The Admin API provides system information about the running process. This can be used to check the availability From d6c4e139c4e71a371ac7dc89e3b34fe6bd92f509 Mon Sep 17 00:00:00 2001 From: pulak-opti Date: Wed, 7 Feb 2024 18:05:24 +0600 Subject: [PATCH 2/6] update doc --- README.md | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f93e5d03..ce9a74a2 100644 --- a/README.md +++ b/README.md @@ -186,13 +186,10 @@ To accept webhook requests Agent must be configured by mapping an Optimizely Pro with the associated secret used for validating the inbound request. An example webhook configuration can be found in the the provided [config.yaml](./config.yaml). -When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook notification is received. By default, only one Agent node or instance will receive the webhook notification. A pubsub . - -Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their datafiles accordingly. - -To set up Redis as a relay, you need to configure the datafile syncer in your Optimizely Agent configuration. The datafile syncer uses the PubSub feature of Redis to publish the webhook notifications to all subscribed Agent nodes. - -Here's an example of how you can configure the datafile syncer with Redis: +When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook notification is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this. +Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their data files accordingly. +To set up Redis as a relay, you need to enable the data file synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes. +Here's an example of how you can enable the datafile synchronization with Redis: ```yaml ## synchronization should be enabled when features for multiple nodes like notification streaming are deployed @@ -455,6 +452,24 @@ Optimizely Agent supports authorization workflows based on OAuth and JWT standar Just as you can use Notification Listeners to subscribe to events of interest with Optimizely SDKs, you can use the Notifications endpoint to subscribe to events in Agent. For more information, see the [Notifications Guide](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/agent-notifications). +When the Agent is operating in High Availability (HA) mode, you need to enable notification synchronization to get notifications from all nodes in an HA setup. A PubSub system (Redis) is now used to ensure consistent retrieval of notification events across all nodes in an HA setup. +Here's an example of how you can enable the notification synchronization with Redis: + +```yaml +## synchronization should be enabled when features for multiple nodes like notification streaming are deployed +synchronization: + pubsub: + redis: + host: "localhost:6379" + password: "" + database: 0 + ## if notification synchronization is enabled, then the active notification event-stream API + ## will get the notifications from available replicas + notification: + enable: true + default: "redis" +``` + ## Agent Development ### Package Structure From 813fbcaa1155a5932c289f526fd2d23ca26edb3c Mon Sep 17 00:00:00 2001 From: pulak-opti Date: Wed, 7 Feb 2024 20:31:40 +0600 Subject: [PATCH 3/6] add line break --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ce9a74a2..6760bb78 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,11 @@ with the associated secret used for validating the inbound request. An example w be found in the the provided [config.yaml](./config.yaml). When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook notification is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this. + Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their data files accordingly. + To set up Redis as a relay, you need to enable the data file synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes. + Here's an example of how you can enable the datafile synchronization with Redis: ```yaml From 1545d487cd92cfb63abecdf33857ab357b40e3d5 Mon Sep 17 00:00:00 2001 From: pulak-opti <129880418+pulak-opti@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:01:13 +0600 Subject: [PATCH 4/6] Update README.md Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6760bb78..dfb81d20 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ To accept webhook requests Agent must be configured by mapping an Optimizely Pro with the associated secret used for validating the inbound request. An example webhook configuration can be found in the the provided [config.yaml](./config.yaml). -When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook notification is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this. +When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook event (datafile updated) is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this. Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their data files accordingly. From ca9d687c11498e121dce43743f22a47a53996a5d Mon Sep 17 00:00:00 2001 From: pulak-opti <129880418+pulak-opti@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:01:24 +0600 Subject: [PATCH 5/6] Update README.md Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dfb81d20..ad599c2b 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ be found in the the provided [config.yaml](./config.yaml). When running Agent in High Availability (HA) mode, it's important to ensure that all nodes are updated promptly when a webhook event (datafile updated) is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this. -Redis, a powerful in-memory data structure store, can be used as a relay to propagate the webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their data files accordingly. +Redis, a powerful in-memory data structure store, can be used as a relay to propagate the datafile webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their datafiles accordingly. To set up Redis as a relay, you need to enable the data file synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes. From 1dc2ac21994b93ad3dcc1ac448c6deed7d1f76a9 Mon Sep 17 00:00:00 2001 From: pulak-opti <129880418+pulak-opti@users.noreply.github.com> Date: Thu, 8 Feb 2024 00:01:35 +0600 Subject: [PATCH 6/6] Update README.md Co-authored-by: Jae Kim <45045038+jaeopt@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad599c2b..07c145d4 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ When running Agent in High Availability (HA) mode, it's important to ensure that Redis, a powerful in-memory data structure store, can be used as a relay to propagate the datafile webhook event to all other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their datafiles accordingly. -To set up Redis as a relay, you need to enable the data file synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes. +To set up Redis as a relay, you need to enable the datafile synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes. Here's an example of how you can enable the datafile synchronization with Redis: