Skip to content

Commit

Permalink
🚀 use new typesense deployment (#846)
Browse files Browse the repository at this point in the history
## Description <!-- Mandatory -->

Typesense service is now deployed via the k8s stack.

https://github.com/acm-uic/IaC/blob/4ad36212235e6ad8ab979e41f249fbb9c8da6b35/kubernetes/argocd/stacks/typesense/typesense.yml

This change updates the website to use the new deployment

## Issues

closes #766
closes #731

## Checklist

- [x] I've labeled the PR appropriately.
- [x] I've have built the website and verified that my changes work.
- [x] I've linked the appropriate issues and related PRs.
  • Loading branch information
bmiddha authored Nov 13, 2023
1 parent 2c52e08 commit ec0e2df
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 530 deletions.
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

14 changes: 0 additions & 14 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
version: 2
updates:
- package-ecosystem: "terraform"
directory: "/tf"
schedule:
interval: "weekly"
day: "saturday"
time: "07:00"
timezone: "America/Chicago"
labels:
- ":package: dependencies"
- ":robot: bot"
- ":building_construction: terraform"
commit-message:
prefix: ":arrow_up:"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 0 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@
- ./*.json
":construction: actions":
- .github/workflows/**/*
":building_construction: terraform":
- tf/**/*
4 changes: 0 additions & 4 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
- # terraform
name: ":building_construction: terraform"
color: "7b42bc"
description: ""
- # actions
name: ":construction: actions"
color: "8f4fbc"
Expand Down
171 changes: 7 additions & 164 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ on:
permissions:
contents: write
pages: write
id-token: write
pull-requests: write

jobs:
check_build_and_deploy_job:
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
name: Build PR and Deploy 🚀
needs: terraform_plan

steps:
- name: Checkout repo 🛎️
Expand All @@ -37,9 +35,6 @@ jobs:
yarn install
- name: Build ⚙️
env:
TYPESENSE_HOST: ${{ needs.terraform_plan.outputs.typesense_container_app_fqdn }}
TYPESENSE_SEARCH_ONLY_API_KEY: ${{ needs.terraform_plan.outputs.typesense_search_only_api_key }}
run: |
yarn build
Expand Down Expand Up @@ -75,7 +70,6 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
name: Build and Push GitHub Pages Site 🚀
needs: terraform_apply
concurrency:
group: build_release_gh_pages
cancel-in-progress: true
Expand Down Expand Up @@ -106,9 +100,6 @@ jobs:
yarn prettier:ci
- name: Build ⚙️
env:
TYPESENSE_HOST: ${{ needs.terraform_apply.outputs.typesense_container_app_fqdn }}
TYPESENSE_SEARCH_ONLY_API_KEY: ${{ needs.terraform_apply.outputs.typesense_search_only_api_key }}
run: |
yarn build
Expand All @@ -124,166 +115,18 @@ jobs:
update_search_db:
runs-on: ubuntu-latest
name: Update search DB 🔍
needs: [terraform_apply, build_release_gh_pages]
steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
with:
submodules: recursive

- name: Run DocSearch Scraper 🔍
run: |
docker run \
--env TYPESENSE_API_KEY="${{ secrets.TYPESENSE_API_KEY }}" \
--env TYPESENSE_HOST="${{ needs.terraform_apply.outputs.typesense_container_app_fqdn }}" \
--env TYPESENSE_PORT="443" \
--env TYPESENSE_PROTOCOL="https" \
--env CONFIG="$(cat ./.github/workflows/typesense-scraper-config.json | jq -r tostring)" \
typesense/docsearch-scraper:0.7.0
terraform_plan:
runs-on: ubuntu-latest
name: Terraform Plan 🤖📖
if: github.event_name == 'pull_request' && github.event.action != 'closed'
concurrency:
group: terraform
cancel-in-progress: false
outputs:
typesense_search_only_api_key: ${{ steps.tf-outputs.outputs.typesense_search_only_api_key }}
typesense_container_app_fqdn: ${{ steps.tf-outputs.outputs.typesense_container_app_fqdn }}
env:
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARM_USE_OIDC: true
TF_WORKSPACE: prod
TF_IN_AUTOMATION: true
TF_INPUT: 0

steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
with:
submodules: recursive

- name: Azure CLI setup ⚙️
uses: azure/login@v1
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}

- name: Terraform Format 💄
id: fmt
uses: dflook/terraform-fmt-check@v1
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

- name: Terraform Validate 👀
id: validate
uses: dflook/terraform-validate@v1
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

- name: Get Typesense collection name ⚙️
id: get_typesense_collection_name
run: |
typesense_collection_name=$(jq -r '.index_name' .github/workflows/typesense-scraper-config.json)
echo "typesense_collection_name=$typesense_collection_name" >> "$GITHUB_OUTPUT"
- name: Terraform Plan 📖
id: plan
uses: dflook/terraform-plan@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}
variables: |
typesense_api_key="${{ secrets.TYPESENSE_API_KEY }}"
typesense_rg="${{ secrets.TYPESENSE_RESOURCE_GROUP_NAME }}"
typesense_collection_name="${{ steps.get_typesense_collection_name.outputs.typesense_collection_name }}"
- name: Get outputs ⚙️
uses: dflook/terraform-output@v1
id: tf-outputs
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

terraform_apply:
runs-on: ubuntu-latest
name: Terraform Apply 🤖🚀
environment: azure-container-app
concurrency:
group: terraform
cancel-in-progress: false
env:
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.AZURE_AD_TENANT_ID }}
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
ARM_USE_OIDC: true
TF_WORKSPACE: prod
TF_IN_AUTOMATION: true
TF_INPUT: 0
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
outputs:
typesense_search_only_api_key: ${{ steps.tf-outputs.outputs.typesense_search_only_api_key }}
typesense_container_app_fqdn: ${{ steps.tf-outputs.outputs.typesense_container_app_fqdn }}

steps:
- name: Checkout repo 🛎️
uses: actions/checkout@v4
with:
submodules: recursive

- name: Azure CLI setup ⚙️
uses: azure/login@v1
with:
client-id: ${{ env.ARM_CLIENT_ID }}
tenant-id: ${{ env.ARM_TENANT_ID }}
subscription-id: ${{ env.ARM_SUBSCRIPTION_ID }}

- name: Terraform Format 💄
id: fmt
uses: dflook/terraform-fmt-check@v1
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

- name: Terraform Validate 👀
id: validate
uses: dflook/terraform-validate@v1
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

- name: Get Typesense collection name ⚙️
id: get_typesense_collection_name
run: |
typesense_collection_name=$(jq -r '.index_name' .github/workflows/typesense-scraper-config.json)
echo "typesense_collection_name=$typesense_collection_name" >> "$GITHUB_OUTPUT"
- name: Terraform Apply 🚀
id: apply
uses: dflook/terraform-apply@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}
variables: |
typesense_api_key="${{ secrets.TYPESENSE_API_KEY }}"
typesense_rg="${{ secrets.TYPESENSE_RESOURCE_GROUP_NAME }}"
typesense_collection_name="${{ steps.get_typesense_collection_name.outputs.typesense_collection_name }}"
- name: Get outputs ⚙️
uses: dflook/terraform-output@v1
id: tf-outputs
- name: Run DocSearch Scraper 🔍
uses: celsiusnarhwal/typesense-scraper@v2
with:
path: tf
workspace: ${{ env.TF_WORKSPACE }}

api-key: ${{ secrets.TYPESENSE_API_KEY }}
host: typesense.acmuic.org
port: 443
protocol: https
config: docsearch.config.json
42 changes: 0 additions & 42 deletions .github/workflows/drift.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

/.tmp
/.tmp
.env
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"esbenp.prettier-vscode",
"DavidAnson.vscode-markdownlint",
"stylelint.vscode-stylelint",
"unifiedjs.vscode-mdx",
"hashicorp.terraform"
"unifiedjs.vscode-mdx"
]
}
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,5 @@
"svgr",
"typecheck",
"typesense"
],
"[terraform]": {
"editor.defaultFormatter": "hashicorp.terraform"
}
]
}
File renamed without changes.
10 changes: 3 additions & 7 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
require("dotenv").config();

/* eslint-disable @typescript-eslint/no-var-requires */
const {
config: { discordServerId, discordServerInviteLink, slackWorkspaceSignUpLink, youTubeChannelLink },
} = require("./appConfig");

const { index_name: typesenseCollectionName } = require("./.github/workflows/typesense-scraper-config.json");

const gitHubOrg = "acm-uic";
const gitHubRepoName = "acm-uic.github.io";
const gitHubOrgUrl = `https://github.com/${gitHubOrg}`;
const gitHubRepoUrl = `${gitHubOrgUrl}/${gitHubRepoName}`;
const gitHubRepoDefaultBranch = "main";
const gitHubPagesUrl = `https://${gitHubRepoName}`;
const typesenseHost = process.env.TYPESENSE_HOST ?? "localhost";
const typesenseKey = process.env.TYPESENSE_SEARCH_ONLY_API_KEY ?? "test_key";
const typesenseHost = "typesense.acmuic.org";
const typesenseKey = "QRerr6QNQ96HpqBaof6yPinG7fnq11bs"; // key with search-only permissions
const typesenseCollectionName = "docusaurus-2";

/**
*
Expand Down
40 changes: 0 additions & 40 deletions tf/.gitignore

This file was deleted.

Loading

0 comments on commit ec0e2df

Please sign in to comment.