🪢 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: deploy to staging ECS environment (#3327)
Steffen Schmitz05fd690486d5
diff --git a/.github/workflows/_deploy_ecs_service.yml b/.github/workflows/_deploy_ecs_service.ymlnew file mode 100644index 0000000000..2656869037--- /dev/null+++ b/.github/workflows/_deploy_ecs_service.yml@@ -0,0 +1,69 @@+name: WorkflowCall - Deploy to ECS Service+on:+ workflow_call:+ inputs:+ environment:+ type: string+ description: Deployment environment+ required: true+ service:+ type: string+ description: Name of the service to be deployed, e.g. web-ingestion, web, or worker.+ required: true+jobs:+ ecs-deploy:+ runs-on: ubuntu-latest+ environment: ${{ inputs.environment }}+ steps:+ - name: Get app name+ uses: winterjung/split@v2+ id: split+ with:+ msg: ${{ inputs.service }}+ separator: '-'+ - name: Checkout code+ uses: actions/checkout@v4+ - name: Authenticate with AWS+ # GitHub/AWS recommend to use OIDC here: https://github.com/aws-actions/configure-aws-credentials?tab=readme-ov-file#oidc+ # Probably more painful to configure, but would remove all long-lived credentials.+ uses: aws-actions/configure-aws-credentials@v4+ with:+ aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}+ aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ aws-region: ${{ vars.AWS_REGION }}+ - name: Login to AWS ECR+ id: login-ecr+ uses: aws-actions/amazon-ecr-login@v2+ - name: Build, tag, and push Docker image+ env:+ REGISTRY: ${{ steps.login-ecr.outputs.registry }}+ REPOSITORY: ${{ steps.split.outputs._0 }}+ IMAGE_TAG: ${{ github.sha }}+ run: |+ docker build \+ -t $REGISTRY/$REPOSITORY:$IMAGE_TAG \+ -f ./${{ steps.split.outputs._0 }}/Dockerfile \+ --build-arg NEXT_PUBLIC_LANGFUSE_CLOUD_REGION=${{ vars.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION }} \+ --build-arg NEXT_LANGFUSE_TRACING_SAMPLE_RATE=${{ vars.NEXT_LANGFUSE_TRACING_SAMPLE_RATE }} \+ --build-arg NEXT_PUBLIC_SENTRY_ENVIRONMENT=${{ inputs.environment }} \+ --build-arg NEXT_PUBLIC_SENTRY_DSN=${{ vars.NEXT_PUBLIC_SENTRY_DSN }} \+ --build-arg NEXT_PUBLIC_BUILD_ID=${{ github.sha }} \+ --build-arg NEXT_PUBLIC_POSTHOG_KEY=${{ vars.NEXT_PUBLIC_POSTHOG_KEY }} \+ --build-arg NEXT_PUBLIC_POSTHOG_HOST=${{ vars.NEXT_PUBLIC_POSTHOG_HOST }} \+ --build-arg NEXT_PUBLIC_CRISP_WEBSITE_ID=${{ vars.NEXT_PUBLIC_CRISP_WEBSITE_ID }} \+ .+ docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG+ - name: Render AWS ECS Task Definition+ id: render-task-definition+ uses: aws-actions/amazon-ecs-render-task-definition@v1+ with:+ container-name: ${{ inputs.service }}+ image: ${{ steps.login-ecr.outputs.registry }}/${{ steps.split.outputs._0 }}:${{ github.sha }}+ task-definition-family: ${{ inputs.environment }}-${{ inputs.service }}+ - name: Update AWS ECS Service+ uses: aws-actions/amazon-ecs-deploy-task-definition@v2+ with:+ task-definition: ${{ steps.render-task-definition.outputs.task-definition }}+ service: ${{ inputs.environment }}-${{ inputs.service }}+ cluster: ${{ inputs.environment }}-cluster+ wait-for-service-stability: true\ No newline at end of filediff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.ymlnew file mode 100644index 0000000000..dc6c428742--- /dev/null+++ b/.github/workflows/deploy.yml@@ -0,0 +1,96 @@+on:+ push:+ branches:+ - main+ workflow_dispatch:+ inputs:+ service:+ description: 'Service to be deployed'+ type: choice+ options:+ - web+ - web-ingestion+ - worker+ required: true+ environment:+ description: 'Environment to deploy to'+ type: choice+ options:+ - staging+ # - prod-us+ # - prod-eu+ required: true++concurrency:+ # Support concurrent `push` and `workflow_dispatch`` actions+ group: deploy-${{ github.event_name }}-${{ github.ref }}+ cancel-in-progress: true++name: Deploy to ECS+jobs:+ affected-services:+ runs-on: ubuntu-latest+ outputs:+ services: ${{ steps.affected-services.outputs.result }}+ steps:+ - name: Get affected services+ id: affected-services+ uses: actions/github-script@v7+ with:+ script: |+ if (context.eventName === "workflow_dispatch") {+ return `["${context.payload.inputs.app}"]`+ }+ if (context.eventName === "push") {+ return `["web", "web-ingestion", "worker"]`+ }+ return "[]"+ result-encoding: string+ - name: Print services to build+ uses: actions/github-script@v7+ env:+ services: ${{ steps.affected-services.outputs.result }}+ with:+ result-encoding: string+ script: |+ console.log('Services', `${process.env.result}` ?? 'n/a');++ affected-environments:+ runs-on: ubuntu-latest+ outputs:+ environments: ${{ steps.affected-environments.outputs.result }}+ steps:+ - name: Get affected environments+ id: affected-environments+ uses: actions/github-script@v7+ with:+ script: |+ if (context.eventName === "workflow_dispatch") {+ return `["${context.payload.inputs.environment}"]`+ }+ if (context.eventName === "push") {+ // TODO: Can we distinguish push branch vs push tag for staging vs. prod?+ return `["staging"]`+ }+ return "[]"+ result-encoding: string+ - name: Print environments to build+ uses: actions/github-script@v7+ env:+ environments: ${{ steps.affected-environments.outputs.result }}+ with:+ result-encoding: string+ script: |+ console.log('Environments', `${process.env.result}` ?? 'n/a');++ ecs-deploy:+ uses: ./.github/workflows/_deploy_ecs_service.yml+ needs: [affected-services, affected-environments]+ secrets: inherit+ strategy:+ matrix:+ service: ${{ fromJson(needs.affected-services.outputs.services) }}+ environment: ${{ fromJson(needs.affected-environments.outputs.environments) }}+ with:+ service: ${{ matrix.service }}+ environment: ${{ matrix.environment }}diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.ymlindex 4abc86907b..dd47dfede7 100644--- a/.github/workflows/pipeline.yml+++ b/.github/workflows/pipeline.yml@@ -12,6 +12,10 @@ on:branches:- "*"+concurrency:+ group: deploy-${{ github.event_name }}-${{ github.ref }}+ cancel-in-progress: true+jobs:lint:runs-on: ubuntu-latest