From e03f5046ed128e894c6882441a509671c97ad3fb Mon Sep 17 00:00:00 2001 From: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com> Date: Mon, 3 Feb 2025 15:33:15 +0000 Subject: [PATCH 1/5] steps from readme to platformx doc --- docs/admin/integrations/platformx.md | 81 +++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/docs/admin/integrations/platformx.md b/docs/admin/integrations/platformx.md index 530fb0454721d..54d8468f3ed88 100644 --- a/docs/admin/integrations/platformx.md +++ b/docs/admin/integrations/platformx.md @@ -8,21 +8,88 @@ their experience. ![PlatformX Events in Coder](../../images/integrations/platformx-screenshot.png) +Use these steps to deploy to forward Coder notifications to PlatformX using +Docker and a lightweight web server. + +For more information about this integration and how it works, refer to the +[coder-platformx-notifications](https://github.com/coder/coder-platformx-notifications) +repository. + ## Requirements You'll need: -- A running Coder v2.19+ deployment +- Coder v2.19+ - A PlatformX subscription from [DX](https://getdx.com/) -- A platform to host the integration (choose any of these): +- A platform to host the integration, such as: - AWS Lambda + - Google Cloud Run - Heroku - Kubernetes - Or any other platform that can run Python web applications -## Getting Started +## Run coder-platformx-events-middleware with Docker -Refer to the instructions in the -[coder-platformx-notifications](https://github.com/coder/coder-platformx-notifications) -repository to deploy a lightweight web server to forward Coder Notifications to -PlatformX. +Coder sends [notifications](../monitoring/notifications/index.md) via webhooks +to coder-platformx-events-middleware (CPEM), which processes and reformats the payload +into a structure compatible with [PlatformX by DX](https://help.getdx.com/en/articles/7880779-getting-started). +CPEM transforms the payload and forwards it to PlatformX for further processing and analysis. + +CPEM is optimized for serverless environments such as Google Cloud Run and AWS Lambda. + +Clone the repository and use Docker to build and run CPEM: + +```sh +git clone +cd +docker build -t coder-platformx-events-middleware . +docker run -p 8080:8080 --env-file .env coder-platformx-events-middleware +``` + +### Supported Notification Types + +CPEM supports the following [Coder notifications](../monitoring/notifications/index.md): + +- Workspace Created +- Workspace Manually Updated +- User Account Created +- User Account Suspended +- User Account Activated + +### Environment Variables + +The application expects the following environment variables when started. +For local development, create a `.env` file in the project root with the following variables. +A `.env.sample` file is included: + +| Variable | Description | Example | +|------------------|--------------------------------------------|----------------------------------------------| +| `LOG_LEVEL` | Logging level (`DEBUG`, `INFO`, `WARNING`) | `INFO` | +| `GETDX_API_KEY` | API key for PlatformX | `your-api-key` | +| `EVENTS_TRACKED` | Comma-separated list of tracked events | `"Workspace Created,User Account Suspended"` | + +### Logging + +Logs are printed to the console and can be adjusted using the `LOG_LEVEL` variable. The available levels are: + +| Level | Description | +|-----------|---------------------------------------| +| `DEBUG` | Most verbose, useful for debugging | +| `INFO` | Standard logging for normal operation | +| `WARNING` | Logs only warnings and errors | + +### API Endpoints + +- `GET /` - Health check endpoint +- `POST /` - Webhook receiver + +## Configure Coder to send notifications to CPEM + +Set the following environment variables for your Coder server: + +```sh +export CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT= +export CODER_NOTIFICATIONS_METHOD=webhook # Optional, as multiple methods are supported +``` + +Replace `` with the actual URL where this middleware is hosted. From 1bd6af33d73a458b69fa7569ac39adba4020079b Mon Sep 17 00:00:00 2001 From: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com> Date: Mon, 3 Feb 2025 15:37:48 +0000 Subject: [PATCH 2/5] typo --- docs/admin/integrations/platformx.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/admin/integrations/platformx.md b/docs/admin/integrations/platformx.md index 54d8468f3ed88..161a3de3f1bb3 100644 --- a/docs/admin/integrations/platformx.md +++ b/docs/admin/integrations/platformx.md @@ -8,8 +8,8 @@ their experience. ![PlatformX Events in Coder](../../images/integrations/platformx-screenshot.png) -Use these steps to deploy to forward Coder notifications to PlatformX using -Docker and a lightweight web server. +Use these steps to forward Coder notifications to PlatformX using Docker and a +lightweight web server. For more information about this integration and how it works, refer to the [coder-platformx-notifications](https://github.com/coder/coder-platformx-notifications) From b9b432f08f126abd11bc166f263946d911bb9b49 Mon Sep 17 00:00:00 2001 From: Edward Angert Date: Mon, 3 Feb 2025 11:47:17 -0500 Subject: [PATCH 3/5] Update docs/admin/integrations/platformx.md --- docs/admin/integrations/platformx.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/admin/integrations/platformx.md b/docs/admin/integrations/platformx.md index 161a3de3f1bb3..310ea5d771af2 100644 --- a/docs/admin/integrations/platformx.md +++ b/docs/admin/integrations/platformx.md @@ -40,8 +40,8 @@ CPEM is optimized for serverless environments such as Google Cloud Run and AWS L Clone the repository and use Docker to build and run CPEM: ```sh -git clone -cd +git clone https://github.com/coder/coder-platformx-notifications.git +cd coder-platformx-notifications docker build -t coder-platformx-events-middleware . docker run -p 8080:8080 --env-file .env coder-platformx-events-middleware ``` From 788878c7ac3a283c499ce9b9f4de849ea6b42cfe Mon Sep 17 00:00:00 2001 From: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:26:51 +0000 Subject: [PATCH 4/5] use coder/doc for reference; point to repo for steps --- docs/admin/integrations/platformx.md | 52 ++++------------------------ 1 file changed, 7 insertions(+), 45 deletions(-) diff --git a/docs/admin/integrations/platformx.md b/docs/admin/integrations/platformx.md index 310ea5d771af2..967a8b3619507 100644 --- a/docs/admin/integrations/platformx.md +++ b/docs/admin/integrations/platformx.md @@ -8,47 +8,20 @@ their experience. ![PlatformX Events in Coder](../../images/integrations/platformx-screenshot.png) -Use these steps to forward Coder notifications to PlatformX using Docker and a -lightweight web server. - -For more information about this integration and how it works, refer to the -[coder-platformx-notifications](https://github.com/coder/coder-platformx-notifications) -repository. - -## Requirements - -You'll need: - -- Coder v2.19+ -- A PlatformX subscription from [DX](https://getdx.com/) -- A platform to host the integration, such as: - - AWS Lambda - - Google Cloud Run - - Heroku - - Kubernetes - - Or any other platform that can run Python web applications - -## Run coder-platformx-events-middleware with Docker +## coder-platformx-events-middleware Coder sends [notifications](../monitoring/notifications/index.md) via webhooks -to coder-platformx-events-middleware (CPEM), which processes and reformats the payload +to coder-platformx-events-middleware, which processes and reformats the payload into a structure compatible with [PlatformX by DX](https://help.getdx.com/en/articles/7880779-getting-started). -CPEM transforms the payload and forwards it to PlatformX for further processing and analysis. - -CPEM is optimized for serverless environments such as Google Cloud Run and AWS Lambda. -Clone the repository and use Docker to build and run CPEM: - -```sh -git clone https://github.com/coder/coder-platformx-notifications.git -cd coder-platformx-notifications -docker build -t coder-platformx-events-middleware . -docker run -p 8080:8080 --env-file .env coder-platformx-events-middleware -``` +For more information about coder-platformx-events-middleware and how to +integrate it with your Coder deployment and PlatformX events, refer to the +[coder-platformx-notifications](https://github.com/coder/coder-platformx-notifications) +repository. ### Supported Notification Types -CPEM supports the following [Coder notifications](../monitoring/notifications/index.md): +coder-platformx-events-middleware supports the following [Coder notifications](../monitoring/notifications/index.md): - Workspace Created - Workspace Manually Updated @@ -82,14 +55,3 @@ Logs are printed to the console and can be adjusted using the `LOG_LEVEL` variab - `GET /` - Health check endpoint - `POST /` - Webhook receiver - -## Configure Coder to send notifications to CPEM - -Set the following environment variables for your Coder server: - -```sh -export CODER_NOTIFICATIONS_WEBHOOK_ENDPOINT= -export CODER_NOTIFICATIONS_METHOD=webhook # Optional, as multiple methods are supported -``` - -Replace `` with the actual URL where this middleware is hosted. From 65f0d86925bdaa15915b1f4f281a4b6b4a673afc Mon Sep 17 00:00:00 2001 From: EdwardAngert <17991901+EdwardAngert@users.noreply.github.com> Date: Mon, 3 Feb 2025 21:51:38 +0000 Subject: [PATCH 5/5] re-add requirements --- docs/admin/integrations/platformx.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/admin/integrations/platformx.md b/docs/admin/integrations/platformx.md index 967a8b3619507..207087b23562e 100644 --- a/docs/admin/integrations/platformx.md +++ b/docs/admin/integrations/platformx.md @@ -8,6 +8,19 @@ their experience. ![PlatformX Events in Coder](../../images/integrations/platformx-screenshot.png) +## Requirements + +You'll need: + +- Coder v2.19+ +- A PlatformX subscription from [DX](https://getdx.com/) +- A platform to host the integration, such as: + - AWS Lambda + - Google Cloud Run + - Heroku + - Kubernetes + - Or any other platform that can run Python web applications + ## coder-platformx-events-middleware Coder sends [notifications](../monitoring/notifications/index.md) via webhooks