mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
fix: Safely add livestream host (#28727)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Paul D'Ambra <paul@posthog.com> Co-authored-by: James Greenhill <fuziontech@gmail.com>
This commit is contained in:
@@ -126,6 +126,7 @@ $TLS_BLOCK
|
||||
$DOMAIN, http://, https:// {
|
||||
encode gzip zstd
|
||||
reverse_proxy http://web:8000
|
||||
reverse_proxy http://livestream:8666
|
||||
}
|
||||
EOF
|
||||
|
||||
@@ -199,7 +200,7 @@ fi
|
||||
|
||||
# setup docker-compose
|
||||
echo "Setting up Docker Compose"
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.13.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose || true
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.33.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose || true
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
# enable docker without sudo
|
||||
|
||||
@@ -100,6 +100,7 @@ services:
|
||||
environment:
|
||||
SENTRY_DSN: $SENTRY_DSN
|
||||
SITE_URL: https://$DOMAIN
|
||||
LIVESTREAM_HOST: 'https://${DOMAIN}:8666'
|
||||
SECRET_KEY: $POSTHOG_SECRET
|
||||
OBJECT_STORAGE_ACCESS_KEY_ID: 'object_storage_root_user'
|
||||
OBJECT_STORAGE_SECRET_ACCESS_KEY: 'object_storage_root_password'
|
||||
@@ -276,6 +277,17 @@ services:
|
||||
file: docker-compose.base.yml
|
||||
service: property-defs-rs
|
||||
|
||||
livestream:
|
||||
extends:
|
||||
file: docker-compose.base.yml
|
||||
service: livestream
|
||||
environment:
|
||||
- JWT.TOKEN=${POSTHOG_SECRET}
|
||||
ports:
|
||||
- '8666:8080'
|
||||
volumes:
|
||||
- ./posthog/docker/livestream/configs-dev.yml:/configs/configs.yml
|
||||
|
||||
volumes:
|
||||
zookeeper-data:
|
||||
zookeeper-datalog:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { getAppContext } from './getAppContext'
|
||||
|
||||
export function apiHostOrigin(): string {
|
||||
const appOrigin = window.location.origin
|
||||
if (appOrigin === 'https://us.posthog.com') {
|
||||
@@ -10,6 +12,8 @@ export function apiHostOrigin(): string {
|
||||
|
||||
export function liveEventsHostOrigin(): string | null {
|
||||
const appOrigin = window.location.origin
|
||||
const appContext = getAppContext()
|
||||
|
||||
if (appOrigin === 'https://us.posthog.com') {
|
||||
return 'https://live.us.posthog.com'
|
||||
} else if (appOrigin === 'https://eu.posthog.com') {
|
||||
@@ -20,5 +24,5 @@ export function liveEventsHostOrigin(): string | null {
|
||||
return 'http://localhost:6006'
|
||||
}
|
||||
|
||||
return 'http://localhost:8666'
|
||||
return appContext?.livestream_host || 'http://localhost:8666'
|
||||
}
|
||||
|
||||
@@ -3479,6 +3479,7 @@ export interface AppContext {
|
||||
year_in_hog_url?: string
|
||||
/** Support flow aid: a staff-only list of users who may be impersonated to access this resource. */
|
||||
suggested_users_with_access?: UserBasicType[]
|
||||
livestream_host?: string
|
||||
}
|
||||
|
||||
export type StoredMetricMathOperations = 'max' | 'min' | 'sum'
|
||||
|
||||
@@ -425,3 +425,6 @@ HOG_TRANSFORMATIONS_CUSTOM_ENABLED_TEAMS = get_list(os.getenv("HOG_TRANSFORMATIO
|
||||
|
||||
# temporary setting to control if a cluster has person_properties_map_custom column optimization
|
||||
USE_PERSON_PROPERTIES_MAP_CUSTOM = get_from_env("USE_PERSON_PROPERTIES_MAP_CUSTOM", False, type_cast=bool)
|
||||
|
||||
# Passed to the frontend for the web app to know where to connect to
|
||||
LIVESTREAM_HOST = get_from_env("LIVESTREAM_HOST", "")
|
||||
|
||||
@@ -412,6 +412,7 @@ def render_template(
|
||||
"switched_team": getattr(request, "switched_team", None),
|
||||
"suggested_users_with_access": getattr(request, "suggested_users_with_access", None),
|
||||
"commit_sha": context["git_rev"],
|
||||
"livestream_host": settings.LIVESTREAM_HOST,
|
||||
**posthog_app_context,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user