close CLOUD-137 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced advanced workspace-scoped search and aggregation capabilities with support for complex queries, highlights, and pagination. - Added pluggable search providers: Elasticsearch and Manticoresearch. - New GraphQL queries, schema types, and resolver support for search and aggregation. - Enhanced configuration options for search providers in self-hosted and cloud deployments. - Added Docker Compose services and environment variables for Elasticsearch and Manticoresearch. - Integrated indexer service into deployment and CI workflows. - **Bug Fixes** - Improved error handling with new user-friendly error messages for search provider and indexer issues. - **Documentation** - Updated configuration examples and environment variable references for indexer and search providers. - **Tests** - Added extensive end-to-end and provider-specific tests covering indexing, searching, aggregation, deletion, and error cases. - Included snapshot tests and test fixtures for search providers. - **Chores** - Updated deployment scripts, Helm charts, and Kubernetes manifests to include indexer-related environment variables and secrets. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
191 lines
7.7 KiB
YAML
191 lines
7.7 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
flavor:
|
|
description: 'Select what enverionment to deploy to'
|
|
type: choice
|
|
default: canary
|
|
options:
|
|
- canary
|
|
- beta
|
|
- stable
|
|
- internal
|
|
|
|
permissions:
|
|
contents: 'write'
|
|
id-token: 'write'
|
|
packages: 'write'
|
|
|
|
jobs:
|
|
output-prev-version:
|
|
name: Output previous version
|
|
runs-on: ubuntu-latest
|
|
environment: ${{ github.event.inputs.flavor }}
|
|
outputs:
|
|
prev: ${{ steps.print.outputs.version }}
|
|
namespace: ${{ steps.print.outputs.namespace }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Auth to Cluster
|
|
uses: './.github/actions/cluster-auth'
|
|
with:
|
|
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
|
|
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
|
|
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
|
|
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
|
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
|
- name: Output previous version
|
|
id: print
|
|
run: |
|
|
namespace=""
|
|
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
|
|
namespace="dev"
|
|
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
|
|
namespace="beta"
|
|
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
|
|
namespace="production"
|
|
else
|
|
echo "Invalid flavor: ${{ github.event.inputs.flavor }}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Namespace set to: $namespace"
|
|
|
|
# Get the previous version from the deployment
|
|
prev_version=$(kubectl get deployment -n $namespace affine-graphql -o=jsonpath='{.spec.template.spec.containers[0].image}' | awk -F '-' '{print $3}')
|
|
|
|
echo "Previous version: $prev_version"
|
|
echo "version=$prev_version" >> $GITHUB_OUTPUT
|
|
echo "namesapce=$namespace" >> $GITHUB_OUTPUT
|
|
|
|
build-images:
|
|
name: Build Images
|
|
uses: ./.github/workflows/build-images.yml
|
|
secrets: inherit
|
|
with:
|
|
flavor: ${{ github.event.inputs.flavor }}
|
|
|
|
deploy:
|
|
name: Deploy to cluster
|
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
environment: ${{ github.event.inputs.flavor }}
|
|
needs:
|
|
- build-images
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Version
|
|
id: version
|
|
uses: ./.github/actions/setup-version
|
|
- name: Deploy to ${{ github.event.inputs.flavor }}
|
|
uses: ./.github/actions/deploy
|
|
with:
|
|
build-type: ${{ github.event.inputs.flavor }}
|
|
gcp-project-number: ${{ secrets.GCP_PROJECT_NUMBER }}
|
|
gcp-project-id: ${{ secrets.GCP_PROJECT_ID }}
|
|
service-account: ${{ secrets.GCP_HELM_DEPLOY_SERVICE_ACCOUNT }}
|
|
cluster-name: ${{ secrets.GCP_CLUSTER_NAME }}
|
|
cluster-location: ${{ secrets.GCP_CLUSTER_LOCATION }}
|
|
env:
|
|
APP_VERSION: ${{ steps.version.outputs.APP_VERSION }}
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
CANARY_DEPLOY_HOST: ${{ secrets.CANARY_DEPLOY_HOST }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
|
|
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
|
|
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
|
|
GCLOUD_CONNECTION_NAME: ${{ secrets.GCLOUD_CONNECTION_NAME }}
|
|
REDIS_SERVER_HOST: ${{ secrets.REDIS_SERVER_HOST }}
|
|
REDIS_SERVER_PASSWORD: ${{ secrets.REDIS_SERVER_PASSWORD }}
|
|
CLOUD_SQL_IAM_ACCOUNT: ${{ secrets.CLOUD_SQL_IAM_ACCOUNT }}
|
|
APP_IAM_ACCOUNT: ${{ secrets.APP_IAM_ACCOUNT }}
|
|
STATIC_IP_NAME: ${{ secrets.STATIC_IP_NAME }}
|
|
AFFINE_INDEXER_SEARCH_PROVIDER: ${{ secrets.AFFINE_INDEXER_SEARCH_PROVIDER }}
|
|
AFFINE_INDEXER_SEARCH_ENDPOINT: ${{ secrets.AFFINE_INDEXER_SEARCH_ENDPOINT }}
|
|
AFFINE_INDEXER_SEARCH_USERNAME: ${{ secrets.AFFINE_INDEXER_SEARCH_USERNAME }}
|
|
AFFINE_INDEXER_SEARCH_PASSWORD: ${{ secrets.AFFINE_INDEXER_SEARCH_PASSWORD }}
|
|
|
|
deploy-done:
|
|
needs:
|
|
- output-prev-version
|
|
- build-images
|
|
- deploy
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
name: Post deploy message
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: toeverything/blocksuite
|
|
path: blocksuite
|
|
fetch-depth: 0
|
|
fetch-tags: true
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
with:
|
|
extra-flags: 'workspaces focus @affine/changelog'
|
|
electron-install: false
|
|
- name: Output deployed info
|
|
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
|
id: set_info
|
|
run: |
|
|
if [ "${{ github.event.inputs.flavor }}" = "canary" ]; then
|
|
echo "deployed_url=https://affine.fail" >> $GITHUB_OUTPUT
|
|
elif [ "${{ github.event.inputs.flavor }}" = "beta" ]; then
|
|
echo "deployed_url=https://insider.affine.pro" >> $GITHUB_OUTPUT
|
|
elif [ "${{ github.event.inputs.flavor }}" = "stable" ]; then
|
|
echo "deployed_url=https://app.affine.pro" >> $GITHUB_OUTPUT
|
|
else
|
|
exit 1
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
- name: Post Success event to a Slack channel
|
|
if: ${{ always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
|
|
run: node ./tools/changelog/index.js
|
|
env:
|
|
CHANNEL_ID: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
DEPLOYED_URL: ${{ steps.set_info.outputs.deployed_url }}
|
|
PREV_VERSION: ${{ needs.output-prev-version.outputs.prev }}
|
|
NAMESPACE: ${{ needs.output-prev-version.outputs.namespace }}
|
|
DEPLOYMENT: 'SERVER'
|
|
FLAVOR: ${{ github.event.inputs.flavor }}
|
|
BLOCKSUITE_REPO_PATH: ${{ github.workspace }}/blocksuite
|
|
- name: Post Failed event to a Slack channel
|
|
id: failed-slack
|
|
uses: slackapi/slack-github-action@v2.1.0
|
|
if: ${{ always() && contains(needs.*.result, 'failure') }}
|
|
with:
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
|
|
blocks:
|
|
- type: section
|
|
text:
|
|
type: mrkdwn
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy failed `${{ github.event.inputs.flavor }}`>"
|
|
- name: Post Cancel event to a Slack channel
|
|
id: cancel-slack
|
|
uses: slackapi/slack-github-action@v2.1.0
|
|
if: ${{ always() && contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
|
|
with:
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
method: chat.postMessage
|
|
payload: |
|
|
channel: ${{ secrets.RELEASE_SLACK_CHNNEL_ID }}
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"
|
|
blocks:
|
|
- type: section
|
|
text:
|
|
type: mrkdwn
|
|
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Backend deploy cancelled `${{ github.event.inputs.flavor }}`>"
|