From c546fab5e1abd037189f7f0df5bfd130ce252b31 Mon Sep 17 00:00:00 2001 From: James Thompson <1jamesthompson1@gmail.com> Date: Mon, 23 Mar 2026 08:01:38 +0000 Subject: [PATCH] Get obidian live sync to work and add doc site --- .pre-commit-config.yaml | 6 +++++ Makefile | 8 +----- README.md | 2 +- docs-site/README.md | 7 +++++ docs-site/docker-compose.yml | 20 ++++++++++++++ docs/index.md | 1 + docs/services/docs-site.md | 10 +++++++ docs/services/obsidian-livesync.md | 1 + mkdocs.yml | 1 + obsidian-livesync/.env.example | 1 - obsidian-livesync/README.md | 1 + obsidian-livesync/docker-compose.yml | 39 ++++++++++++++++++++++------ 12 files changed, 80 insertions(+), 17 deletions(-) create mode 100644 docs-site/README.md create mode 100644 docs-site/docker-compose.yml create mode 100644 docs/services/docs-site.md create mode 100644 obsidian-livesync/README.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 06f8078..ec3ac89 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,3 +7,9 @@ repos: language: system pass_filenames: false always_run: true + - id: build-docs-site + name: Build docs site + entry: make docs + language: system + pass_filenames: false + always_run: true diff --git a/Makefile b/Makefile index 06cdf3f..834f2ce 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -SERVICES=traefik whoami gitea nextcloud devbox +SERVICES=traefik whoami gitea nextcloud devbox docs-site .PHONY: up down restart backup init-env env-sync docs generate-docs serve-docs logs status up-% down-% @@ -69,12 +69,6 @@ generate-docs: python3 scripts/generate_docs.py docs: generate-docs - @command -v uvx >/dev/null 2>&1 || { \ - echo "Error: uvx is not installed or not in PATH."; \ - echo "Install with: curl -LsSf https://astral.sh/uv/install.sh | sh"; \ - echo "Then run: source $$HOME/.local/bin/env"; \ - exit 1; \ - } uvx --from mkdocs-material --with mkdocs-include-markdown-plugin mkdocs build serve-docs: generate-docs diff --git a/README.md b/README.md index 798df40..146f508 100755 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Currently includes: Gitea (Git hosting), Nextcloud (cloud storage), Devbox (deve ## Documentation -Full documentation is available at the [MkDocs site](https://homelab.sjhl.nz) or build locally with `make docs`. +Full documentation is available at the [MkDocs site](https://docs.sjhl.nz) or build locally with `make docs`. ## Directory Structure diff --git a/docs-site/README.md b/docs-site/README.md new file mode 100644 index 0000000..3bd4eea --- /dev/null +++ b/docs-site/README.md @@ -0,0 +1,7 @@ +Serves the generated MkDocs static output from `../site` using NGINX. + +Routing is handled by Traefik with host `docs.${DOMAIN}`. + +Deploy flow: +1. Build docs: `make docs` +2. Start container: `make up-docs-site` (or `make up`) diff --git a/docs-site/docker-compose.yml b/docs-site/docker-compose.yml new file mode 100644 index 0000000..51a3e79 --- /dev/null +++ b/docs-site/docker-compose.yml @@ -0,0 +1,20 @@ +services: + docs-site: + image: nginx:alpine + container_name: docs-site + restart: unless-stopped + volumes: + - ../site:/usr/share/nginx/html:ro + networks: + - web + labels: + - "traefik.enable=true" + - "traefik.http.routers.docs-site.entrypoints=websecure" + - "traefik.http.routers.docs-site.rule=Host(`docs.${DOMAIN}`)" + - "traefik.http.routers.docs-site.tls=true" + - "traefik.http.routers.docs-site.tls.certresolver=letsencrypt" + - "traefik.http.services.docs-site.loadbalancer.server.port=80" + +networks: + web: + external: true diff --git a/docs/index.md b/docs/index.md index 99c1cc9..58df80e 100755 --- a/docs/index.md +++ b/docs/index.md @@ -16,6 +16,7 @@ Welcome to Seirian & James' homelab documentation! This is a docs site that is b | Service | Image | Status | |---------|-------|--------| | [devbox](services/devbox.md) | `devbox-devcontainer` | active | +| [docs-site](services/docs-site.md) | `nginx:alpine` | active | | [gitea](services/gitea.md) | `gitea/gitea:1.24.3` | active | | [nextcloud](services/nextcloud.md) | `ghcr.io/nextcloud-releases/all-in-one:latest` | active | | [obsidian-livesync](services/obsidian-livesync.md) | `couchdb:latest` | active | diff --git a/docs/services/docs-site.md b/docs/services/docs-site.md new file mode 100644 index 0000000..686ba3d --- /dev/null +++ b/docs/services/docs-site.md @@ -0,0 +1,10 @@ +# docs-site + + +--8<-- "docs-site/README.md" +> Below are the configuration files for this service. For details on how to deploy or customize, refer to the README above or the official documentation for the service. +## Docker Compose Configuration + +```yaml +--8<-- "docs-site/docker-compose.yml" +``` diff --git a/docs/services/obsidian-livesync.md b/docs/services/obsidian-livesync.md index ad123b7..967f364 100755 --- a/docs/services/obsidian-livesync.md +++ b/docs/services/obsidian-livesync.md @@ -1,6 +1,7 @@ # obsidian-livesync +--8<-- "obsidian-livesync/README.md" > Below are the configuration files for this service. For details on how to deploy or customize, refer to the README above or the official documentation for the service. ## Docker Compose Configuration diff --git a/mkdocs.yml b/mkdocs.yml index 2c4437d..2db5827 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,6 +12,7 @@ nav: - Recovery Reference: recovery.md - Services: - Devbox: services/devbox.md + - Docs Site: services/docs-site.md - Gitea: services/gitea.md - Nextcloud: services/nextcloud.md - Obsidian Livesync: services/obsidian-livesync.md diff --git a/obsidian-livesync/.env.example b/obsidian-livesync/.env.example index 9c0a43c..3b4971a 100755 --- a/obsidian-livesync/.env.example +++ b/obsidian-livesync/.env.example @@ -3,4 +3,3 @@ COUCHDB_USER=admin COUCHDB_PASSWORD=REPLACE_WITH_STRONG_PASSWORD -COUCHDB_PORT=5984 diff --git a/obsidian-livesync/README.md b/obsidian-livesync/README.md new file mode 100644 index 0000000..d875264 --- /dev/null +++ b/obsidian-livesync/README.md @@ -0,0 +1 @@ +*Note*: When setting up for the first time you need to create the directories for both the etc and the data and make sure they are owned by the same UID as the CouchDB container (default 5984) to avoid permission issues. \ No newline at end of file diff --git a/obsidian-livesync/docker-compose.yml b/obsidian-livesync/docker-compose.yml index 61adab1..265fefa 100755 --- a/obsidian-livesync/docker-compose.yml +++ b/obsidian-livesync/docker-compose.yml @@ -3,13 +3,36 @@ services: image: couchdb:latest container_name: obsidian-livesync restart: unless-stopped - ports: - - "${COUCHDB_PORT:-5984}:5984" - volumes: - - ${STORAGE_PATH}/obsidian:/opt/couchdb/data - env_file: - - ../.env - - .env environment: - - COUCHDB_USER=${COUCHDB_USER:-admin} + - COUCHDB_USER=${COUCHDB_USER} - COUCHDB_PASSWORD=${COUCHDB_PASSWORD} + volumes: + - ${STORAGE_PATH}/obsidian-livesync/data:/opt/couchdb/data + - ${STORAGE_PATH}/obsidian-livesync/local.ini:/opt/couchdb/etc/local.d + ports: + - 5984:5984 + labels: + - "traefik.enable=true" + # The Traefik Network + - "traefik.docker.network=web" + # Don't forget to replace 'obsidian-livesync.example.org' with your own domain + - "traefik.http.routers.obsidian-livesync.rule=Host(`obsidian-livesync.${DOMAIN}`)" + # The 'websecure' entryPoint is basically your HTTPS entrypoint. Check the next code snippet if you are encountering problems only; you probably have a working traefik configuration if this is not your first container you are reverse proxying. + - "traefik.http.routers.obsidian-livesync.entrypoints=websecure" + - "traefik.http.routers.obsidian-livesync.service=obsidian-livesync" + - "traefik.http.services.obsidian-livesync.loadbalancer.server.port=5984" + - "traefik.http.routers.obsidian-livesync.tls=true" + # Replace the string 'letsencrypt' with your own certificate resolver + - "traefik.http.routers.obsidian-livesync.tls.certresolver=letsencrypt" + - "traefik.http.middlewares.obsidiancors.headers.accessControlAllowOriginList=app://obsidian.md,capacitor://localhost,http://localhost" + - "traefik.http.middlewares.obsidiancors.headers.accessControlAllowMethods=GET,POST,PUT,DELETE,OPTIONS,HEAD" + - "traefik.http.middlewares.obsidiancors.headers.accessControlAllowHeaders=Authorization,Content-Type,Accept,Origin,X-Requested-With" + - "traefik.http.middlewares.obsidiancors.headers.accessControlAllowCredentials=true" + - "traefik.http.middlewares.obsidiancors.headers.accessControlMaxAge=86400" + - "traefik.http.middlewares.obsidiancors.headers.addVaryHeader=true" + - "traefik.http.routers.obsidian-livesync.middlewares=obsidiancors" + networks: + - web +networks: + web: + external: true \ No newline at end of file