Skip to content

Commit

Permalink
Remove traces of mdbook
Browse files Browse the repository at this point in the history
- We don't use it anymore, so this saves us time in the CI
- Remove the completely mis-placed README and moved the typesearch relevant sections as a sub-section under "Building Documentation"
  • Loading branch information
tronical committed Oct 14, 2024
1 parent 328f99a commit c2ebe3c
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 130 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,12 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Cache mdbook and mdbook-linkcheck
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/mdbook
~/.cargo/bin/mdbook-linkcheck
key: ${{ runner.os }}-${{ github.job }}-mdbook
- uses: ./.github/actions/install-linux-dependencies
- uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: rustfmt
target: aarch64-linux-android
- name: Install mdbook
run: cargo install mdbook || true
- name: Install mdbook-linkcheck
run: cargo install mdbook-linkcheck || true
- name: Install apt dependencies
run: sudo apt-get install doxygen
- name: Upgrade pip and install pipenv
Expand Down
119 changes: 0 additions & 119 deletions docs/README.md

This file was deleted.

83 changes: 83 additions & 0 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,86 @@ Run the following commands from the `/api/node` sub-folder to generate the docs
npm install
npm run docs
```

### Building search database

We use Typesense for document search.

#### Infrastructure

* Typesense Server: The Typesense Server will hold the search index.
* Accessibility: The Typesense server must be accessible from the search bar in documentation site.
* Docker: Docker is needed to run the Typesense Docsearch Scraper.
* Typesense Docsearch Scraper: This tool will be used to index the documentation website.

#### Pre-requisites

* Install docker (<https://docs.docker.com/engine/install/>)

* Install jq

```sh
pip3 install jq
```

#### Testing Locally

* Install and start Typesense server (<https://typesense.org/docs/guide/install-typesense.html#option-2-local-machine-self-hosting>)
* Note down the API key, the default port, and the data directory.

* Verify that the server is running
* Replace the port below with the default port
* It should return {"ok":true} if the server is running correctly.

```sh
curl http://localhost:8108/health
```

#### Testing on Typesense Cloud

* Create an account as per instructions (<https://typesense.org/docs/guide/install-typesense.html#option-1-typesense-cloud>)
* Note down the API key and the hostname.

#### Creating search index

A helper script is located under `search` sub-folder that will (optionally) build the docs (currently only Slint docs), scrape the documents, and upload the search index to Typesense server.

The script accepts the following arguments

-a : API key to authenticate with Typesense Server (default: `xyz`)

-b : Build Slint docs (for testing locally set this flag ) (default: `false`)

-c : Location of config file (default: `docs/search/scraper-config.json`)

-d : Location of index.html of docs (default: `target/slintdocs/html`)

-i : Name of the search index (default: `local`)

-p : Port to access Typesense server (default: `8108`)

-r : Remote Server when using Typesense Cloud

-u : URL on which the docs will be served (default: `http://localhost:8000`)

Example when running locally

```sh
docs/search/docsearch-scraper.sh -b
```

Example when running on Typesense Cloud, where `$cluster_name` is the name of the cluster on Typesense Cloud

```sh
docs/search/docsearch-scraper.sh -a API_KEY -b -r TYPESENSE_CLOUD_HOST_NAME
```

#### Testing search functionality

Run http server

```sh
python3 -m http.server -d target/slintdocs/html
```

Open browser (<http://localhost:8000>) and use the search bar to search for content

0 comments on commit c2ebe3c

Please sign in to comment.