Skip to content

Same agent Smaller bill. The tools and infrastructure to get more work from your AI. Fewer tokens. Less compute. Lower cost.

[Fix]: Posthog secrets in the docker file instead of worker fetch (#504)

Aman Agarwaled9f0fc5a4aa
diff --git a/src/client/Dockerfile b/src/client/Dockerfile
index 0e0fdc0b..7b580a53 100644
--- a/src/client/Dockerfile
+++ b/src/client/Dockerfile
@@ -29,10 +29,6 @@ COPY --from=builder /app/client/package-lock.json ./package-lock.json
COPY --from=builder /app/client/public ./public
COPY --from=builder /app/client/prisma ./prisma
-# Fetch posthog creds
-COPY --from=builder /app/client/scripts/fetch-posthog-creds.sh ./fetch-posthog-creds.sh
-RUN chmod +x ./fetch-posthog-creds.sh
-
# Execute entrypoint script to generate NextAuth.js secret and run commands
COPY --from=builder /app/client/scripts/entrypoint.sh ./entrypoint.sh
RUN chmod +x ./entrypoint.sh
diff --git a/src/client/package-lock.json b/src/client/package-lock.json
index 440285cc..29fde835 100644
--- a/src/client/package-lock.json
+++ b/src/client/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "openlit",
- "version": "1.11.2",
+ "version": "1.11.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "openlit",
- "version": "1.11.1",
+ "version": "1.11.3",
"dependencies": {
"@anthropic-ai/sdk": "^0.21.1",
"@clickhouse/client": "^1.1.0",
diff --git a/src/client/package.json b/src/client/package.json
index a69f006e..d5ba6f87 100644
--- a/src/client/package.json
+++ b/src/client/package.json
@@ -1,6 +1,6 @@
{
"name": "openlit",
- "version": "1.11.2",
+ "version": "1.11.3",
"private": true,
"scripts": {
"dev": "next dev",
diff --git a/src/client/scripts/entrypoint.sh b/src/client/scripts/entrypoint.sh
index 6388bf1b..85494b06 100755
--- a/src/client/scripts/entrypoint.sh
+++ b/src/client/scripts/entrypoint.sh
@@ -1,8 +1,4 @@
#!/bin/bash
-
-# Run fetching posthog creds
-set +e
-./fetch-posthog-creds.sh
set -e
# Generate and set NextAuth.js secret as an environment variable
@@ -12,6 +8,10 @@ export NEXTAUTH_SECRET=$(openssl rand -base64 32)
# Default Telemetry enabled, Set this to false to disable telemetry tracking
echo "TELEMETRY_ENABLED=true" >> /etc/environment
+# POSTHOG Key
+echo "POSTHOG_API_KEY=phc_JiR0FxzxAYeV3gDoMUltOxjLa3r7RnogMHPVrjDzTR9" >> /etc/environment
+echo "POSTHOG_HOST=https://us.i.posthog.com" >> /etc/environment
+
echo "NEXTAUTH_SECRET=$NEXTAUTH_SECRET" >> /etc/environment
echo "NEXTAUTH_URL=http://localhost:3000" >> /etc/environment
echo "SQLITE_DATABASE_URL=${SQLITE_DATABASE_URL:-file:../data/data.db}" >> /etc/environment
diff --git a/src/client/scripts/fetch-posthog-creds.sh b/src/client/scripts/fetch-posthog-creds.sh
deleted file mode 100755
index be44ed61..00000000
--- a/src/client/scripts/fetch-posthog-creds.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-
-# Script to fetch PostHog credentials from Cloudflare Worker
-
-# Default values
-WORKER_URL=${1:-"https://workers.openlit.io/api/posthog"}
-
-POSTHOG_API_KEY="POSTHOG_API_KEY"
-
-# Function to display error messages
-error() {
- echo "ERROR: $1" >&2
- exit 1
-}
-
-# Validate inputs
-[ -z "$WORKER_URL" ] && error "Worker URL is required"
-
-# Check if curl is installed
-command -v curl >/dev/null 2>&1 || error "curl is required but not installed"
-
-echo "Fetching PostHog credentials from Cloudflare Worker..."
-
-# Make the API request
-response=$(curl -s -f \
- -H "User-Agent: Docker-Build" \
- -H "Content-Type: application/json" \
- "${WORKER_URL}" 2>&1) || error "Failed to fetch credentials: $response"
-
-# Extract credentials using grep and sed since we no longer require jq
-POSTHOG_API_KEY=$(echo "$response" | grep -o '"POSTHOG_API_KEY":"[^"]*"' | sed 's/"POSTHOG_API_KEY":"\([^"]*\)"/\1/')
-POSTHOG_HOST=$(echo "$response" | grep -o '"POSTHOG_HOST":"[^"]*"' | sed 's/"POSTHOG_HOST":"\([^"]*\)"/\1/')
-
-# Validate required fields
-[ -z "$POSTHOG_API_KEY" ] && error "PostHog API Key not found in response"
-[ -z "$POSTHOG_HOST" ] && error "PostHog Host not found in response"
-
-# Update environment variables
-echo "POSTHOG_API_KEY=\"${POSTHOG_API_KEY}\"" >> /etc/environment
-echo "POSTHOG_HOST=\"${POSTHOG_HOST}\"" >> /etc/environment
-
-echo "Credentials successfully fetched and saved to /etc/environment"
\ No newline at end of file