A service for syncing, managing, and viewing Canonical specifications from Google Drive.
This project provides a system to automatically synchronize specification documents from Google Drive, store them in a PostgreSQL database, and make them available through a web UI. It consists of:
- A sync service that periodically fetches specifications from Google Drive
- A REST API for accessing the specifications
- A web UI for browsing and searching specifications
- A PostgreSQL database for storage
- Taskfile: https://taskfile.dev/installation/
- Go 1.23 or higher: https://go.dev/doc/install
- Bun.js: https://bun.sh/docs/installation
- Docker & Docker Compose (for local development): https://docs.docker.com/get-docker/
- Google Drive API credentials
Create a .env.local
file in the root of the project with the following environment variables:
# Used for Google Drive API
GOOGLE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nREFPLACE_ME\n-----END PRIVATE KEY-----"
GOOGLE_PRIVATE_KEY_ID=1234
# Used for Google OAuth for UI login
GOOGLE_OAUTH_CLIENT_ID=1234
GOOGLE_OAUTH_CLIENT_SECRET=REPLACE_ME
- Start the PostgreSQL database using Docker:
docker-compose up -d
- Run the database migrations:
task migrate
This project uses Task (user friendly Makefile alterntive) for managing development tasks:
task run_sync
task run
Or, for hot reloading:
task dev
The project includes a Rockfile for deploying as Charm on Juju:
services:
go:
override: replace
command: /usr/bin/specs-api
startup: enabled
go-scheduler:
override: replace
startup: enabled
command: /usr/bin/specs-sync
environment:
SYNC_INTERVAL: 30m
The sync service:
- Fetches all subfolders from the configured root Google Drive folder
- For each subfolder, fetches all Google Docs
- Parses metadata from the first table in each document
- Updates the database with the specification information
- Deletes specifications that are no longer present in Google Drive