🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
chore: add release:cloud script (#12312)
Hassieb Pakzad780da40d929d
diff --git a/.github/workflows/promote-main-to-production.yml b/.github/workflows/promote-main-to-production.ymlnew file mode 100644index 0000000000..2a65505fa0--- /dev/null+++ b/.github/workflows/promote-main-to-production.yml@@ -0,0 +1,44 @@+name: Promote Main to Production++on:+ workflow_dispatch:+ inputs:+ confirm:+ description: "Type 'promote' to confirm force-pushing main to production"+ required: true+ type: string++concurrency:+ group: promote-main-to-production+ cancel-in-progress: false++jobs:+ promote:+ runs-on: ubuntu-latest+ environment: "protected branches"+ steps:+ - name: Validate confirmation+ run: |+ if [ "${{ github.event.inputs.confirm }}" != "promote" ]; then+ echo "Input 'confirm' must be 'promote'."+ exit 1+ fi++ - uses: actions/checkout@v4+ with:+ ref: main+ fetch-depth: 0+ token: ${{ secrets.GH_ACCESS_TOKEN }}++ - name: Print commit refs+ run: |+ git fetch origin main production+ echo "main: $(git rev-parse origin/main)"+ if git show-ref --verify --quiet refs/remotes/origin/production; then+ echo "production (before): $(git rev-parse origin/production)"+ else+ echo "production (before): <branch does not exist>"+ fi++ - name: Force push main to production+ run: git push origin +main:productiondiff --git a/AGENTS.md b/AGENTS.mdindex 4f120998e1..8c32a4c8ea 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -91,6 +91,9 @@ Minimum verification matrix:## Release Channel- Release workflow is managed at root (`pnpm run release`).+- Langfuse Cloud deployments are triggered by pushes to `production` (`.github/workflows/deploy.yml`).+- Promote `main` to `production` via `.github/workflows/promote-main-to-production.yml` (manual `workflow_dispatch`).+- Use `pnpm run release:cloud` for CLI-triggered Cloud promotions with preflight branch/migration checks.- Do not change release/versioning flow without updating this file and impacted package guides.## GitHub Searchdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 8f62d793ba..dcdf9cc452 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -244,16 +244,16 @@ Tests automatically create the PostgreSQL test database if it doesn't exist andWe're using Jest with in the `web` package. Therefore, if you want to provide an argument to the test runner, do it directly without an intermittent `--`.-There are two types of unit tests:--- `test` (server tests)-- `test-client`+There are two types of unit tests:++- `test` (server tests)+- `test-client`To run a specific test, for example the test: `"should handle special characters in prompt names"` in `prompts.v2.servertest.ts`, run:```sh-cd web # or with --filter=web-pnpm test --testPathPatterns="prompts\.v2\.servertest" --testNamePattern="should handle special characters in prompt names"+cd web # or with --filter=web+pnpm test --testPathPatterns="prompts\.v2\.servertest" --testNamePattern="should handle special characters in prompt names"```To run all tests:@@ -303,10 +303,25 @@ You can use the staging environment end-to-end with the Langfuse integrations or## Production environment-When a new release is tagged on the `main` branch (excluding prereleases), it triggers a production deployment. The deployment process consists of two steps:+We run two separate release/deployment processes:++1. **Langfuse Cloud deployment (frequent):**+ - Every commit on the `production` branch triggers an ECS deployment to Langfuse Cloud.+ - To deploy current `main` to Langfuse Cloud, promote `main` to `production` via [`promote-main-to-production.yml`](.github/workflows/promote-main-to-production.yml) (instead of force pushing from a local machine).+2. **Open-source release (less frequent):**+ - The open-source Docker release process is handled via [`release.yml`](.github/workflows/release.yml) for self-hosted production users.++You can trigger the Langfuse Cloud promotion in either way:++1. Preferred local command:++```bash+pnpm run release:cloud+```++This wraps the GitHub CLI trigger and performs preflight checks (main branch/sync checks and migration diff checks against `production`) before dispatching the workflow.-1. The Docker image is published to GitHub Packages with the version number and `latest` tag.-2. The deployment is carried out on Langfuse Cloud. This is done by force pushing the `main` branch to the `production` branch during every release, using the [`release.yml`](.github/workflows/release.yml) GitHub Action.+2. GitHub UI: open **Actions** -> **Promote Main to Production** -> **Run workflow**, then set `confirm=promote`.## Themingdiff --git a/package.json b/package.jsonindex 29857e4625..010720eb23 100644--- a/package.json+++ b/package.json@@ -34,6 +34,7 @@"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,css}\" --experimental-cli","test": "turbo run test","release": "dotenv -e ../.env -- release-it",+ "release:cloud": "bash ./scripts/release-cloud.sh","prepare": "husky"},"devDependencies": {diff --git a/scripts/release-cloud.sh b/scripts/release-cloud.shnew file mode 100755index 0000000000..56fcd25e8b--- /dev/null+++ b/scripts/release-cloud.sh@@ -0,0 +1,127 @@+#!/usr/bin/env bash++set -euo pipefail++PROMOTION_WORKFLOW_FILE="promote-main-to-production.yml"+MIGRATION_CONFIRMATION_TOKEN="applied"++log() {+ echo "[release:cloud] $*"+}++fail() {+ log "ERROR: $*"+ exit 1+}++require_command() {+ local command_name="$1"+ if ! command -v "$command_name" >/dev/null 2>&1; then+ fail "Required command '$command_name' is not installed."+ fi+}++ensure_on_main_branch() {+ local current_branch+ current_branch="$(git rev-parse --abbrev-ref HEAD)"+ if [[ "$current_branch" != "main" ]]; then+ fail "Current branch is '$current_branch'. Switch to 'main' before running this command."+ fi+}++ensure_main_matches_origin() {+ git fetch origin main++ local local_main_sha+ local origin_main_sha+ local_main_sha="$(git rev-parse HEAD)"+ origin_main_sha="$(git rev-parse origin/main)"++ if [[ "$local_main_sha" != "$origin_main_sha" ]]; then+ fail "Local main ($local_main_sha) is not in sync with origin/main ($origin_main_sha)."+ fi++ log "Local main is in sync with origin/main ($local_main_sha)."+}++fetch_production_branch() {+ git fetch origin production++ if ! git show-ref --verify --quiet refs/remotes/origin/production; then+ fail "Could not find remote branch origin/production."+ fi+}++collect_prisma_migrations_not_in_production() {+ git diff --name-only origin/production..HEAD -- packages/shared/prisma/migrations \+ | awk -F/ 'NF >= 5 {print $5}' \+ | sort -u+}++collect_clickhouse_migrations_not_in_production() {+ git diff --name-only origin/production..HEAD -- packages/shared/clickhouse/migrations \+ | sed -E 's#.*/([0-9]+_[^.]+)\.(up|down)\.sql#\1#' \+ | sort -u+}++confirm_migrations_are_applied() {+ local prisma_migrations="$1"+ local clickhouse_migrations="$2"++ log "Detected migrations in main that are not yet on production."++ if [[ -n "$prisma_migrations" ]]; then+ log "Postgres (Prisma) migrations not yet promoted:"+ while IFS= read -r migration; do+ [[ -n "$migration" ]] && echo " - $migration"+ done <<< "$prisma_migrations"+ fi++ if [[ -n "$clickhouse_migrations" ]]; then+ log "ClickHouse migrations not yet promoted:"+ while IFS= read -r migration; do+ [[ -n "$migration" ]] && echo " - $migration"+ done <<< "$clickhouse_migrations"+ fi++ echo+ log "Confirm you have reviewed these migrations and applied them to the production Postgres and ClickHouse databases."+ read -r -p "Type '${MIGRATION_CONFIRMATION_TOKEN}' to continue: " confirmation++ if [[ "$confirmation" != "$MIGRATION_CONFIRMATION_TOKEN" ]]; then+ fail "Confirmation failed. Aborting cloud release."+ fi+}++trigger_cloud_promotion() {+ require_command gh++ if ! gh auth status >/dev/null 2>&1; then+ fail "GitHub CLI is not authenticated. Run 'gh auth login' and retry."+ fi++ log "Triggering workflow '${PROMOTION_WORKFLOW_FILE}'..."+ gh workflow run "$PROMOTION_WORKFLOW_FILE" --ref main -f confirm=promote+ log "Workflow dispatched successfully."+}++main() {+ ensure_on_main_branch+ ensure_main_matches_origin+ fetch_production_branch++ local prisma_migrations+ local clickhouse_migrations+ prisma_migrations="$(collect_prisma_migrations_not_in_production)"+ clickhouse_migrations="$(collect_clickhouse_migrations_not_in_production)"++ if [[ -n "$prisma_migrations" || -n "$clickhouse_migrations" ]]; then+ confirm_migrations_are_applied "$prisma_migrations" "$clickhouse_migrations"+ else+ log "No Prisma or ClickHouse migration differences detected between main and production."+ fi++ trigger_cloud_promotion+}++main "$@"