Skip to content

Commit

Permalink
fix: Docker compose endpoint for cdp api (#29517)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Mar 5, 2025
1 parent a7ad719 commit e7a136f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ services:
PGUSER: posthog
PGPASSWORD: posthog
DEPLOYMENT: hobby
CDP_API_URL: 'http://plugins:6738'

web:
<<: *worker
Expand Down
12 changes: 5 additions & 7 deletions posthog/plugins/plugin_server_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import requests
import structlog
from posthog.redis import get_client
from posthog.settings import CDP_FUNCTION_EXECUTOR_API_URL, PLUGINS_RELOAD_PUBSUB_CHANNEL, PLUGINS_RELOAD_REDIS_URL
from posthog.settings import CDP_API_URL, PLUGINS_RELOAD_PUBSUB_CHANNEL, PLUGINS_RELOAD_REDIS_URL
from posthog.models.utils import UUIDT


Expand Down Expand Up @@ -64,23 +64,21 @@ def populate_plugin_capabilities_on_workers(plugin_id: str):
def create_hog_invocation_test(team_id: int, hog_function_id: str, payload: dict) -> requests.Response:
logger.info(f"Creating hog invocation test for hog function {hog_function_id} on workers")
return requests.post(
CDP_FUNCTION_EXECUTOR_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/invocations",
CDP_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/invocations",
json=payload,
)


def get_hog_function_status(team_id: int, hog_function_id: UUIDT) -> requests.Response:
return requests.get(
CDP_FUNCTION_EXECUTOR_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/status"
)
return requests.get(CDP_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/status")


def patch_hog_function_status(team_id: int, hog_function_id: UUIDT, state: int) -> requests.Response:
return requests.patch(
CDP_FUNCTION_EXECUTOR_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/status",
CDP_API_URL + f"/api/projects/{team_id}/hog_functions/{hog_function_id}/status",
json={"state": state},
)


def get_hog_function_templates() -> requests.Response:
return requests.get(CDP_FUNCTION_EXECUTOR_API_URL + f"/api/hog_function_templates")
return requests.get(CDP_API_URL + f"/api/hog_function_templates")
8 changes: 3 additions & 5 deletions posthog/settings/data_stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,10 @@ def _parse_kafka_hosts(hosts_string: str) -> list[str]:
PLUGINS_RELOAD_REDIS_URL = os.getenv("PLUGINS_RELOAD_REDIS_URL", REDIS_URL)


CDP_FUNCTION_EXECUTOR_API_URL = get_from_env("CDP_FUNCTION_EXECUTOR_API_URL", "")
CDP_API_URL = get_from_env("CDP_API_URL", "")

if not CDP_FUNCTION_EXECUTOR_API_URL:
CDP_FUNCTION_EXECUTOR_API_URL = (
"http://localhost:6738" if DEBUG else "http://ingestion-cdp-api.posthog.svc.cluster.local"
)
if not CDP_API_URL:
CDP_API_URL = "http://localhost:6738" if DEBUG else "http://ingestion-cdp-api.posthog.svc.cluster.local"

CACHES = {
"default": {
Expand Down

0 comments on commit e7a136f

Please sign in to comment.