Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): show egress IPs on the database source form (#85602)

Tom Owers6afb0479f521
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
index 0b7ddba2921e..8a184bb20b27 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx
@@ -15,11 +15,13 @@ import {
} from '@posthog/lemon-ui'
import { AccessControlAction } from 'lib/components/AccessControlAction'
+import { CodeSnippet } from 'lib/components/CodeSnippet'
import { useFloatingContainer } from 'lib/hooks/useFloatingContainerContext'
import { LemonBanner } from 'lib/lemon-ui/LemonBanner'
import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'
import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'
import { copyToClipboard } from 'lib/utils/copyToClipboard'
+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { Scene, SceneExport } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'
@@ -513,6 +515,26 @@ function FirstStep({ allowedSources }: NewSourcesWizardProps): JSX.Element {
return <SourceCatalog allowedSources={allowedSources} />
}
+// Firewall allowlisting only applies to self-hosted databases PostHog dials out to, so the hint is
+// scoped to that category rather than shown for OAuth/API connectors.
+function DatabaseFirewallHint(): JSX.Element | null {
+ const { preflight } = useValues(preflightLogic)
+ const egressIps = preflight?.public_egress_ip_addresses
+
+ if (!egressIps?.length) {
+ return null
+ }
+
+ return (
+ <LemonBanner type="info">
+ <p className="mb-2">
+ If your database is behind a firewall, add PostHog's IP addresses to the allowlist so it can connect:
+ </p>
+ <CodeSnippet thing="IP addresses">{egressIps.join(' \n')}</CodeSnippet>
+ </LemonBanner>
+ )
+}
+
function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: SourceWizardLogicProps }): JSX.Element {
const { selectedConnector, source, sourceConnectionDetails } = useValues(sourceWizardLogic)
const selectedAccessMethod = getEffectiveAccessMethod(
@@ -554,6 +576,8 @@ function SecondStep({ sourceWizardLogicProps }: { sourceWizardLogicProps?: Sourc
)}
</div>
+ {selectedConnector.category === 'Databases' && <DatabaseFirewallHint />}
+
<LemonDivider />
<SourceForm