/knowledgebase

Knowledgebase website

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

@groton/knowledgebase

Knowledgebase website

While written specifically to facilitate our school knowledgebase, this is a monorepo that contains three separate apps that (can, theoretically) all operate independently of each other:

  • indexer scans a Google Drive folder, builds an index of the files and file permissions in that folder, and syncs the files in the Google Drive folder to a Google Cloud Storage bucket as either their static HTML versions (Google Docs, Sheets, Slides, etc.) or the native files (PDF, PNG, etc.), setting the access permissions on the Cloud Storage items to match the Google Drive permissions.
  • router runs on Google App Engine and serves up a website hosted in Google Cloud Storage, mapping the user request path to paths in Google Cloud storage, with users authenticated to the site via OAuth 2.0.
  • ui is a front end script that parses the static HTML of a published Google Doc and enhances the UI in a variety of ways: build a table of contents, change links to embeds, standardize formatting, make images zoomable, etc. At present, it is a bit more tightly tied to router than maybe it should be (it also adds a navbar and search).

Dependencies

Install

  1. Clone this repo:
git clone git@github.com:groton-school/knowledgebase.git path/to/repo
  1. Install dependencies:
cd path/to/repo
pnpm i -r
  1. Create a new Google Cloud Project -- make a note of the project ID (e.g. egregious-juniper-123456 or similar). While the setup script (below) can create a new project for you, it cannot configure OAuth consent...
  2. Configure OAuth Consent for that project
  3. Run the setup script, answering questions reasonably (starting with the project ID):
cd path/to/repo
npx tsx bin/setup.ts

Configure

There are a number of places where configuration can be performed. Refer to the individual apps for for more information.

Deploy & Sync

The site is initially synced and deployed for the first time as part of the installation process in the setup script.

To resync changes from the Google Drive folder to the site:

cd path/to/repo
pnpm run sync