Skip to content

Commit c9ed554

Browse files
committed
use langfuse init bootstrap in ci
1 parent b5b0bc6 commit c9ed554

1 file changed

Lines changed: 23 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ jobs:
9898
LANGFUSE_BASE_URL: "http://localhost:3000"
9999
LANGFUSE_PUBLIC_KEY: "pk-lf-1234567890"
100100
LANGFUSE_SECRET_KEY: "sk-lf-1234567890"
101+
LANGFUSE_INIT_ORG_ID: "0c6c96f4-0ca0-4f16-92a8-6dd7d7c6a501"
102+
LANGFUSE_INIT_ORG_NAME: "SDK Test Org"
103+
LANGFUSE_INIT_PROJECT_ID: "7a88fb47-b4e2-43b8-a06c-a5ce950dc53a"
104+
LANGFUSE_INIT_PROJECT_NAME: "SDK Test Project"
105+
LANGFUSE_INIT_PROJECT_PUBLIC_KEY: "pk-lf-1234567890"
106+
LANGFUSE_INIT_PROJECT_SECRET_KEY: "sk-lf-1234567890"
107+
LANGFUSE_INIT_USER_EMAIL: "sdk-tests@langfuse.local"
108+
LANGFUSE_INIT_USER_NAME: "SDK Tests"
109+
LANGFUSE_INIT_USER_PASSWORD: "langfuse-ci-password"
101110
LANGFUSE_E2E_READ_TIMEOUT_SECONDS: "60"
102111
LANGFUSE_E2E_READ_INTERVAL_SECONDS: "0.5"
103112
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
@@ -118,67 +127,45 @@ jobs:
118127
run: uv sync --locked
119128
- name: Check uv Python version
120129
run: uv run --frozen python --version
121-
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
122-
with:
123-
version: 10.33.0
124-
125-
- name: Clone langfuse server
130+
- name: Prepare langfuse server compose
126131
run: |
127-
git clone --depth 1 --filter=blob:none --single-branch https://github.com/langfuse/langfuse.git ./langfuse-server
128-
echo "$(cd ./langfuse-server && git rev-parse HEAD)"
129-
130-
- name: Setup node (for langfuse server)
131-
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
132-
with:
133-
node-version: 24
134-
cache: pnpm
135-
cache-dependency-path: ./langfuse-server/pnpm-lock.yaml
132+
mkdir -p ./langfuse-server
133+
LANGFUSE_SERVER_SHA="$(git ls-remote https://github.com/langfuse/langfuse.git HEAD | cut -f1)"
134+
curl -fsSL "https://raw.githubusercontent.com/langfuse/langfuse/${LANGFUSE_SERVER_SHA}/docker-compose.yml" \
135+
-o ./langfuse-server/docker-compose.yml
136+
echo "${LANGFUSE_SERVER_SHA}"
136137
137138
- name: Run langfuse server
138139
run: |
139140
cd ./langfuse-server
140141
141-
echo "::group::Start backing services"
142-
TELEMETRY_ENABLED=false docker compose up -d postgres redis clickhouse minio
143-
echo "::endgroup::"
144-
145-
echo "::group::Install dependencies (necessary to run seeder)"
146-
pnpm install --frozen-lockfile --prefer-offline
147-
echo "::endgroup::"
148-
149-
echo "::group::Seed db"
150-
cp .env.dev.example .env
151-
pnpm run db:migrate
152-
pnpm run db:seed
153-
rm -f .env
154-
echo "::endgroup::"
155-
156-
echo "::group::Start langfuse web and worker"
157-
142+
echo "::group::Start langfuse server"
158143
TELEMETRY_ENABLED=false \
144+
NEXT_PUBLIC_LANGFUSE_RUN_NEXT_INIT=true \
159145
LANGFUSE_S3_MEDIA_UPLOAD_ENDPOINT=http://localhost:9090 \
160146
LANGFUSE_INGESTION_QUEUE_DELAY_MS=10 \
161147
LANGFUSE_INGESTION_CLICKHOUSE_WRITE_INTERVAL_MS=10 \
162148
LANGFUSE_EXPERIMENT_INSERT_INTO_EVENTS_TABLE=true \
163149
QUEUE_CONSUMER_EVENT_PROPAGATION_QUEUE_IS_ENABLED=true \
164150
LANGFUSE_ENABLE_EVENTS_TABLE_V2_APIS=true \
165151
LANGFUSE_ENABLE_EVENTS_TABLE_OBSERVATIONS=true \
166-
docker compose up -d langfuse-web langfuse-worker
167-
152+
docker compose up -d
168153
echo "::endgroup::"
169154
170155
- name: Health check for langfuse server
171156
run: |
172157
echo "Checking if the langfuse server is up..."
173158
retry_count=0
174-
max_retries=10
175-
until curl --output /dev/null --silent --head --fail http://localhost:3000/api/public/health
159+
max_retries=20
160+
until curl --output /dev/null --silent --head --fail http://localhost:3000/api/public/health && \
161+
uv run --frozen python -c "from langfuse import Langfuse; client = Langfuse(); project_id = client._get_project_id(); assert project_id == '7a88fb47-b4e2-43b8-a06c-a5ce950dc53a', project_id; print(project_id)"
176162
do
177163
retry_count=`expr $retry_count + 1`
178164
echo "Attempt $retry_count of $max_retries..."
179165
if [ $retry_count -ge $max_retries ]; then
180166
echo "Langfuse server did not respond in time. Printing logs..."
181-
docker logs langfuse-server-langfuse-web-1
167+
(cd ./langfuse-server && docker compose ps)
168+
(cd ./langfuse-server && docker compose logs langfuse-web langfuse-worker)
182169
echo "Failing the step..."
183170
exit 1
184171
fi

0 commit comments

Comments
 (0)