Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: added dev aloglia config #2654

Merged
merged 13 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/aloglia_crawler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
types: [completed]
workflow_dispatch:

env:
ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_V3_USER_ID }}
ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_V3_API_KEY }}
CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_V3_ID }}

jobs:
docsearch:
runs-on: ubuntu-latest
Expand All @@ -20,6 +25,11 @@ jobs:
API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
run: docker run -e APPLICATION_ID=$APPLICATION_ID -e API_KEY=$API_KEY -e "CONFIG=$(cat ./docsearch.config.json | jq -r tostring)" algolia/docsearch-scraper

- name: Trigger DocSearch v3 Crawler
run: |
curl -H "Content-Type: application/json" -X POST --user ${ALGOLIA_CRAWLER_USER_ID}:${ALGOLIA_CRAWLER_API_KEY} "https://crawler.algolia.com/api/1/crawlers/${CRAWLER_ID}/reindex"


- name: Slack Notification
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
Expand Down
1 change: 1 addition & 0 deletions .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ fd60bdc4fdfe8b66925db07865cb530eab4978df:docs/docs-content/integrations/kubernet
e4040084011d4d7935a589959b96ebc5cfba7a94:docs/docs-content/integrations/kubernetes.md:generic-api-key:759
e4040084011d4d7935a589959b96ebc5cfba7a94:docs/docs-content/integrations/kubernetes.md:generic-api-key:1125
e4040084011d4d7935a589959b96ebc5cfba7a94:docs/docs-content/integrations/kubernetes.md:generic-api-key:391
87bf9f7353f94ac2ecf85da3be3412202de7b72f:docusaurus.config.js:generic-api-key:363
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.PHONY: initialize start commit build

include .env

IMAGE:=spectrocloud/librarium
# Retrieve all modified files in the content folder and compare the difference between the master branch git tree blob AND this commit's git tree blob
CHANGED_FILE=$(shell git diff-tree -r --no-commit-id --name-only master HEAD | grep content)
Expand All @@ -8,6 +10,7 @@ TEMP_DIR=$(shell $TMPDIR)

CPUS := $(shell sysctl -n hw.ncpu | awk '{print int($$1 / 2)}')

ALOGLIA_CONFIG=$(shell cat docsearch.dev.config.json | jq -r tostring)


help: ## Display this help
Expand Down Expand Up @@ -198,4 +201,14 @@ verify-url-links-ci: ## Check for broken URLs in production in a GitHub Actions

format-images: ## Format images
@echo "formatting images in /static/assets/docs/images/ folder"
./scripts/compress-convert-images.sh
./scripts/compress-convert-images.sh

###@ Aloglia Indexing

update-dev-index: ## Update the Algolia index for the dev environment
@echo "updating Algolia index for dev environment"
docker run -e APPLICATION_ID=${ALGOLIA_APP_ID} -e API_KEY=${ALGOLIA_ADMIN_KEY} -e CONFIG='${ALOGLIA_CONFIG}' algolia/docsearch-scraper

remove-dev-index: ## Remove the Algolia index for the dev environment
@echo "removing Algolia index for dev environment"
algolia index delete dev-docusaurus-librarium --confirm
3 changes: 1 addition & 2 deletions docsearch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
"start_urls": ["https://docs.spectrocloud.com/"],
"sitemap_urls": ["https://docs.spectrocloud.com/sitemap.xml"],
"sitemap_alternate_links": true,
"stop_urls": ["^/api/(?!.*\\d+\\.\\d+\\.x/v1/)"],
"selectors": {
"lvl0": {
"selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
"selector": "(//ul[contains(@class,\"menu__list\")]//a[contains(@class, \"menu__link menu__link--sublist menu__link--active\")]/text() | //nav[contains(@class, \"navbar\")]//a[contains(@class, \"navbar__link--active\")]/text())[last()]",
"type": "xpath",
"global": true,
"default_value": "Documentation"
Expand Down
28 changes: 28 additions & 0 deletions docsearch.dev.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"index_name": "dev-docusaurus-librarium",
"start_urls": ["https://docs.spectrocloud.com/"],
"sitemap_urls": ["https://docs.spectrocloud.com/sitemap.xml"],
"sitemap_alternate_links": true,
"stop_urls": ["/api/"],
"selectors": {
"lvl0": {
"selector": "(//ul[contains(@class,\"menu__list\")]//a[contains(@class, \"menu__link menu__link--sublist menu__link--active\")]/text() | //nav[contains(@class, \"navbar\")]//a[contains(@class, \"navbar__link--active\")]/text())[last()]",
"type": "xpath",
"global": true,
"default_value": "Documentation"
},
"lvl1": "article h1",
"lvl2": "article h2",
"lvl3": "article h3",
"lvl4": "article h4",
"lvl5": "article h5",
"lvl6": "article h6",
"text": "article p, article li, article td, article tr"
},
"strip_chars": " .,;:#",
"custom_settings": {
"separatorsToIndex": "_",
"attributesForFaceting": ["language", "version", "type", "docusaurus_tag"],
"attributesToRetrieve": ["hierarchy", "content", "anchor", "url", "url_without_anchor", "type"]
}
}
3 changes: 2 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const config = {
editUrl: "https://github.com/spectrocloud/librarium/blob/master",
},
sitemap: {
changefreq: "weekly",
changefreq: "daily",
priority: 0.5,
ignorePatterns: ["/tags/**"],
filename: "sitemap.xml",
Expand Down Expand Up @@ -376,6 +376,7 @@ const config = {
searchParameters: {},
// Optional: path for search page that enabled by default (`false` to disable it)
searchPagePath: "search",
maxResultsPerGroup: 7,
},
sidebar: {
hideable: true,
Expand Down
Loading