The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
self-hosting metabase stack (#65262)
Oreon Lothamerd5da0f4d3884
diff --git a/.github/workflows/pr-env-close-unlabel.yml b/.github/workflows/pr-env-close-unlabel.ymlindex 0d2ff1673b0..e466902c772 100644--- a/.github/workflows/pr-env-close-unlabel.yml+++ b/.github/workflows/pr-env-close-unlabel.yml@@ -10,6 +10,15 @@ concurrency:jobs:pr-env:- if: ${{ github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env') || github.event.label.name == 'PR-Env' }}+ if: ${{ (github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env') && !contains(github.event.pull_request.labels.*.name, 'PR-Env-self-hosting')) || github.event.label.name == 'PR-Env' }}uses: ./.github/workflows/pr-env-destroy.ymlsecrets: inherit+ with:+ self_hosting: false++ pr-env-self-hosting:+ if: ${{ (github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'PR-Env-self-hosting')) || github.event.label.name == 'PR-Env-self-hosting' }}+ uses: ./.github/workflows/pr-env-destroy.yml+ secrets: inherit+ with:+ self_hosting: truediff --git a/.github/workflows/pr-env-destroy.yml b/.github/workflows/pr-env-destroy.ymlindex 273fdb81d21..ca3733cd2d1 100644--- a/.github/workflows/pr-env-destroy.yml+++ b/.github/workflows/pr-env-destroy.yml@@ -3,6 +3,12 @@ run-name: Destroying Dynamic PR Environment for ${{ github.ref_name }} by @${{ gon:workflow_call:+ inputs:+ self_hosting:+ description: 'Self-hosting stack'+ required: false+ type: boolean+ default: falsejobs:destroy_pr:@@ -54,9 +60,20 @@ jobs:namespace: defaultuser: oidc-token- name: Destroy PR Review ENV+ if: ${{ !inputs.self_hosting }}run: |kubectl delete metabase -n hosting-pr${{ github.event.number }} hosting-pr${{ github.event.number }}kubectl delete ns hosting-pr${{ github.event.number }}+ - name: Setup Helm+ if: ${{ inputs.self_hosting }}+ uses: azure/setup-helm@v4+ with:+ version: 'latest'+ - name: Destroy PR Review ENV (self-hosting)+ if: ${{ inputs.self_hosting }}+ run: |+ helm uninstall hosting-pr${{ github.event.number }} --namespace hosting-pr${{ github.event.number }} || true+ kubectl delete ns hosting-pr${{ github.event.number }} || true- name: Setup psql clientrun: |sudo apt-get updatediff --git a/.github/workflows/pr-env-labeled.yml b/.github/workflows/pr-env-labeled.ymlindex 6fe8d12b886..de52441a8a7 100644--- a/.github/workflows/pr-env-labeled.yml+++ b/.github/workflows/pr-env-labeled.yml@@ -10,7 +10,7 @@ concurrency:jobs:uberjar:- if: ${{ github.event.label.name == 'PR-Env' }}+ if: ${{ github.event.label.name == 'PR-Env' || github.event.label.name == 'PR-Env-self-hosting' }}uses: ./.github/workflows/uberjar.ymlsecrets: inherit@@ -19,3 +19,13 @@ jobs:if: ${{ github.event.label.name == 'PR-Env' }}uses: ./.github/workflows/pr-env.ymlsecrets: inherit+ with:+ self_hosting: false++ pr-env-self-hosting:+ needs: [uberjar]+ if: ${{ github.event.label.name == 'PR-Env-self-hosting' }}+ uses: ./.github/workflows/pr-env.yml+ secrets: inherit+ with:+ self_hosting: truediff --git a/.github/workflows/pr-env.yml b/.github/workflows/pr-env.ymlindex f778d11471e..e3941398509 100644--- a/.github/workflows/pr-env.yml+++ b/.github/workflows/pr-env.yml@@ -3,6 +3,12 @@ run-name: Building Dynamic PR Environment for ${{ github.ref_name }} by @${{ giton:workflow_call:+ inputs:+ self_hosting:+ description: 'Deploy self-hosting stack'+ required: false+ type: boolean+ default: falsejobs:build:runs-on: ubuntu-latest@@ -113,8 +119,10 @@ jobs:| grep -q 1 \|| psql -c "CREATE DATABASE hosting_pr${{ github.event.number }}"- name: Download Deployment YAML template+ if: ${{ !inputs.self_hosting }}run: aws s3 cp s3://metabase-pr-env/metabase.yml.tmpl ./metabase.yml.tmpl- name: Render Deployment YAML+ if: ${{ !inputs.self_hosting }}uses: nowactions/envsubst@v1with:input: ./metabase.yml.tmpl@@ -125,8 +133,52 @@ jobs:MB_PREMIUM_EMBEDDING_TOKEN: ${{ secrets.PR_ENV_MB_PREMIUM_EMBEDDING_TOKEN }}SHA: ${{ github.event.pull_request.head.sha || github.sha }}- name: Deploy PR Review ENV+ if: ${{ !inputs.self_hosting }}run: |kubectl apply -f ./metabase.yml+ - name: Download Helm values template (self-hosting)+ if: ${{ inputs.self_hosting }}+ run: aws s3 cp s3://metabase-pr-env/values.yaml.tmpl ./values.yaml.tmpl+ - name: Render Helm values (self-hosting)+ if: ${{ inputs.self_hosting }}+ uses: nowactions/envsubst@v1+ with:+ input: ./values.yaml.tmpl+ output: ./values.yaml+ env:+ IMAGE_TAG: pr${{ github.event.number }}+ PR_NUMBER: ${{ github.event.number }}+ MB_PREMIUM_EMBEDDING_TOKEN: ${{ secrets.PR_ENV_MB_PREMIUM_EMBEDDING_TOKEN }}+ SHA: ${{ github.event.pull_request.head.sha || github.sha }}+ QUAY_USERNAME: ${{ secrets.QUAY_USERNAME }}+ QUAY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}+ OPEN_AI_API_KEY: ${{ secrets.OPEN_AI_API_KEY }}+ DB_HOST: ${{ secrets.PR_ENV_DB_HOST }}+ DB_USERNAME: ${{ secrets.PR_ENV_DB_USER }}+ DB_PASSWORD: ${{ secrets.PR_ENV_DB_PASSWORD }}+ CONFIG: ${{ secrets.PR_ENV_CONFIG }}++ - name: Setup Helm+ if: ${{ inputs.self_hosting }}+ uses: azure/setup-helm@v4+ with:+ version: 'latest'+ - name: Login to Quay.io+ if: ${{ inputs.self_hosting }}+ run: |+ helm registry login quay.io \+ --username ${{ secrets.QUAY_USERNAME }} \+ --password ${{ secrets.QUAY_PASSWORD }}+ - name: Deploy PR Review ENV (self-hosting)+ if: ${{ inputs.self_hosting }}+ run: |+ helm upgrade --install hosting-pr${{ github.event.number }} \+ oci://quay.io/enterprisemetabase/chart-metabase-stack \+ --namespace hosting-pr${{ github.event.number }} \+ --create-namespace \+ --values ./values.yaml \+ --atomic \+ --timeout 10mpreview_links:runs-on: ubuntu-latestneeds: [deploy_pr]@@ -139,3 +191,4 @@ jobs:✅ Preview:https://pr${{ github.event.number }}.coredev.metabase.com🗒️ [login instructions](https://www.notion.so/metabase/Ephemeral-PR-Environments-c74a3710c87a460dbf4fc0007a001458)+ 📦 Deployment type: ${{ inputs.self_hosting && 'PR-Env-self-hosting' || 'PR-Env' }}diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.ymlindex b6f4baa82d2..17193fe5590 100644--- a/.github/workflows/run-tests.yml+++ b/.github/workflows/run-tests.yml@@ -131,9 +131,22 @@ jobs:needs: [uberjar]if: |!cancelled() &&- contains(github.event.pull_request.labels.*.name, 'PR-Env')+ contains(github.event.pull_request.labels.*.name, 'PR-Env') &&+ !contains(github.event.pull_request.labels.*.name, 'PR-Env-self-hosting')uses: ./.github/workflows/pr-env.ymlsecrets: inherit+ with:+ self_hosting: false++ pr-env-self-hosting:+ needs: [uberjar]+ if: |+ !cancelled() &&+ contains(github.event.pull_request.labels.*.name, 'PR-Env-self-hosting')+ uses: ./.github/workflows/pr-env.yml+ secrets: inherit+ with:+ self_hosting: truecontainerize:needs: [uberjar]