Retire quartz, hasura and autoheal into .deprecated/
Deploy with Docker Compose / deploy (push) Successful in 1m1s
Deploy with Docker Compose / deploy (push) Successful in 1m1s
Quartz was already replaced by silverbullet-public; its build context moves to .deprecated/quartz. Hasura and autoheal are removed from the stack, with their compose services (and Hasura's nginx blocks) kept verbatim under .deprecated/ alongside a README on how to bring each back. Removes the /hasura/ route from both nginx templates and the envsubst allow-list, and updates the docs and comments that referred to the three services. With autoheal gone nothing restarts an unhealthy container; the healthchecks are now informational only, and the docs say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# .deprecated
|
||||
|
||||
STATUS: nothing in here is live. No compose file, nginx template or script
|
||||
references this directory. It is kept, not deleted, in line with the repo's
|
||||
"legacy is kept" convention; the full history is also in git.
|
||||
|
||||
## quartz/
|
||||
|
||||
The static-site build that used to serve `/notes/`. Replaced by the read-only
|
||||
`silverbullet-public` service (PR #6). Its compose service and nginx route were
|
||||
removed at that point; only the build context survives here.
|
||||
|
||||
## hasura/
|
||||
|
||||
Admin-only DB console that was proxied at `/hasura/`.
|
||||
|
||||
- `docker-compose.hasura.yml` — the service, verbatim.
|
||||
- `nginx-locations.conf` — the upstream variable and `location` blocks that
|
||||
were in both `nginx.conf.template` and `nginx_dev_common.conf.template`.
|
||||
|
||||
To bring it back: layer the compose file
|
||||
(`docker compose -f docker-compose.yml -f .deprecated/hasura/docker-compose.hasura.yml up`),
|
||||
paste the nginx blocks back into both templates, re-add `${HASURA_HOST}
|
||||
${HASURA_PORT}` to `ENVSUBST_VARS` in `nginx/entrypoint.sh`, and set
|
||||
`HASURA_HOST`, `HASURA_PORT` and `HASURA_GRAPHQL_ADMIN_SECRET` in `.env`. Dev
|
||||
mode additionally set `HASURA_GRAPHQL_ENABLE_CONSOLE` and
|
||||
`HASURA_GRAPHQL_DEV_MODE` to `"true"`.
|
||||
|
||||
## autoheal/
|
||||
|
||||
Watchdog that restarted any container docker marked `unhealthy` (only `backend`
|
||||
and `python` define healthchecks). It mounts the docker socket, which is
|
||||
effectively root on the host. To bring it back, layer
|
||||
`docker-compose.autoheal.yml` the same way as above.
|
||||
@@ -0,0 +1,27 @@
|
||||
# STATUS: deprecated — not part of the stack. See ../README.md for how to bring
|
||||
# it back. Kept verbatim from docker-compose.yml.
|
||||
services:
|
||||
# Watchdog: docker itself marks a container `unhealthy` but never acts on it.
|
||||
# autoheal polls the docker socket and restarts anything that goes unhealthy.
|
||||
# AUTOHEAL_CONTAINER_LABEL=all means "watch every container that defines a
|
||||
# healthcheck" (i.e. backend and python) rather than only labelled ones.
|
||||
# It mounts the docker socket, which is effectively root on the host — that
|
||||
# is the price of the feature. Because of that the image is pinned BY DIGEST,
|
||||
# not by a floating tag: `:latest` meant any future push to Docker Hub would
|
||||
# silently gain root on the Pi at the next `docker compose pull`/`up`. The
|
||||
# digest below is a multi-arch index (it includes linux/arm64, which is what
|
||||
# the Pi pulls) and was the content of `willfarrell/autoheal:latest` at the
|
||||
# time of pinning. To bump it: pull the new tag, `docker image inspect
|
||||
# willfarrell/autoheal:<tag> --format '{{index .RepoDigests 0}}'`, and paste
|
||||
# the digest here — never go back to a bare tag.
|
||||
# Deliberately NOT on app-network: it talks only to the socket.
|
||||
autoheal:
|
||||
image: willfarrell/autoheal@sha256:4ce976e9033b41426d44633295d6a08f9bc5929b27866352d91b31d4f6b26447
|
||||
container_name: autoheal
|
||||
restart: always
|
||||
environment:
|
||||
- AUTOHEAL_CONTAINER_LABEL=all
|
||||
- AUTOHEAL_INTERVAL=30
|
||||
- AUTOHEAL_START_PERIOD=60
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
@@ -0,0 +1,23 @@
|
||||
# STATUS: deprecated — not part of the stack. See ../README.md for how to bring
|
||||
# it back. Kept verbatim from docker-compose.yml, so it still relies on that
|
||||
# file's `db` service and `app-network`, and must be layered on top of it.
|
||||
services:
|
||||
# Admin-only DB browser, reached at /hasura/. Console and dev mode are OFF in
|
||||
# production (turned on by the dev override). It is additionally gated in
|
||||
# nginx by an `auth_request` subrequest to the backend's /auth/validate-admin,
|
||||
# so an admin cookie is required before the request ever reaches Hasura —
|
||||
# the admin secret alone is not the only line of defence.
|
||||
hasura:
|
||||
image: hasura/graphql-engine:v2.44.0
|
||||
container_name: "${HASURA_HOST}"
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
HASURA_GRAPHQL_DATABASE_URL: "postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
|
||||
HASURA_GRAPHQL_ADMIN_SECRET: "${HASURA_GRAPHQL_ADMIN_SECRET}"
|
||||
HASURA_GRAPHQL_ENABLE_CONSOLE: "false"
|
||||
HASURA_GRAPHQL_DEV_MODE: "false"
|
||||
HASURA_GRAPHQL_ENABLED_LOG_TYPES: "startup, http-log, webhook-log, websocket-log, query-log"
|
||||
@@ -0,0 +1,21 @@
|
||||
# STATUS: deprecated. The /hasura/ blocks removed from nginx.conf.template and
|
||||
# nginx_dev_common.conf.template (identical in both). See ../README.md.
|
||||
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
|
||||
|
||||
location /hasura {
|
||||
return 301 /hasura/;
|
||||
}
|
||||
|
||||
location /hasura/ {
|
||||
auth_request /internal/auth/admin-validate;
|
||||
error_page 401 403 = @auth_denied;
|
||||
rewrite ^/hasura/(.*)$ /$1 break;
|
||||
proxy_pass $upstream_hasura;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
# =============================================================================
|
||||
# Quartz image — builds the Obsidian notes site.
|
||||
#
|
||||
# STATUS: RETIRED (not live). /notes/ is now served by the read-only
|
||||
# silverbullet-public service; this directory is no longer referenced by
|
||||
# docker-compose.yml or nginx. Kept for reference / rollback: restoring it means
|
||||
# re-adding the service, the QUARTZ_* vars to nginx/entrypoint.sh's allow-list,
|
||||
# and pointing /notes/ back at it (with the prefix-strip rewrite Quartz needs).
|
||||
#
|
||||
# HOW THE SOURCE IS OBTAINED: Quartz is not an npm package you depend on, it is
|
||||
# an application you clone and configure. So the image `git clone`s the
|
||||
# upstream repo at build time, which is why `git` is installed. --depth 1
|
||||
# --branch pins to an exact tag (QUARTZ_VERSION, overridable as a build ARG)
|
||||
# and fetches no history — a shallow clone is much faster on a Pi and the
|
||||
# history is of no use here.
|
||||
#
|
||||
# Because this clone happens at build time, upstream Quartz is only updated
|
||||
# when the image is rebuilt with a bumped QUARTZ_VERSION. The tag pin is the
|
||||
# thing stopping an upstream change from breaking the notes site on a routine
|
||||
# redeploy.
|
||||
#
|
||||
# gettext-base supplies `envsubst` for rendering quartz.config.ts from its
|
||||
# template at container start (see quartz/entrypoint.sh).
|
||||
#
|
||||
# quartz.config.ts.template and quartz.layout.ts are copied in AFTER the clone
|
||||
# so they land on top of the upstream defaults — layout is used as-is, config
|
||||
# is templated at runtime because it needs DOMAIN.
|
||||
#
|
||||
# node:22-slim is multi-arch, so this builds unchanged on the Pi.
|
||||
# =============================================================================
|
||||
FROM node:22-slim
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --yes git gettext-base \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /quartz
|
||||
|
||||
ARG QUARTZ_VERSION=v4.4.0
|
||||
RUN git clone --depth 1 --branch ${QUARTZ_VERSION} \
|
||||
https://github.com/jackyzha0/quartz.git . \
|
||||
&& npm ci
|
||||
|
||||
COPY quartz.config.ts.template /quartz/quartz.config.ts.template
|
||||
COPY quartz.layout.ts /quartz/quartz.layout.ts
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
# =============================================================================
|
||||
# quartz entrypoint — render the config, then build-and-serve the notes site.
|
||||
#
|
||||
# WHAT IT DOES
|
||||
# Quartz turns the Obsidian vault into a static site. Its config is a
|
||||
# TypeScript file that has to know the public base URL, which is only known
|
||||
# at runtime, so quartz.config.ts is generated from a template on each start.
|
||||
#
|
||||
# THE envsubst ALLOW-LIST
|
||||
# Only ${DOMAIN} is substituted. This matters more here than elsewhere: the
|
||||
# template is TypeScript and full of `${...}` -shaped syntax and dollar signs
|
||||
# that must NOT be touched. Restricting envsubst to a single name guarantees
|
||||
# it can only ever rewrite the one intended line (baseUrl).
|
||||
#
|
||||
# WHY build --serve RATHER THAN A STATIC BUILD
|
||||
# --serve leaves Quartz running as an HTTP server AND watching the content
|
||||
# directory, so editing a note in Obsidian on the host re-renders the site
|
||||
# live with no container restart. The vault is bind-mounted READ-ONLY
|
||||
# (docker-compose.yml), so Quartz can watch it but never write to it.
|
||||
# The trade-off is that this is a long-running Node process on a Pi rather
|
||||
# than pre-built static files nginx could serve for free.
|
||||
#
|
||||
# ACCESS CONTROL
|
||||
# None here — Quartz is wide open on its port inside app-network. The site is
|
||||
# private because nginx gates /notes/ behind an `auth_request` admin check
|
||||
# before proxying. Never publish this container's port to the host.
|
||||
#
|
||||
# ENV VARS
|
||||
# DOMAIN required; becomes baseUrl "www.<DOMAIN>/notes"
|
||||
# QUARTZ_PORT optional, defaults to 8080; must match the QUARTZ_PORT nginx
|
||||
# builds its upstream from, or /notes/ 502s.
|
||||
#
|
||||
# `exec` so the Node process becomes PID 1 and receives docker's signals.
|
||||
# =============================================================================
|
||||
set -e
|
||||
|
||||
envsubst '${DOMAIN}' \
|
||||
</quartz/quartz.config.ts.template \
|
||||
>/quartz/quartz.config.ts
|
||||
|
||||
exec npx quartz build --serve --port "${QUARTZ_PORT:-8080}"
|
||||
@@ -0,0 +1,99 @@
|
||||
// =============================================================================
|
||||
// quartz.config.ts.template — Quartz site config, rendered to quartz.config.ts
|
||||
// by quartz/entrypoint.sh at container start.
|
||||
//
|
||||
// ONLY the DOMAIN placeholder is substituted (envsubst is given a one-name allow-list), so
|
||||
// every other dollar sign and backtick-template-looking construct in this
|
||||
// TypeScript file survives untouched. That restriction is deliberate: a bare
|
||||
// envsubst over a .ts file would corrupt it.
|
||||
//
|
||||
// baseUrl must keep pointing at www.<DOMAIN>/notes — it has to match the path nginx
|
||||
// proxies (/notes/) or every internal link, the sitemap and the RSS feed point
|
||||
// at the wrong place.
|
||||
//
|
||||
// enableSPA / enablePopovers are off because this site is embedded under a
|
||||
// path inside another SPA; Quartz's own client-side router would fight with it.
|
||||
//
|
||||
// ignorePatterns keeps "private", "templates" and ".obsidian" out of the build
|
||||
// — the vault is mounted whole, so this list is the only thing stopping
|
||||
// private notes being published. Check it before adding vault folders.
|
||||
//
|
||||
// This file is committed with real content (no secrets). quartz.layout.ts sits
|
||||
// alongside it and is COPY'd in by quartz/Dockerfile without templating.
|
||||
// =============================================================================
|
||||
import { QuartzConfig } from "./quartz/cfg"
|
||||
import * as Plugin from "./quartz/plugins"
|
||||
|
||||
const config: QuartzConfig = {
|
||||
configuration: {
|
||||
pageTitle: "Notes",
|
||||
pageTitleSuffix: "",
|
||||
enableSPA: false,
|
||||
enablePopovers: false,
|
||||
analytics: null,
|
||||
locale: "en-GB",
|
||||
baseUrl: "www.${DOMAIN}/notes",
|
||||
ignorePatterns: ["private", "templates", ".obsidian"],
|
||||
defaultDateType: "modified",
|
||||
theme: {
|
||||
fontOrigin: "googleFonts",
|
||||
cdnCaching: true,
|
||||
typography: {
|
||||
header: "Schibsted Grotesk",
|
||||
body: "Source Sans Pro",
|
||||
code: "IBM Plex Mono",
|
||||
},
|
||||
colors: {
|
||||
lightMode: {
|
||||
light: "#faf8f8",
|
||||
lightgray: "#e5e5e5",
|
||||
gray: "#b8b8b8",
|
||||
darkgray: "#4e4e4e",
|
||||
dark: "#2b2b2b",
|
||||
secondary: "#284b63",
|
||||
tertiary: "#84a98c",
|
||||
highlight: "rgba(143, 159, 169, 0.15)",
|
||||
textHighlight: "#fff23688",
|
||||
},
|
||||
darkMode: {
|
||||
light: "#161618",
|
||||
lightgray: "#393639",
|
||||
gray: "#646464",
|
||||
darkgray: "#d4d4d4",
|
||||
dark: "#ebebec",
|
||||
secondary: "#7b97aa",
|
||||
tertiary: "#84a98c",
|
||||
highlight: "rgba(143, 159, 169, 0.15)",
|
||||
textHighlight: "#b3aa0288",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
transformers: [
|
||||
Plugin.FrontMatter(),
|
||||
Plugin.CreatedModifiedDate({ priority: ["frontmatter", "filesystem"] }),
|
||||
Plugin.SyntaxHighlighting(),
|
||||
Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }),
|
||||
Plugin.GitHubFlavoredMarkdown(),
|
||||
Plugin.TableOfContents(),
|
||||
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
|
||||
Plugin.Description(),
|
||||
Plugin.Latex({ renderEngine: "katex" }),
|
||||
],
|
||||
filters: [Plugin.RemoveDrafts()],
|
||||
emitters: [
|
||||
Plugin.AliasRedirects(),
|
||||
Plugin.ComponentResources(),
|
||||
Plugin.ContentPage(),
|
||||
Plugin.FolderPage(),
|
||||
Plugin.TagPage(),
|
||||
Plugin.ContentIndex({ enableSiteMap: true, enableRSS: true }),
|
||||
Plugin.Assets(),
|
||||
Plugin.Static(),
|
||||
Plugin.NotFoundPage(),
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
export default config
|
||||
@@ -0,0 +1,46 @@
|
||||
import { PageLayout, SharedLayout } from "./quartz/cfg"
|
||||
import * as Component from "./quartz/components"
|
||||
|
||||
// components shared across all pages
|
||||
export const sharedPageComponents: SharedLayout = {
|
||||
head: Component.Head(),
|
||||
header: [],
|
||||
afterBody: [],
|
||||
footer: Component.Footer({
|
||||
links: {},
|
||||
}),
|
||||
}
|
||||
|
||||
// components for pages that display a single page (e.g. a single note)
|
||||
export const defaultContentPageLayout: PageLayout = {
|
||||
beforeBody: [
|
||||
Component.Breadcrumbs(),
|
||||
Component.ArticleTitle(),
|
||||
Component.ContentMeta(),
|
||||
Component.TagList(),
|
||||
],
|
||||
left: [
|
||||
Component.PageTitle(),
|
||||
Component.MobileOnly(Component.Spacer()),
|
||||
Component.Search(),
|
||||
Component.Darkmode(),
|
||||
Component.DesktopOnly(Component.Explorer()),
|
||||
],
|
||||
right: [
|
||||
Component.DesktopOnly(Component.TableOfContents()),
|
||||
Component.Backlinks(),
|
||||
],
|
||||
}
|
||||
|
||||
// components for pages that display lists of pages (e.g. tags or folders)
|
||||
export const defaultListPageLayout: PageLayout = {
|
||||
beforeBody: [Component.Breadcrumbs(), Component.ArticleTitle(), Component.ContentMeta()],
|
||||
left: [
|
||||
Component.PageTitle(),
|
||||
Component.MobileOnly(Component.Spacer()),
|
||||
Component.Search(),
|
||||
Component.Darkmode(),
|
||||
Component.DesktopOnly(Component.Explorer()),
|
||||
],
|
||||
right: [],
|
||||
}
|
||||
Reference in New Issue
Block a user