Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/deployment/provision/provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ The high-level provisioning mechanism:

Provider configurations can be updated dynamically by changing the YAML files in the `KEEP_PROVIDERS_DIRECTORY` directory.

On every restart, Keep reads the YAML files in the `KEEP_PROVIDERS_DIRECTORY` directory and determines which providers need to be added or removed.
Provider provisioning is done on every restart. It can also be triggered without a restart via the `/providers/provision` endpoint of the API.

```
curl -XPOST http://localhost:8080/providers/provision
```

Keep reads the YAML files in the `KEEP_PROVIDERS_DIRECTORY` directory and determines which providers need to be added or removed.

The high-level provisioning mechanism:
1. Keep reads the YAML files in the `KEEP_PROVIDERS_DIRECTORY` directory.
Expand Down
10 changes: 8 additions & 2 deletions docs/deployment/provision/workflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ Example directory structure:
```
### Update Provisioned Workflows

On every restart, Keep reads the `KEEP_WORKFLOWS_DIRECTORY` environment variable and determines which workflows need to be added, removed, or updated.
You can efficiently add new workflows, remove existing ones, or modify their configurations by simply updating the workflow files in the `KEEP_WORKFLOWS_DIRECTORY`. This process allows for flexible management of workflows without requiring manual intervention.

This process allows for flexible management of workflows without requiring manual intervention. By simply updating the workflow files in the `KEEP_WORKFLOWS_DIRECTORY` and restarting the application, you can efficiently add new workflows, remove existing ones, or modify their configurations.
Workflow provisioning is done on every restart. It can also be triggered without a restart via the `/workflows/provision` endpoint of the API.

```
curl -XPOST http://localhost:8080/workflows/provision
```

Keep reads the `KEEP_WORKFLOWS_DIRECTORY` environment variable and determines which workflows need to be added, removed, or updated.

The high-level provisioning mechanism:
1. Keep reads the `KEEP_WORKFLOWS_DIRECTORY` value.
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi.json

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions keep/api/routes/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from keep.api.core.config import config
from keep.api.core.db import count_alerts, get_provider_distribution, get_session
from keep.api.core.dependencies import SINGLE_TENANT_UUID
from keep.api.core.limiter import limiter
from keep.api.models.db.provider import Provider
from keep.api.models.provider import Provider as ProviderDTO
Expand Down Expand Up @@ -65,6 +66,16 @@ def _is_localhost():
return False


@router.post("/provision", description="Provision providers from file or directory")
def provision_providers():
logger.info("Reloading provisioned providers")
ProvidersService.provision_providers(SINGLE_TENANT_UUID)
return {
"provision": "done",
"is_localhost": _is_localhost(),
}


@router.get("", description="Get all providers")
def get_providers(
authenticated_entity: AuthenticatedEntity = Depends(
Expand Down
10 changes: 10 additions & 0 deletions keep/api/routes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
update_workflow_by_id as update_workflow_by_id_db,
)
from keep.api.core.db import get_workflow_executions as get_workflow_executions_db
from keep.api.core.dependencies import SINGLE_TENANT_UUID
from keep.api.core.workflows import (
get_workflow_facets,
get_workflow_facets_data,
Expand Down Expand Up @@ -74,6 +75,15 @@
PLATFORM_URL = config("KEEP_PLATFORM_URL", default="https://platform.keephq.dev")


@router.post("/provision", description="Provision workflows from a directory")
def provision_providers():
logger.info("Reloading provisioned workfflows")
WorkflowStore.provision_workflows(SINGLE_TENANT_UUID)
return {
"provision": "done",
}


@router.post(
"/facets/options",
description="Query workflows facet options. Accepts dictionary where key is facet id and value is cel to query facet",
Expand Down