fix(langfuse): fix goose langfuse integration (wrong env variables)

This commit is contained in:
2025-03-11 12:12:20 -06:00
parent 167d73a964
commit c56b4b35f5
6 changed files with 178 additions and 32 deletions

View File

@@ -15,11 +15,9 @@ This driver provides a containerized environment for running [Goose](https://goo
| Variable | Description | Required |
|----------|-------------|----------|
| `MCP_HOST` | MCP server host | Yes |
| `GOOSE_API_KEY` | Goose API key | Yes |
| `GOOSE_ID` | Goose instance ID | No |
| `LANGFUSE_PUBLIC_KEY` | Langfuse public key | No |
| `LANGFUSE_SECRET_KEY` | Langfuse secret key | No |
| `LANGFUSE_HOST` | Langfuse API host | No |
| `LANGFUSE_INIT_PROJECT_PUBLIC_KEY` | Langfuse public key | No |
| `LANGFUSE_INIT_PROJECT_SECRET_KEY` | Langfuse secret key | No |
| `LANGFUSE_URL` | Langfuse API URL | No |
| `MC_PROJECT_URL` | Project repository URL | No |
| `MC_GIT_SSH_KEY` | SSH key for Git authentication | No |
| `MC_GIT_TOKEN` | Token for Git authentication | No |

View File

@@ -13,29 +13,20 @@ environment:
required: true
default: http://localhost:8000
- name: GOOSE_API_KEY
description: Goose API key
required: true
sensitive: true
- name: GOOSE_ID
description: Goose instance ID
required: false
- name: LANGFUSE_PUBLIC_KEY
- name: LANGFUSE_INIT_PROJECT_PUBLIC_KEY
description: Langfuse public key
required: false
sensitive: true
- name: LANGFUSE_SECRET_KEY
- name: LANGFUSE_INIT_PROJECT_SECRET_KEY
description: Langfuse secret key
required: false
sensitive: true
- name: LANGFUSE_HOST
description: Langfuse API host
- name: LANGFUSE_URL
description: Langfuse API URL
required: false
default: https://api.langfuse.com
default: https://cloud.langfuse.com
# Project environment variables
- name: MC_PROJECT_URL
@@ -63,4 +54,10 @@ ports:
volumes:
- mountPath: /app
description: Application directory
description: Application directory
persistent_configs:
- source: "/app/.goose"
target: "/mc-config/goose"
type: "directory"
description: "Goose memory and configuration"

View File

@@ -8,6 +8,26 @@ exec > >(tee -a /init.log) 2>&1
echo "=== MC Initialization started at $(date) ==="
echo "INIT_COMPLETE=false" > /init.status
# Set up persistent configuration symlinks
if [ -n "$MC_CONFIG_DIR" ] && [ -d "$MC_CONFIG_DIR" ]; then
echo "Setting up persistent configuration in $MC_CONFIG_DIR"
# Create Goose configuration directory
mkdir -p "$MC_CONFIG_DIR/goose"
# Create symlink for Goose directory
if [ -d "/app" ]; then
# Make sure .goose directory exists in the target
mkdir -p "$MC_CONFIG_DIR/goose"
# Create the symlink
echo "Creating symlink for Goose configuration: /app/.goose -> $MC_CONFIG_DIR/goose"
ln -sf "$MC_CONFIG_DIR/goose" "/app/.goose"
else
echo "Warning: /app directory does not exist yet, symlinks will be created after project initialization"
fi
fi
# Project initialization
if [ -n "$MC_PROJECT_URL" ]; then
echo "Initializing project: $MC_PROJECT_URL"
@@ -36,13 +56,21 @@ if [ -n "$MC_PROJECT_URL" ]; then
if [ -f "/app/.mc/init.sh" ]; then
bash /app/.mc/init.sh
fi
# Set up symlinks after project is cloned (if MC_CONFIG_DIR exists)
if [ -n "$MC_CONFIG_DIR" ] && [ -d "$MC_CONFIG_DIR" ]; then
echo "Setting up persistent configuration symlinks after project clone"
# Create Goose configuration directory
mkdir -p "$MC_CONFIG_DIR/goose"
# Create symlink for Goose directory
echo "Creating symlink for Goose configuration: /app/.goose -> $MC_CONFIG_DIR/goose"
ln -sf "$MC_CONFIG_DIR/goose" "/app/.goose"
fi
fi
# Set up Goose API key if provided
if [ -n "$GOOSE_API_KEY" ]; then
echo "Setting up Goose API key"
export GOOSE_API_KEY="$GOOSE_API_KEY"
fi
# Goose uses self-hosted instance, no API key required
# Set up MCP connection if provided
if [ -n "$MCP_HOST" ]; then
@@ -51,11 +79,11 @@ if [ -n "$MCP_HOST" ]; then
fi
# Set up Langfuse logging if credentials are provided
if [ -n "$LANGFUSE_SECRET_KEY" ] && [ -n "$LANGFUSE_PUBLIC_KEY" ]; then
if [ -n "$LANGFUSE_INIT_PROJECT_SECRET_KEY" ] && [ -n "$LANGFUSE_INIT_PROJECT_PUBLIC_KEY" ]; then
echo "Setting up Langfuse logging"
export LANGFUSE_SECRET_KEY="$LANGFUSE_SECRET_KEY"
export LANGFUSE_PUBLIC_KEY="$LANGFUSE_PUBLIC_KEY"
export LANGFUSE_HOST="${LANGFUSE_HOST:-https://api.langfuse.com}"
export LANGFUSE_INIT_PROJECT_SECRET_KEY="$LANGFUSE_INIT_PROJECT_SECRET_KEY"
export LANGFUSE_INIT_PROJECT_PUBLIC_KEY="$LANGFUSE_INIT_PROJECT_PUBLIC_KEY"
export LANGFUSE_URL="${LANGFUSE_URL:-https://cloud.langfuse.com}"
fi
echo "MC driver initialization complete"