Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18265871e1 | ||
|
|
223c8ae35a | ||
|
|
d0ff2e125b | ||
|
|
705804c503 | ||
|
|
eadbc4fac3 | ||
|
|
41d8e70050 | ||
|
|
94a6abba97 | ||
|
|
65f2408ad4 | ||
|
|
46f06a033b |
@@ -16,12 +16,12 @@
|
|||||||
#
|
#
|
||||||
# Keep it in step with .env.example: a new variable goes in both. Settings that
|
# Keep it in step with .env.example: a new variable goes in both. Settings that
|
||||||
# are not secrets (hosts, ports, timezone) keep .env.example's defaults; values
|
# are not secrets (hosts, ports, timezone) keep .env.example's defaults; values
|
||||||
# a service parses (Garage's hex secrets, the S3 key id) are dummies in the exact shape it requires, or that service won't start.
|
# a service parses (the S3 key id and secret) are dummies in the exact shape it requires, or that service won't start.
|
||||||
#
|
#
|
||||||
# The dummy Postgres credentials only work on a database volume created with
|
# The dummy Postgres credentials only work on a database volume created with
|
||||||
# them: an existing dbdata volume keeps whatever password it was initialised
|
# them: an existing dbdata volume keeps whatever password it was initialised
|
||||||
# with. Only POSTGRES_DB is created on a fresh volume; the jobs and
|
# with. Only POSTGRES_DB is created on a fresh volume; the tracker database
|
||||||
# tracker databases and roles still have to be created by hand (.env.example).
|
# and role still have to be created by hand (.env.example).
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# --- Postgres ----------------------------------------------------------------
|
# --- Postgres ----------------------------------------------------------------
|
||||||
@@ -30,9 +30,6 @@ POSTGRES_PASSWORD=dev-postgres-password
|
|||||||
POSTGRES_DB=site
|
POSTGRES_DB=site
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
POSTGRES_HOST=db
|
POSTGRES_HOST=db
|
||||||
POSTGRES_JOBS_DB=jobs
|
|
||||||
POSTGRES_JOBS_USER=jobs
|
|
||||||
POSTGRES_JOBS_PASSWORD=dev-jobs-password
|
|
||||||
POSTGRES_TRACKER_DB=tracker
|
POSTGRES_TRACKER_DB=tracker
|
||||||
POSTGRES_TRACKER_USER=tracker
|
POSTGRES_TRACKER_USER=tracker
|
||||||
POSTGRES_TRACKER_PASSWORD=dev-tracker-password
|
POSTGRES_TRACKER_PASSWORD=dev-tracker-password
|
||||||
@@ -51,30 +48,7 @@ GITEA_RUNNER_HOST=
|
|||||||
GITEA_RUNNER_NAME=dev-runner
|
GITEA_RUNNER_NAME=dev-runner
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN=dev-dummy-runner-token
|
GITEA_RUNNER_REGISTRATION_TOKEN=dev-dummy-runner-token
|
||||||
|
|
||||||
# --- Email ingest (job tracker) -----------------------------------------------
|
|
||||||
# Sync is off; the credentials are fake, so a manual sign-in fails at Microsoft.
|
|
||||||
EMAIL_BACKEND=graph
|
|
||||||
MSGRAPH_CLIENT_ID=00000000-0000-0000-0000-000000000000
|
|
||||||
MSGRAPH_CLIENT_SECRET=dev-dummy-msgraph-secret
|
|
||||||
MSGRAPH_TENANT_ID=consumers
|
|
||||||
MSGRAPH_REDIRECT_URI=http://localhost/jobs/api/email/callback
|
|
||||||
IMAP_HOST=imap.invalid
|
|
||||||
IMAP_PORT=993
|
|
||||||
IMAP_EMAIL=[email protected]
|
|
||||||
IMAP_PASSWORD=dev-dummy-imap-password
|
|
||||||
EMAIL_SYNC_INTERVAL=
|
|
||||||
EMAIL_SYNC_ENABLED=false
|
|
||||||
|
|
||||||
# --- Job leads (job tracker) --------------------------------------------------
|
|
||||||
# The timer is off; "Check now" still works for the keyless board sources.
|
|
||||||
JOB_LEADS_ENABLED=false
|
|
||||||
JOB_LEADS_INTERVAL=
|
|
||||||
ADZUNA_APP_ID=dev-dummy-adzuna-id
|
|
||||||
ADZUNA_APP_KEY=dev-dummy-adzuna-key
|
|
||||||
REED_API_KEY=dev-dummy-reed-key
|
|
||||||
|
|
||||||
# --- SilverBullet (notes) ---------------------------------------------------
|
# --- SilverBullet (notes) ---------------------------------------------------
|
||||||
SILVERBULLET_HOST=silverbullet
|
|
||||||
SILVERBULLET_PORT=3000
|
SILVERBULLET_PORT=3000
|
||||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
||||||
SILVERBULLET_PUBLIC_PORT=3000
|
SILVERBULLET_PUBLIC_PORT=3000
|
||||||
@@ -139,9 +113,6 @@ SEED_DB=true
|
|||||||
PYTHON_HOST=python
|
PYTHON_HOST=python
|
||||||
PYTHON_PORT=8000
|
PYTHON_PORT=8000
|
||||||
|
|
||||||
# --- Job tracker (/jobs/) -----------------------------------------------------
|
|
||||||
JOBS_IMAGE_TAG=
|
|
||||||
|
|
||||||
# --- USACO site (/usaco/) ------------------------------------------------------
|
# --- USACO site (/usaco/) ------------------------------------------------------
|
||||||
USACO_IMAGE_TAG=
|
USACO_IMAGE_TAG=
|
||||||
USACO_GIT_TOKEN=dev-dummy-gitea-token
|
USACO_GIT_TOKEN=dev-dummy-gitea-token
|
||||||
@@ -153,15 +124,16 @@ TRACKER_TZ=Europe/London
|
|||||||
|
|
||||||
TFL_APP_KEY=dev-dummy-tfl-key
|
TFL_APP_KEY=dev-dummy-tfl-key
|
||||||
|
|
||||||
# --- Garage object store (public /uploads/) -----------------------------------
|
# --- Garage object store (public /uploads/, on stpcore) -----------------------
|
||||||
# Shapes Garage enforces: 64 hex for the RPC secret, "GK" + 24 hex for the key
|
# Uploads fall back to the `uploads` volume unless a dev stpcore is running
|
||||||
# id, 64 hex for the secret. Uploads fall back to the `uploads` volume until
|
# with LAN_BIND=172.17.0.1 and these same dummy values (see stpcore's README).
|
||||||
# garage/bootstrap.sh has imported this key and created the bucket.
|
# Shapes Garage enforces: "GK" + 24 hex for the key id, 64 hex for the secret.
|
||||||
GARAGE_RPC_SECRET=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
GARAGE_UPSTREAM=host-gateway
|
||||||
GARAGE_ADMIN_TOKEN=dev-garage-admin-token
|
GARAGE_WEBUI_TOKEN=dev-garage-webui-token
|
||||||
S3_ACCESS_KEY_ID=GK0123456789abcdef01234567
|
S3_ACCESS_KEY_ID=GK0123456789abcdef01234567
|
||||||
S3_SECRET_ACCESS_KEY=fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
|
S3_SECRET_ACCESS_KEY=fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210
|
||||||
S3_ENDPOINT=http://garage:3900
|
S3_ENDPOINT=http://garage:3900
|
||||||
S3_REGION=garage
|
S3_REGION=garage
|
||||||
S3_BUCKET=uploads
|
S3_BUCKET=uploads
|
||||||
GARAGE_CAPACITY=1G
|
|
||||||
|
STPPRIV_LAN_IP=192.0.2.1
|
||||||
|
|||||||
+46
-102
@@ -8,8 +8,8 @@
|
|||||||
# names and published ports are built.
|
# names and published ports are built.
|
||||||
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
|
# 2. `env_file: ./.env` on a service. Injects the WHOLE file as environment
|
||||||
# variables inside that container. backend, db and icecast2 do this.
|
# variables inside that container. backend, db and icecast2 do this.
|
||||||
# The `python` and `jobs` services deliberately do neither wholesale — each
|
# The `python` service deliberately does neither wholesale — each
|
||||||
# uses an explicit `environment:` allow-list, so neither sees the site's
|
# uses an explicit `environment:` allow-list, so it never sees the site's
|
||||||
# database password, the JWT secret, or any key it does not use.
|
# database password, the JWT secret, or any key it does not use.
|
||||||
#
|
#
|
||||||
# HOW TO USE
|
# HOW TO USE
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#
|
#
|
||||||
# ADDING A VARIABLE
|
# ADDING A VARIABLE
|
||||||
# Add it to .env.dev as well, with a dummy value, so the dev stack keeps
|
# Add it to .env.dev as well, with a dummy value, so the dev stack keeps
|
||||||
# starting. If the python or jobs service reads it, add it to that service's
|
# starting. If the python service reads it, add it to that service's
|
||||||
# `environment:` list in docker-compose.yml too, or the container never
|
# `environment:` list in docker-compose.yml too, or the container never
|
||||||
# receives it.
|
# receives it.
|
||||||
#
|
#
|
||||||
@@ -33,21 +33,17 @@
|
|||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# --- Postgres ----------------------------------------------------------------
|
# --- Postgres ----------------------------------------------------------------
|
||||||
# One instance, three databases: POSTGRES_DB for the Go backend,
|
# One instance, two databases: POSTGRES_DB for the Go backend and
|
||||||
# POSTGRES_JOBS_DB for the job tracker and POSTGRES_TRACKER_DB for the
|
# POSTGRES_TRACKER_DB for the activity tracker (with its own role). The job
|
||||||
# activity tracker (each of the last two with its own role). Gitea's database
|
# tracker and Gitea have their own Postgres on stppriv and stpgit. Only
|
||||||
# is in the Gitea LXC's own Postgres. Only POSTGRES_DB is auto-created on first init; the others must
|
# POSTGRES_DB is auto-created on first init; the tracker database must be
|
||||||
# be created by hand on a fresh volume (the job-tracker and ccp READMEs have
|
# created by hand on a fresh volume (the ccp README has the commands).
|
||||||
# the commands).
|
|
||||||
# POSTGRES_HOST doubles as the db container's name.
|
# POSTGRES_HOST doubles as the db container's name.
|
||||||
POSTGRES_USER=
|
POSTGRES_USER=
|
||||||
POSTGRES_PASSWORD=
|
POSTGRES_PASSWORD=
|
||||||
POSTGRES_DB=
|
POSTGRES_DB=
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
POSTGRES_HOST=db
|
POSTGRES_HOST=db
|
||||||
POSTGRES_JOBS_DB=jobs
|
|
||||||
POSTGRES_JOBS_USER=jobs
|
|
||||||
POSTGRES_JOBS_PASSWORD=
|
|
||||||
POSTGRES_TRACKER_DB=tracker
|
POSTGRES_TRACKER_DB=tracker
|
||||||
POSTGRES_TRACKER_USER=tracker
|
POSTGRES_TRACKER_USER=tracker
|
||||||
POSTGRES_TRACKER_PASSWORD=
|
POSTGRES_TRACKER_PASSWORD=
|
||||||
@@ -73,63 +69,13 @@ GITEA_RUNNER_HOST=
|
|||||||
GITEA_RUNNER_NAME=pi-runner
|
GITEA_RUNNER_NAME=pi-runner
|
||||||
GITEA_RUNNER_REGISTRATION_TOKEN=
|
GITEA_RUNNER_REGISTRATION_TOKEN=
|
||||||
|
|
||||||
# --- Email ingest (job tracker) -----------------------------------------------
|
|
||||||
# EMAIL_BACKEND selects the mail source: "graph" (Microsoft Graph API, OAuth)
|
|
||||||
# or "imap" (fallback; Microsoft has retired IMAP basic auth for outlook.com,
|
|
||||||
# so imap+app-password only works with non-Microsoft providers like Gmail).
|
|
||||||
# For "graph": register an Entra "app registration" for a personal Microsoft
|
|
||||||
# account at azure.microsoft.com > Microsoft Entra ID > App registrations
|
|
||||||
# (default tenant = "consumers"); add a delegated Mail.Read permission with
|
|
||||||
# admin/user consent, and create a client secret. Redirect URI type "Web",
|
|
||||||
# value must live behind the site's real HTTPS origin, e.g.
|
|
||||||
# https://<YOUR_DOMAIN>/jobs/api/email/callback (served by the job tracker,
|
|
||||||
# which exchanges the code there). TenantID must be "consumers" for a personal
|
|
||||||
# outlook.com account.
|
|
||||||
# The tracker's Settings page (/jobs/settings) shows the authorisation link
|
|
||||||
# until you sign in; the refresh token is persisted to
|
|
||||||
# jobs-data/msgraph_token.json.
|
|
||||||
# OAuth flow reference: https://learn.microsoft.com/en-us/graph/auth-v2-user
|
|
||||||
EMAIL_BACKEND=
|
|
||||||
MSGRAPH_CLIENT_ID=
|
|
||||||
MSGRAPH_CLIENT_SECRET=
|
|
||||||
MSGRAPH_TENANT_ID=consumers
|
|
||||||
MSGRAPH_REDIRECT_URI=
|
|
||||||
# IMAP_PASSWORD should be an app-specific password, not the account password.
|
|
||||||
# Only read when EMAIL_BACKEND=imap.
|
|
||||||
IMAP_HOST=
|
|
||||||
IMAP_PORT=993
|
|
||||||
IMAP_EMAIL=
|
|
||||||
IMAP_PASSWORD=
|
|
||||||
EMAIL_SYNC_INTERVAL=
|
|
||||||
EMAIL_SYNC_ENABLED=
|
|
||||||
|
|
||||||
# --- Job leads (job tracker) --------------------------------------------------
|
|
||||||
# The lead fetcher polls the sources listed on /jobs/leads and files new
|
|
||||||
# postings in the leads inbox. JOB_LEADS_ENABLED=true runs it on a timer;
|
|
||||||
# "Check now" on that page works whether or not it is set. JOB_LEADS_INTERVAL
|
|
||||||
# is a Go duration (default 6h). Scoring uses CLAUDE_API_KEY, above.
|
|
||||||
# The board sources (Greenhouse, Lever, Ashby) need no key. The two search
|
|
||||||
# sources do, both free:
|
|
||||||
# Adzuna: https://developer.adzuna.com/ (an application id and a key)
|
|
||||||
# Reed: https://www.reed.co.uk/developers/jobseeker
|
|
||||||
# A search source whose key is blank reports that on the page; nothing else
|
|
||||||
# is affected.
|
|
||||||
JOB_LEADS_ENABLED=
|
|
||||||
JOB_LEADS_INTERVAL=
|
|
||||||
ADZUNA_APP_ID=
|
|
||||||
ADZUNA_APP_KEY=
|
|
||||||
REED_API_KEY=
|
|
||||||
|
|
||||||
# --- SilverBullet (notes) ---------------------------------------------------
|
# --- SilverBullet (notes) ---------------------------------------------------
|
||||||
# Two instances over the same vault: the admin-only editor at /sb/, and the
|
# The public read-only notes site at /notes/. The editor, and the vault's only
|
||||||
# public read-only notes site at /notes/ (which replaced Quartz). All four
|
# writer, is stppriv (priv.DOMAIN/sb/); silverbullet-git here only pulls.
|
||||||
# default in docker-compose.yml (the caddy service's list), so they can be left
|
# Both default in docker-compose.yml.
|
||||||
# blank.
|
|
||||||
SILVERBULLET_HOST=silverbullet
|
|
||||||
SILVERBULLET_PORT=3000
|
|
||||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
SILVERBULLET_PUBLIC_HOST=silverbullet-public
|
||||||
SILVERBULLET_PUBLIC_PORT=3000
|
SILVERBULLET_PUBLIC_PORT=3000
|
||||||
# Seconds between notes commit/push cycles (default 300).
|
# Seconds between notes pulls (default 300).
|
||||||
SILVERBULLET_GIT_INTERVAL=
|
SILVERBULLET_GIT_INTERVAL=
|
||||||
|
|
||||||
# --- Go backend --------------------------------------------------------------
|
# --- Go backend --------------------------------------------------------------
|
||||||
@@ -144,8 +90,8 @@ BACKEND_SECRET=
|
|||||||
BACKEND_ENDPOINT=/api
|
BACKEND_ENDPOINT=/api
|
||||||
|
|
||||||
# --- Obsidian vault ----------------------------------------------------------
|
# --- Obsidian vault ----------------------------------------------------------
|
||||||
# HOST path, interpolated straight into the bind mounts: read-write into the
|
# HOST path, interpolated straight into the bind mounts: read-write into
|
||||||
# backend, silverbullet and silverbullet-git, read-only into
|
# silverbullet-git (which pulls it), read-only into the backend and
|
||||||
# silverbullet-public. Must be an absolute path that exists on the host or the
|
# silverbullet-public. Must be an absolute path that exists on the host or the
|
||||||
# stack will not start.
|
# stack will not start.
|
||||||
OBSIDIAN_DIR=
|
OBSIDIAN_DIR=
|
||||||
@@ -202,8 +148,8 @@ CLOUDFLARE_DNS_API_TOKEN=
|
|||||||
# --- Third-party API keys (backend) ------------------------------------------
|
# --- Third-party API keys (backend) ------------------------------------------
|
||||||
# CLAUDE_API_KEY is used by the python service, which makes the main site's
|
# CLAUDE_API_KEY is used by the python service, which makes the main site's
|
||||||
# Claude calls: the rowing photo reader, the job posting reader and the email
|
# Claude calls: the rowing photo reader, the job posting reader and the email
|
||||||
# pipeline's classifier. The backend no longer calls Claude itself. The jobs
|
# pipeline's classifier. The backend no longer calls Claude itself. The usaco
|
||||||
# and usaco containers get the same key for their own calls.
|
# container gets the same key for its own calls.
|
||||||
CLAUDE_API_KEY=
|
CLAUDE_API_KEY=
|
||||||
# Which model those calls use: claude-haiku-4-5 (cheapest), claude-sonnet-5-5
|
# Which model those calls use: claude-haiku-4-5 (cheapest), claude-sonnet-5-5
|
||||||
# (the default when blank) or claude-opus-5-5. Recreate the python service
|
# (the default when blank) or claude-opus-5-5. Recreate the python service
|
||||||
@@ -221,12 +167,6 @@ SEED_DB=
|
|||||||
PYTHON_HOST=python
|
PYTHON_HOST=python
|
||||||
PYTHON_PORT=8000
|
PYTHON_PORT=8000
|
||||||
|
|
||||||
# --- Job tracker (/jobs/) -----------------------------------------------------
|
|
||||||
# An image built and published by the job-tracker repo's CI. Blank runs
|
|
||||||
# :latest; set a commit sha to pin. Changing it needs
|
|
||||||
# `docker compose pull jobs && docker compose up -d jobs`.
|
|
||||||
JOBS_IMAGE_TAG=
|
|
||||||
|
|
||||||
# --- USACO site (/usaco/) ------------------------------------------------------
|
# --- USACO site (/usaco/) ------------------------------------------------------
|
||||||
# An image built and published by the usaco repo's CI. Blank runs :latest; set
|
# An image built and published by the usaco repo's CI. Blank runs :latest; set
|
||||||
# a commit sha to pin. Changing it needs
|
# a commit sha to pin. Changing it needs
|
||||||
@@ -257,13 +197,12 @@ USACO_CLAUDE_MONTHLY_BUDGET=
|
|||||||
# Claude cannot take audio, so this OpenAI key transcribes it (whisper-1,
|
# Claude cannot take audio, so this OpenAI key transcribes it (whisper-1,
|
||||||
# about $0.006 a minute). Blank turns reviews off.
|
# about $0.006 a minute). Blank turns reviews off.
|
||||||
USACO_OPENAI_API_KEY=
|
USACO_OPENAI_API_KEY=
|
||||||
# Optional: keep the recordings for playback in a PRIVATE Garage bucket,
|
# Optional: keep the recordings for playback in a PRIVATE Garage bucket
|
||||||
# never `uploads` (that one is served publicly at /uploads/). Its own key,
|
# (`usaco-audio` on stpcore), never `uploads` (that one is served publicly at
|
||||||
# same shapes as S3_ACCESS_KEY_ID / S3_SECRET_ACCESS_KEY above. With the
|
# /uploads/). Its own key, same shapes as S3_ACCESS_KEY_ID /
|
||||||
# key blank the recordings are thrown away once transcribed. One-off setup:
|
# S3_SECRET_ACCESS_KEY below. With the key blank the recordings are thrown
|
||||||
# docker compose exec -T garage /garage bucket create usaco-audio
|
# away once transcribed. Put the same pair in stpcore's .env and run its
|
||||||
# docker compose exec -T garage /garage key import -n usaco-site --yes "$USACO_S3_ACCESS_KEY_ID" "$USACO_S3_SECRET_ACCESS_KEY"
|
# garage/bootstrap.sh, which creates the bucket and imports the key.
|
||||||
# docker compose exec -T garage /garage bucket allow --read --write usaco-audio --key "$USACO_S3_ACCESS_KEY_ID"
|
|
||||||
USACO_S3_ACCESS_KEY_ID=
|
USACO_S3_ACCESS_KEY_ID=
|
||||||
USACO_S3_SECRET_ACCESS_KEY=
|
USACO_S3_SECRET_ACCESS_KEY=
|
||||||
|
|
||||||
@@ -287,6 +226,12 @@ RECEIPT_WEB_UPSTREAM=100.107.152.119:8765
|
|||||||
# `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`.
|
# `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`.
|
||||||
RECEIPT_WEB_TOKEN=
|
RECEIPT_WEB_TOKEN=
|
||||||
|
|
||||||
|
# --- stppriv (priv.DOMAIN) ---------------------------------------------------
|
||||||
|
# The private-tools LXC's LAN IP. Its Caddy asks /api/auth/validate-admin
|
||||||
|
# directly, not via the tunnel, and requests from this IP skip the api rate
|
||||||
|
# limit. Blank matches nothing.
|
||||||
|
STPPRIV_LAN_IP=
|
||||||
|
|
||||||
# --- Partner Radar (radar.DOMAIN) ----------------------------------------------
|
# --- Partner Radar (radar.DOMAIN) ----------------------------------------------
|
||||||
# A separate compose project on this host (adamf/cto, `make stpvm`), whose web
|
# A separate compose project on this host (adamf/cto, `make stpvm`), whose web
|
||||||
# container joins app-network as `radar-web`. Only set this to point
|
# container joins app-network as `radar-web`. Only set this to point
|
||||||
@@ -296,30 +241,29 @@ RECEIPT_WEB_TOKEN=
|
|||||||
# TfL Unified API key (500 req/min); used by the Python hotel finder
|
# TfL Unified API key (500 req/min); used by the Python hotel finder
|
||||||
TFL_APP_KEY=
|
TFL_APP_KEY=
|
||||||
|
|
||||||
# --- Garage object store (public /uploads/) -----------------------------------
|
# --- Garage object store (public /uploads/, on stpcore) -----------------------
|
||||||
# See garage/garage.toml and DEPLOYMENT.md ("Garage"). Everything here is
|
# Garage runs on the stpcore LXC (adamf/stpcore); its README is the runbook
|
||||||
# optional for the site to run: with S3_ENDPOINT blank the backend keeps
|
# and its .env holds Garage's own secrets. Everything here is optional for
|
||||||
# writing uploads to the `uploads` volume exactly as before.
|
# the site to run: with S3_ENDPOINT blank, or stpcore down, the backend
|
||||||
|
# writes uploads to the `uploads` volume and Caddy serves them from there.
|
||||||
#
|
#
|
||||||
# Garage's own secrets, passed to the garage and garage-webui containers.
|
# stpcore's LAN IP: the name `garage` is pinned to it in caddy, backend and
|
||||||
# Generate each with `openssl rand -hex 32`. The RPC secret must never change
|
# usaco. `host-gateway` in dev. Blank means 127.0.0.1, which fails fast.
|
||||||
# once the node has data; the admin token unlocks garage-webui's whole API.
|
GARAGE_UPSTREAM=
|
||||||
GARAGE_RPC_SECRET=
|
# Shared secret Caddy adds as X-Core-Token on /garage/, after the admin
|
||||||
GARAGE_ADMIN_TOKEN=
|
# gate; the same value as GARAGE_WEBUI_TOKEN in stpcore's .env.
|
||||||
# The backend's S3 access, imported into Garage by garage/bootstrap.sh.
|
# `openssl rand -hex 32`. Changing it needs `docker compose up -d caddy`.
|
||||||
# Garage only accepts this shape:
|
GARAGE_WEBUI_TOKEN=
|
||||||
|
# The backend's S3 key, the same values as in stpcore's .env (whose
|
||||||
|
# bootstrap.sh imports it). Garage only accepts this shape:
|
||||||
# S3_ACCESS_KEY_ID "GK" + 24 hex (echo GK$(openssl rand -hex 12))
|
# S3_ACCESS_KEY_ID "GK" + 24 hex (echo GK$(openssl rand -hex 12))
|
||||||
# S3_SECRET_ACCESS_KEY 64 hex (openssl rand -hex 32)
|
# S3_SECRET_ACCESS_KEY 64 hex (openssl rand -hex 32)
|
||||||
S3_ACCESS_KEY_ID=
|
S3_ACCESS_KEY_ID=
|
||||||
S3_SECRET_ACCESS_KEY=
|
S3_SECRET_ACCESS_KEY=
|
||||||
# Blank keeps uploads on disk. Set to http://garage:3900 (after running
|
# Blank keeps uploads on disk. http://garage:3900 stores new public uploads
|
||||||
# garage/bootstrap.sh) to store new public uploads in the bucket; recreate the
|
# in the bucket; recreate the backend after changing it. If a write to Garage
|
||||||
# backend after changing it. If a write to Garage fails the backend logs it and
|
# fails the backend logs it and writes to disk instead.
|
||||||
# writes to disk instead, and Caddy serves the file from there.
|
|
||||||
S3_ENDPOINT=
|
S3_ENDPOINT=
|
||||||
# Optional; these defaults match garage.toml and bootstrap.sh.
|
# Optional; these defaults match stpcore's garage.toml and bootstrap.sh.
|
||||||
S3_REGION=garage
|
S3_REGION=garage
|
||||||
S3_BUCKET=uploads
|
S3_BUCKET=uploads
|
||||||
# Optional, bootstrap.sh only: the node's capacity in the layout. With one node
|
|
||||||
# it only has to be non-zero; it is not a quota. Default 20G.
|
|
||||||
GARAGE_CAPACITY=
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ jobs:
|
|||||||
-e RENOVATE_PLATFORM=gitea \
|
-e RENOVATE_PLATFORM=gitea \
|
||||||
-e RENOVATE_ENDPOINT=http://git.adam-french.co.uk:3000/api/v1 \
|
-e RENOVATE_ENDPOINT=http://git.adam-french.co.uk:3000/api/v1 \
|
||||||
-e RENOVATE_GIT_URL=endpoint \
|
-e RENOVATE_GIT_URL=endpoint \
|
||||||
-e RENOVATE_REPOSITORIES=adamf/stpweb,adamf/stpgit \
|
-e RENOVATE_REPOSITORIES=adamf/stpweb,adamf/stpgit,adamf/stppriv,adamf/stpcore \
|
||||||
-e RENOVATE_TOKEN \
|
-e RENOVATE_TOKEN \
|
||||||
-e GITHUB_COM_TOKEN \
|
-e GITHUB_COM_TOKEN \
|
||||||
-e LOG_LEVEL=info \
|
-e LOG_LEVEL=info \
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ certbot/www
|
|||||||
# Caddy's certificates, keys and ACME account (docker-compose.yml)
|
# Caddy's certificates, keys and ACME account (docker-compose.yml)
|
||||||
caddy/data/
|
caddy/data/
|
||||||
backend/token/
|
backend/token/
|
||||||
jobs-data/
|
|
||||||
usaco-data/
|
usaco-data/
|
||||||
.env
|
.env
|
||||||
.env.bak
|
.env.bak
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ cp .env.dev .env
|
|||||||
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
|
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
|
||||||
```
|
```
|
||||||
|
|
||||||
`.env.dev` is committed and every value in it is a dummy: local-only passwords, fake third-party keys, `DOMAIN=localhost`, background jobs that touch real accounts switched off. It has to be copied to `.env` because several services read `env_file: ./.env` directly. Never put a real credential in it. Dev mode seeds the database with test data (`SEED_DB=true`) and serves the site on both http and https (a certificate from Caddy's local CA), with no redirects or security headers. Visit `http://localhost`.
|
`.env.dev` is committed and every value in it is a dummy: local-only passwords, fake third-party keys, `DOMAIN=localhost`, background jobs that touch real accounts switched off. It has to be copied to `.env` because several services read `env_file: ./.env` directly. Never put a real credential in it. Dev mode seeds the database with test data (`SEED_DB=true`) and serves the site on both http and https (a certificate from Caddy's local CA), with no redirects or security headers. Visit `http://localhost`. Uploads stay on disk unless a dev stpcore is also running (from that repo, with `LAN_BIND=172.17.0.1` and the same dummy keys as `.env.dev`), which `GARAGE_UPSTREAM=host-gateway` reaches.
|
||||||
|
|
||||||
### Full stack (production, HTTPS)
|
### Full stack (production, HTTPS)
|
||||||
|
|
||||||
@@ -59,13 +59,13 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
|
|||||||
|
|
||||||
**Frontend** (`vue/`): Vue 3 SPA with Vite, Tailwind CSS v4, Pinia stores, Vue Router. Built in a separate container; assets served by Caddy (production) or proxied to Vite dev server (dev mode).
|
**Frontend** (`vue/`): Vue 3 SPA with Vite, Tailwind CSS v4, Pinia stores, Vue Router. Built in a separate container; assets served by Caddy (production) or proxied to Vite dev server (dev mode).
|
||||||
|
|
||||||
**Python API** (`python/`): FastAPI app served by uvicorn on port 8000. Caddy proxies `/py/` to it and strips the prefix, so routes in `python/app/main.py` are written relative to `/`. Swagger UI at `/py/docs`. Dev mode mounts `python/app` and runs uvicorn with `--reload`. **The site's Claude call lives here**, behind an internal route: `/internal/rowing/read` (behind `POST /api/rowing`). The Go backend calls it directly over the Docker network through `services.CallPython`, and Caddy 404s `/py/internal/`. The model is one setting, shared with the job tracker, `CLAUDE_MODEL` (default `claude-sonnet-5-5`), set in `.env`; `python/app/claude.py` shapes the request per model. Adding another route is a short recipe in `python/README.md` ("Internal routes").
|
**Python API** (`python/`): FastAPI app served by uvicorn on port 8000. Caddy proxies `/py/` to it and strips the prefix, so routes in `python/app/main.py` are written relative to `/`. Swagger UI at `/py/docs`. Dev mode mounts `python/app` and runs uvicorn with `--reload`. **The site's Claude call lives here**, behind an internal route: `/internal/rowing/read` (behind `POST /api/rowing`). The Go backend calls it directly over the Docker network through `services.CallPython`, and Caddy 404s `/py/internal/`. The model is one setting, `CLAUDE_MODEL` (default `claude-sonnet-5-5`), set in `.env`; `python/app/claude.py` shapes the request per model. Adding another route is a short recipe in `python/README.md` ("Internal routes").
|
||||||
|
|
||||||
**Job tracker** (`jobs` service, `/jobs/`): the job application tracker, leads inbox, email pipeline and capture userscript now live in their own repo (`adamf/job-tracker` on Gitea) and run here as a published image, with their own Postgres database and role. It has no login: it asks the backend's `/auth/validate-admin` with the visitor's cookies. Nothing of it is left in `backend/`, `python/` or `vue/`; Caddy redirects the old `/cv/jobs`, `/cv/leads` and userscript URLs to `/jobs/`. A push to that repo's `main` publishes the image and rolls this stack's `jobs` container onto it; pin `JOBS_IMAGE_TAG` in `.env` to hold a version. Its variables are passed through the `jobs` service's explicit `environment:` list in `docker-compose.yml`.
|
**Job tracker and notes editor** (on stppriv): the job tracker (`adamf/job-tracker`) and the SilverBullet editor run on their own LXC, from the `adamf/stppriv` repo, at `priv.<DOMAIN>`. stppriv's Caddy gates them with this site's admin session (the cookie is set for the parent domain), asking `/api/auth/validate-admin` over the LAN; requests from `STPPRIV_LAN_IP` to that path skip the api rate limit. Caddy here 301s `/sb/`, `/jobs/` and the old `/cv/jobs`, `/cv/leads` and userscript URLs there. stppriv is the notes vault's only writer; `silverbullet-git` here runs with `SYNC_MODE=pull` and feeds `/notes/`.
|
||||||
|
|
||||||
**Gitea** (own repo, `adamf/stpgit`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from the `adamf/stpgit` repo (this repo's `gitea/` directory until then) with their own Postgres (`gitea-db`) and `.env`, deployed by hand there and never by CI. Everything on stpvm reaches it as `GITEA_HOST` (`git.<DOMAIN>`, :3000 HTTP and :2222 SSH), pinned to the LXC's LAN IP (`GITEA_UPSTREAM`) by `extra_hosts` in containers and `/etc/hosts` on the host; public DNS for that name is Cloudflare, which carries only HTTPS. There is no Gitea container or forwarder in this stack since 2026-11-24. The act_runner stays on stpvm. Runbook: that repo's README, summarised in "Gitea LXC" in `DEPLOYMENT.md` §7.
|
**Gitea** (own repo, `adamf/stpgit`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from the `adamf/stpgit` repo (this repo's `gitea/` directory until then) with their own Postgres (`gitea-db`) and `.env`, deployed by hand there and never by CI. Everything on stpvm reaches it as `GITEA_HOST` (`git.<DOMAIN>`, :3000 HTTP and :2222 SSH), pinned to the LXC's LAN IP (`GITEA_UPSTREAM`) by `extra_hosts` in containers and `/etc/hosts` on the host; public DNS for that name is Cloudflare, which carries only HTTPS. There is no Gitea container or forwarder in this stack since 2026-11-24. The act_runner stays on stpvm. Runbook: that repo's README, summarised in "Gitea LXC" in `DEPLOYMENT.md` §7.
|
||||||
|
|
||||||
**Uploads / Garage** (`garage/`): every stored file goes through one path. Frontend: `vue/src/uploads.js` (`uploadFile(file)` → URL, plus `ACCEPT` for pickers, `kindOf`, `isUploadUrl`, `tagFor`). Backend: `POST /api/uploads` (`handlers/handle_upload.go`), a thin wrapper over `services.Uploads.Save` (`services/uploads.go`), which owns the type table (`UploadTypes`), the 10MB limit, random naming and storage. A new feature that takes a file calls those, never its own endpoint. `GET /api/uploads` (admin only, `Uploads.List`, `listUploads()`) lists what is stored, bucket and disk merged, for `components/util/UploadPicker.vue`, the "choose an existing upload" modal used by the canvas's Background panel, Box editor and admin bar. Public files go to a bucket in a self-hosted Garage container (the `uploads` volume when `S3_ENDPOINT` is unset, or when Garage refuses a write). Caddy serves `/uploads/` from Garage's anonymous website endpoint first and the volume second, so the bucket is the source of truth and a Garage outage only affects bucket-only files. Private attachments (`/uploads/private/`) always stay on disk. `garage-webui` at `/garage/` (admin-gated) manages the bucket. First run on a fresh volume needs `garage/bootstrap.sh`; the full runbook is "Garage" in `DEPLOYMENT.md` §7.
|
**Uploads / Garage** (Garage itself on stpcore): every stored file goes through one path. Frontend: `vue/src/uploads.js` (`uploadFile(file)` → URL, plus `ACCEPT` for pickers, `kindOf`, `isUploadUrl`, `tagFor`). Backend: `POST /api/uploads` (`handlers/handle_upload.go`), a thin wrapper over `services.Uploads.Save` (`services/uploads.go`), which owns the type table (`UploadTypes`), the 10MB limit, random naming and storage. A new feature that takes a file calls those, never its own endpoint. `GET /api/uploads` (admin only, `Uploads.List`, `listUploads()`) lists what is stored, bucket and disk merged, for `components/util/UploadPicker.vue`, the "choose an existing upload" modal used by the canvas's Background panel, Box editor and admin bar. Public files go to a bucket in Garage (the `uploads` volume when `S3_ENDPOINT` is unset, or when Garage refuses a write). Garage and `garage-webui` are not in this stack: they run on the `stpcore` LXC, from the `adamf/stpcore` repo (the shared core other stacks depend on; its README is the runbook, including `garage/bootstrap.sh`), and the name `garage` is pinned to its LAN IP (`GARAGE_UPSTREAM`) by `extra_hosts` in `caddy`, `backend` and `usaco`. Caddy serves `/uploads/` from Garage's anonymous website endpoint (`garage:3902`) first and the volume second, so the bucket is the source of truth and a Garage or stpcore outage only affects bucket-only files. Private attachments (`/uploads/private/`) always stay on disk. `/garage/` (admin-gated) proxies to stpcore's Caddy on `garage:3909`, adding `X-Core-Token` (`GARAGE_WEBUI_TOKEN`), which that Caddy requires before it forwards to garage-webui. A new consumer of the store gets its own key and bucket on stpcore and the same `extra_hosts` pin. "Garage" in `DEPLOYMENT.md` §7 covers this side.
|
||||||
|
|
||||||
**Caddy** (`caddy/`): the public edge since 2026-11-17 — TLS, the SPA and the reverse proxy in front of every service. It obtains and renews its own certificates (DNS-01 through the Cloudflare API, into `./caddy/data`), so there is no certbot. `caddy/Caddyfile` holds the global options and the shared snippets (`proxy`, `limit`, `admin_gate`, `permission_gate`, the upload headers, logging); `caddy/routes.caddy` is the one route table both modes use — add a new route there, in the right place, because inside its `route` block the first matching `handle` wins; `caddy/sites/prod.caddy` and `sites/dev.caddy` hold what differs (TLS, security headers, the apex, static caching, `/`), picked by `CADDY_SITE`. Every variable the config reads goes through the caddy service's explicit `environment:` list. The image build runs `caddy validate`, so `make check-caddy` (or a failed deploy build) catches a bad config before any container is replaced; the first build on a host compiles Caddy with its two plugins (rate limiting, the Cloudflare DNS provider) and is slow, later ones are cached. Rate limits (`import limit <zone> <events> <window>`) are sliding windows keyed on the real client IP, and a refused request gets 503; a zone name shared by several routes shares one bucket, so it must always carry the same numbers. Every request is also logged as a JSON line, body included (redacted if it mentions a password, token or secret), to `logs/caddy/payloads.log`. The `traffic` container tails that file so it shows up in Dozzle, which is served at `/dozzle/` behind the admin login; the admin panel no longer has a log view. Caddy has a healthcheck (`http://127.0.0.1/caddy-health`); the `autoheal` container restarts it when that fails, since Docker never restarts an unhealthy container itself. Gitea is not proxied any more: it lives at `git.<DOMAIN>` (its own tunnel, from the stpgit repo) and `/gitea/*` 301s there; only the registry at the apex's `/v2/` still goes through Caddy. `caddy/edge_test.sh` checks the privacy denials and every gate against a running edge. The pre-cutover nginx and certbot configs are in `.deprecated/nginx/` and `.deprecated/certbot/`, kept for the rollback in `DEPLOYMENT.md` §7.
|
**Caddy** (`caddy/`): the public edge since 2026-11-17 — TLS, the SPA and the reverse proxy in front of every service. It obtains and renews its own certificates (DNS-01 through the Cloudflare API, into `./caddy/data`), so there is no certbot. `caddy/Caddyfile` holds the global options and the shared snippets (`proxy`, `limit`, `admin_gate`, `permission_gate`, the upload headers, logging); `caddy/routes.caddy` is the one route table both modes use — add a new route there, in the right place, because inside its `route` block the first matching `handle` wins; `caddy/sites/prod.caddy` and `sites/dev.caddy` hold what differs (TLS, security headers, the apex, static caching, `/`), picked by `CADDY_SITE`. Every variable the config reads goes through the caddy service's explicit `environment:` list. The image build runs `caddy validate`, so `make check-caddy` (or a failed deploy build) catches a bad config before any container is replaced; the first build on a host compiles Caddy with its two plugins (rate limiting, the Cloudflare DNS provider) and is slow, later ones are cached. Rate limits (`import limit <zone> <events> <window>`) are sliding windows keyed on the real client IP, and a refused request gets 503; a zone name shared by several routes shares one bucket, so it must always carry the same numbers. Every request is also logged as a JSON line, body included (redacted if it mentions a password, token or secret), to `logs/caddy/payloads.log`. The `traffic` container tails that file so it shows up in Dozzle, which is served at `/dozzle/` behind the admin login; the admin panel no longer has a log view. Caddy has a healthcheck (`http://127.0.0.1/caddy-health`); the `autoheal` container restarts it when that fails, since Docker never restarts an unhealthy container itself. Gitea is not proxied any more: it lives at `git.<DOMAIN>` (its own tunnel, from the stpgit repo) and `/gitea/*` 301s there; only the registry at the apex's `/v2/` still goes through Caddy. `caddy/edge_test.sh` checks the privacy denials and every gate against a running edge. The pre-cutover nginx and certbot configs are in `.deprecated/nginx/` and `.deprecated/certbot/`, kept for the rollback in `DEPLOYMENT.md` §7.
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
|
|||||||
- **Adding a GraphQL entity**: model in `models/models.go` (and the AutoMigrate list), schema file with directives, mapping in `gqlgen.yml`, `make generate`, fill in the resolvers; on the frontend a store built with `createCrudStore`. Model `ID uint` binds directly via `graphql.UintID` — there are no hand-written ID resolvers. Full recipe in `backend/README.md`.
|
- **Adding a GraphQL entity**: model in `models/models.go` (and the AutoMigrate list), schema file with directives, mapping in `gqlgen.yml`, `make generate`, fill in the resolvers; on the frontend a store built with `createCrudStore`. Model `ID uint` binds directly via `graphql.UintID` — there are no hand-written ID resolvers. Full recipe in `backend/README.md`.
|
||||||
- **Per-service permissions**: a non-admin account can be granted individual gated services (today only `receipt`, for `/receipt/`) in the admin panel's Manage Users tab. The keys are the registry `services.PermissionTypes` (`backend/services/permissions.go`), stored in `User.Permissions`; admins hold them all. Caddy's *permission gate* (`import permission_gate <key>` in a route, see `caddy/routes.caddy` and the snippet in `caddy/Caddyfile`) asks `GET /auth/validate/<key>`, which reads the user row, so grants apply on the next request. Making another service grantable is a registry entry plus swapping its route from `import admin_gate` to `import permission_gate <key>`. `/auth/validate-admin` and the admin gate are unchanged.
|
- **Per-service permissions**: a non-admin account can be granted individual gated services (today only `receipt`, for `/receipt/`) in the admin panel's Manage Users tab. The keys are the registry `services.PermissionTypes` (`backend/services/permissions.go`), stored in `User.Permissions`; admins hold them all. Caddy's *permission gate* (`import permission_gate <key>` in a route, see `caddy/routes.caddy` and the snippet in `caddy/Caddyfile`) asks `GET /auth/validate/<key>`, which reads the user row, so grants apply on the next request. Making another service grantable is a registry entry plus swapping its route from `import admin_gate` to `import permission_gate <key>`. `/auth/validate-admin` and the admin gate are unchanged.
|
||||||
- **Spotify tokens**: Persisted to `/backend/token/spotify_token.json` inside the container, surviving restarts.
|
- **Spotify tokens**: Persisted to `/backend/token/spotify_token.json` inside the container, surviving restarts.
|
||||||
- **Environment variables**: every variable goes in `.env.example`, and a dummy value for it in `.env.dev`. One the Python service or the job tracker reads must also be added to the `python` or `jobs` service's explicit `environment:` list in `docker-compose.yml`, or the container never receives it. `.env` is edited by hand on the host; there is no admin-panel editor.
|
- **Environment variables**: every variable goes in `.env.example`, and a dummy value for it in `.env.dev`. One the Python service reads must also be added to the `python` service's explicit `environment:` list in `docker-compose.yml`, or the container never receives it. `.env` is edited by hand on the host; there is no admin-panel editor.
|
||||||
- **Gitea feed**: Backend proxies and caches (1 min TTL) the Gitea activity feed API.
|
- **Gitea feed**: Backend proxies and caches (1 min TTL) the Gitea activity feed API.
|
||||||
- **All GORM models use soft delete** (`gorm.DeletedAt` field). Note that a `uniqueIndex` still collides with soft-deleted rows.
|
- **All GORM models use soft delete** (`gorm.DeletedAt` field). Note that a `uniqueIndex` still collides with soft-deleted rows.
|
||||||
|
|
||||||
|
|||||||
+54
-53
@@ -34,8 +34,8 @@ dials out and publishes no port; see "Cloudflare Tunnel" in §3.
|
|||||||
--------------------------------------------- (same container
|
--------------------------------------------- (same container
|
||||||
| | | | | | as icecast2)
|
| | | | | | as icecast2)
|
||||||
v v v v v v |
|
v v v v v v |
|
||||||
/api/ /radio/ /v2/ /sb/ /notes/ /py/ |
|
/api/ /radio/ /v2/ /notes/ /py/ |
|
||||||
backend icecast2 gitea sb sb-pub python |
|
backend icecast2 gitea sb-pub python |
|
||||||
| ^ |
|
| ^ |
|
||||||
| | |
|
| | |
|
||||||
| +-------------------------------------------------------+
|
| +-------------------------------------------------------+
|
||||||
@@ -76,6 +76,26 @@ forwarder here published 3000/2222 and everything used `localhost`.)
|
|||||||
A new machine or container that talks to Gitea needs the same pin, or a
|
A new machine or container that talks to Gitea needs the same pin, or a
|
||||||
`~/.ssh/config` entry pointing the name at the tailnet name `stpgit` for SSH.
|
`~/.ssh/config` entry pointing the name at the tailnet name `stpgit` for SSH.
|
||||||
|
|
||||||
|
### Garage runs on stpcore
|
||||||
|
|
||||||
|
Garage (the S3 object store behind `/uploads/`) and garage-webui are not in
|
||||||
|
this stack either. They run on the `stpcore` LXC, from `adamf/stpcore`, the
|
||||||
|
shared core every other stack depends on; its README is the runbook. The name
|
||||||
|
`garage` is pinned to that LXC's LAN IP (`GARAGE_UPSTREAM`) by `extra_hosts`
|
||||||
|
in `caddy`, `backend` and `usaco`, so the configs still say `garage:3900`
|
||||||
|
(S3), `garage:3902` (website) and `garage:3909` (stpcore's Caddy in front of
|
||||||
|
garage-webui, which wants the `X-Core-Token` this Caddy adds after the admin
|
||||||
|
gate). Nothing here depends on it being up: see "Garage" in §7.
|
||||||
|
|
||||||
|
```
|
||||||
|
stpvm (pin: garage -> stpcore LAN IP) stpcore LXC (LAN IP)
|
||||||
|
backend S3 PUT (uploads) ------+ +----------------------+
|
||||||
|
usaco S3 (usaco-audio) ------+--> garage:3900 ---> | garage :3900 S3 |
|
||||||
|
caddy /uploads/ -----------------> garage:3902 --> | :3902 web |
|
||||||
|
caddy /garage/ (+X-Core-Token) --> garage:3909 --> | caddy -> garage-webui|
|
||||||
|
+----------------------+
|
||||||
|
```
|
||||||
|
|
||||||
Gitea's public address is `https://git.<DOMAIN>/` (its `ROOT_URL`), served by
|
Gitea's public address is `https://git.<DOMAIN>/` (its `ROOT_URL`), served by
|
||||||
the LXC's own Cloudflare tunnel, not by this edge; Caddy only 301s the old
|
the LXC's own Cloudflare tunnel, not by this edge; Caddy only 301s the old
|
||||||
`/gitea/*` URLs there and still proxies the registry at the apex's `/v2/`.
|
`/gitea/*` URLs there and still proxies the registry at the apex's `/v2/`.
|
||||||
@@ -89,22 +109,20 @@ Deploys of this stack never touch Gitea.
|
|||||||
| caddy (the edge) | `caddy` | 80, 443 (fixed IP `172.28.255.251`) | everything below | **80, 443** |
|
| caddy (the edge) | `caddy` | 80, 443 (fixed IP `172.28.255.251`) | everything below | **80, 443** |
|
||||||
| backend (Go) | `${BACKEND_HOST}` | `${BACKEND_PORT}` (8080) | `${BACKEND_ENDPOINT}` = `/api/` | no |
|
| backend (Go) | `${BACKEND_HOST}` | `${BACKEND_PORT}` (8080) | `${BACKEND_ENDPOINT}` = `/api/` | no |
|
||||||
| db (Postgres 16) | `${POSTGRES_HOST}` | 5432 | none | no |
|
| db (Postgres 16) | `${POSTGRES_HOST}` | 5432 | none | no |
|
||||||
| silverbullet (editor) | `${SILVERBULLET_HOST}` | `${SILVERBULLET_PORT}` | `/sb/` (admin-gated) | no |
|
|
||||||
| silverbullet-public (notes site) | `${SILVERBULLET_PUBLIC_HOST}` | `${SILVERBULLET_PUBLIC_PORT}` | `/notes/` (**public**, read-only) | no |
|
| silverbullet-public (notes site) | `${SILVERBULLET_PUBLIC_HOST}` | `${SILVERBULLET_PUBLIC_PORT}` | `/notes/` (**public**, read-only) | no |
|
||||||
| silverbullet-git | n/a | n/a | none (timer loop) | no |
|
| silverbullet-git | n/a | n/a | none (timer loop) | no |
|
||||||
| python (FastAPI) | `${PYTHON_HOST}` | `${PYTHON_PORT}` | `/py/`, docs at `/py/docs` | no |
|
| python (FastAPI) | `${PYTHON_HOST}` | `${PYTHON_PORT}` | `/py/`, docs at `/py/docs` | no |
|
||||||
| jobs (job tracker, published image) | `jobs` | 8080 | `/jobs/` (admin-gated by Caddy `forward_auth`; capture API and userscript public, bearer-token) | no |
|
|
||||||
| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (pages admin-gated by Caddy `forward_auth`; `/api/v1/` bearer/app-checked) | no |
|
| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (pages admin-gated by Caddy `forward_auth`; `/api/v1/` bearer/app-checked) | no |
|
||||||
| icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** |
|
| icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** |
|
||||||
| vue | `vue` | 5173 (dev only) | `/` (dev only) | no |
|
| vue | `vue` | 5173 (dev only) | `/` (dev only) | no |
|
||||||
| cloudflared | `cloudflared` | — (fixed IP `172.28.255.250`) | all of Caddy, via Cloudflare | no (outbound only) |
|
| cloudflared | `cloudflared` | — (fixed IP `172.28.255.250`) | all of Caddy, via Cloudflare | no (outbound only) |
|
||||||
| dozzle (log viewer) | `dozzle` | 8080 | `/dozzle/` (admin-gated by Caddy `forward_auth`; reads the Docker socket) | no |
|
| dozzle (log viewer) | `dozzle` | 8080 | `/dozzle/` (admin-gated by Caddy `forward_auth`; reads the Docker socket; on `dozzle-net`, shared only with Caddy) | no |
|
||||||
| receipt printer (`receipt serve`, adamf/receipt_maker) | — (runs on **stppi**, not in this stack) | 8765 on stppi's Tailscale IP (`RECEIPT_WEB_UPSTREAM`) | `/receipt/`, prefix stripped (permission-gated on `receipt` by Caddy `forward_auth`; Caddy adds `X-Receipt-Token` and `X-Remote-User`). The only upstream off this host; 503 "offline" when stppi is down | no |
|
| receipt printer (`receipt serve`, adamf/receipt_maker) | — (runs on **stppi**, not in this stack) | 8765 on stppi's Tailscale IP (`RECEIPT_WEB_UPSTREAM`) | `/receipt/`, prefix stripped (permission-gated on `receipt` by Caddy `forward_auth`; Caddy adds `X-Receipt-Token` and `X-Remote-User`). The only upstream off this host; 503 "offline" when stppi is down | no |
|
||||||
| Partner Radar (adamf/cto, its own compose project) | `radar-web` (alias of that project's `web`, on app-network) | 80 | `radar.<DOMAIN>`, the whole host (its own login, no gate; zones `radar` and `radar_login`). Started from the cto checkout with `make stpvm`; 503 "offline" when that stack is down | no |
|
| Partner Radar (adamf/cto, its own compose project) | `radar-web` (alias of that project's `web`, on app-network) | 80 | `radar.<DOMAIN>`, the whole host (its own login, no gate; zones `radar` and `radar_login`). Started from the cto checkout with `make stpvm`; 503 "offline" when that stack is down | no |
|
||||||
| traffic (tails the payload log) | `traffic` | — (no network) | none; its stdout is what Dozzle shows | no |
|
| traffic (tails the payload log) | `traffic` | — (no network) | none; its stdout is what Dozzle shows | no |
|
||||||
| autoheal (restarts unhealthy caddy) | `autoheal` | — (no network) | none; reads the Docker socket | no |
|
| autoheal (restarts unhealthy caddy) | `autoheal` | — (no network) | none; reads the Docker socket | no |
|
||||||
| garage (S3 object store) | `garage` | 3900 S3, 3902 web, 3903 admin | none directly; `/uploads/` falls back to its web endpoint for files not on the volume | no |
|
| garage (S3 object store, adamf/stpcore) | — (runs on the **stpcore** LXC; `garage` pinned to `GARAGE_UPSTREAM`) | 3900 S3, 3902 web | `/uploads/` from its website endpoint first, then the `uploads` volume; backend and usaco use S3 | no |
|
||||||
| garage-webui (Garage admin UI) | `garage-webui` | 3909 | `/garage/` (admin-gated by Caddy `forward_auth`) | no |
|
| garage-webui (Garage admin UI, adamf/stpcore) | — (on **stpcore**, behind its Caddy) | 3909 on stpcore | `/garage/` (admin-gated by Caddy `forward_auth`; Caddy adds `X-Core-Token`). 503 "offline" when stpcore is down | no |
|
||||||
|
|
||||||
Container names come from `.env`, and Caddy builds its upstreams from the same
|
Container names come from `.env`, and Caddy builds its upstreams from the same
|
||||||
variables (passed through the caddy service's `environment:` list). **Renaming
|
variables (passed through the caddy service's `environment:` list). **Renaming
|
||||||
@@ -131,13 +149,15 @@ The config is `caddy/Caddyfile` (global options and snippets), `caddy/routes.cad
|
|||||||
it, so stripping the prefix serves a blank page with nothing in the log).
|
it, so stripping the prefix serves a blank page with nothing in the log).
|
||||||
- **Upstreams resolve when dialled.** Caddy starts with any upstream container
|
- **Upstreams resolve when dialled.** Caddy starts with any upstream container
|
||||||
missing and answers 502 until it appears; it never refuses to start over one.
|
missing and answers 502 until it appears; it never refuses to start over one.
|
||||||
- **Admin gate.** `/sb/`, `/jobs/`, `/tracker/`, `/dozzle/`, `/garage/`, `/radio/admin/` and `/uploads/private/` are
|
- **Admin gate.** `/tracker/`, `/dozzle/`, `/garage/`, `/radio/admin/` and `/uploads/private/` are
|
||||||
protected by `forward_auth` to the backend's `/auth/validate-admin` (the
|
protected by `forward_auth` to the backend's `/auth/validate-admin` (the
|
||||||
`admin_gate` snippet); a 401/403 redirects to the SPA login. Most of these services have no auth of their own at that path; the
|
`admin_gate` snippet); a 401/403 redirects to the SPA login. Most of these services have no auth of their own at that path; the
|
||||||
job and activity trackers also check the session themselves. Their carve-outs, which a session
|
activity tracker also checks the session itself. Its carve-outs, which a session
|
||||||
cookie never reaches, stay public at the edge and are guarded by bearer tokens in the apps:
|
cookie never reaches, stay public at the edge and are guarded by bearer tokens in the app:
|
||||||
`/jobs/api/capture` and `/jobs/job-capture.user.js`, `/tracker/api/v1/` and `/tracker/tracker.user.js`.
|
`/tracker/api/v1/` and `/tracker/tracker.user.js`. `/sb/` and `/jobs/` 301 to stppriv
|
||||||
Paths are matched cleaned and case-insensitively, so `/SB/` or `/uploads/x/../private/y`
|
(`priv.<DOMAIN>`). Its Caddy gates them with this same admin session, asking
|
||||||
|
`/api/auth/validate-admin` over the LAN; see the `adamf/stppriv` README.
|
||||||
|
Paths are matched cleaned and case-insensitively, so `/TRACKER/` or `/uploads/x/../private/y`
|
||||||
land on the gate too. With the backend down every gated path answers 502: it fails closed.
|
land on the gate too. With the backend down every gated path answers 502: it fails closed.
|
||||||
- **Permission gate.** `/receipt/` asks `/auth/validate/receipt` instead (the
|
- **Permission gate.** `/receipt/` asks `/auth/validate/receipt` instead (the
|
||||||
`permission_gate` snippet), which also lets in a
|
`permission_gate` snippet), which also lets in a
|
||||||
@@ -239,7 +259,6 @@ The override layer changes these services and disables `cloudflared`:
|
|||||||
- **backend** — `DEV_MODE`, GraphQL playground and introspection on, a localhost
|
- **backend** — `DEV_MODE`, GraphQL playground and introspection on, a localhost
|
||||||
Spotify redirect URI, and **`SEED_DB=true`**.
|
Spotify redirect URI, and **`SEED_DB=true`**.
|
||||||
- **python** — `uvicorn --reload` with `python/app` bind-mounted.
|
- **python** — `uvicorn --reload` with `python/app` bind-mounted.
|
||||||
- **jobs** — seeded, with the GraphQL playground on.
|
|
||||||
- **cloudflared** — put in the `disabled` profile, so it never starts: a dev
|
- **cloudflared** — put in the `disabled` profile, so it never starts: a dev
|
||||||
stack must never join the production tunnel.
|
stack must never join the production tunnel.
|
||||||
|
|
||||||
@@ -408,8 +427,6 @@ Setup, once:
|
|||||||
| ---------- | ----------------------------------------------------- | -------------------------------------------------- |
|
| ---------- | ----------------------------------------------------- | -------------------------------------------------- |
|
||||||
| `dbdata` | Postgres: the app database and the trackers' databases | All posts, users and messages, and the trackers' data |
|
| `dbdata` | Postgres: the app database and the trackers' databases | All posts, users and messages, and the trackers' data |
|
||||||
| `uploads` | Uploads from before Garage, private attachments, and any upload Garage refused | Those files |
|
| `uploads` | Uploads from before Garage, private attachments, and any upload Garage refused | Those files |
|
||||||
| `garage_meta` | Garage's metadata: buckets, keys, object index, layout | Everything in the bucket (the bytes in `garage_data` are unreadable without it) |
|
|
||||||
| `garage_data` | The bucket's object bytes | Every upload stored in Garage |
|
|
||||||
| `vue_dist` | The built SPA | Nothing — rebuilt on next deploy |
|
| `vue_dist` | The built SPA | Nothing — rebuilt on next deploy |
|
||||||
| `caddy_config` | Caddy's autosaved JSON config | Nothing — rewritten on every start |
|
| `caddy_config` | Caddy's autosaved JSON config | Nothing — rewritten on every start |
|
||||||
|
|
||||||
@@ -421,10 +438,9 @@ of deleting the directory:
|
|||||||
| `./caddy/data` | Caddy's TLS certificates, **private keys** and ACME account | Gitignored. Never commit. Losing it means a re-issue on the next start (§3). |
|
| `./caddy/data` | Caddy's TLS certificates, **private keys** and ACME account | Gitignored. Never commit. Losing it means a re-issue on the next start (§3). |
|
||||||
| `./certbot/conf` | The old certbot certificate and keys | Unused since 2026-11-17; kept as the rollback until it is cleaned up (§7). |
|
| `./certbot/conf` | The old certbot certificate and keys | Unused since 2026-11-17; kept as the rollback until it is cleaned up (§7). |
|
||||||
| `./backend/token/` | **Spotify OAuth refresh token** (`spotify_token.json`) | Gitignored. Without this mount, Spotify would need re-authorising after every rebuild. |
|
| `./backend/token/` | **Spotify OAuth refresh token** (`spotify_token.json`) | Gitignored. Without this mount, Spotify would need re-authorising after every rebuild. |
|
||||||
| `./jobs-data` | The job tracker's **capture token hash** and Graph OAuth session | Gitignored. Must be owned by uid 1000, the user the `jobs` image runs as. |
|
|
||||||
| `./logs` | Backend logs (`go.log`); Caddy's JSON request-body log in `logs/caddy/payloads.log` | Caddy rotates the payload log itself (50 MiB, five kept). `logs/nginx/` is nginx's, finished. |
|
| `./logs` | Backend logs (`go.log`); Caddy's JSON request-body log in `logs/caddy/payloads.log` | Caddy rotates the payload log itself (50 MiB, five kept). `logs/nginx/` is nginx's, finished. |
|
||||||
| `./icecast2/fallback_music` | Radio fallback MP3s | Copied to the host by hand, not git |
|
| `./icecast2/fallback_music` | Radio fallback MP3s | Copied to the host by hand, not git |
|
||||||
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | Read-write to backend and silverbullet, **read-only** to silverbullet-public |
|
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | A pull-only clone (`silverbullet-git`); **read-only** to backend and silverbullet-public |
|
||||||
|
|
||||||
Gitea's state (`data/`, `config/` and the `gitea_gitea_db` volume, in the
|
Gitea's state (`data/`, `config/` and the `gitea_gitea_db` volume, in the
|
||||||
`adamf/stpgit` checkout) is on the Gitea LXC, not here; see "Gitea LXC" in §7. The pre-move copy is in
|
`adamf/stpgit` checkout) is on the Gitea LXC, not here; see "Gitea LXC" in §7. The pre-move copy is in
|
||||||
@@ -452,13 +468,11 @@ Gitea's own variables are in the `.env` of its checkout on the Gitea LXC (the
|
|||||||
`adamf/stpgit` repo's `.env.example`);
|
`adamf/stpgit` repo's `.env.example`);
|
||||||
there it receives explicit `GITEA__section__KEY` variables (Gitea's own
|
there it receives explicit `GITEA__section__KEY` variables (Gitea's own
|
||||||
convention for overriding `app.ini` keys). Here, `python` receives an explicit
|
convention for overriding `app.ini` keys). Here, `python` receives an explicit
|
||||||
allow-list (as do `jobs`, `caddy` and the rest), so it never sees the database password or any API key other than
|
allow-list (as do `caddy` and the rest), so it never sees the database password or any API key other than
|
||||||
the two it uses (`TFL_APP_KEY`, and `CLAUDE_API_KEY`, plus `CLAUDE_MODEL`,
|
the two it uses (`TFL_APP_KEY`, and `CLAUDE_API_KEY`, plus `CLAUDE_MODEL`,
|
||||||
which picks the model). The Python service
|
which picks the model). The Python service
|
||||||
makes the site's one Claude call (the rowing photo reader); the `jobs` container
|
makes the site's one Claude call (the rowing photo reader). The backend receives `CLAUDE_API_KEY`
|
||||||
(the job tracker, built from its own repo) makes its own, and gets a similar
|
through `env_file` but does not use it. A new variable for it has
|
||||||
allow-list with its own database role. The backend receives `CLAUDE_API_KEY`
|
|
||||||
through `env_file` but does not use it. A new variable for either service has
|
|
||||||
to be added to its allow-list as well as
|
to be added to its allow-list as well as
|
||||||
`.env.example`.
|
`.env.example`.
|
||||||
|
|
||||||
@@ -625,43 +639,35 @@ The app schema is recreated by GORM auto-migration on backend start (there are n
|
|||||||
migration files). The job and activity trackers' databases are not
|
migration files). The job and activity trackers' databases are not
|
||||||
auto-created; their READMEs have the commands.
|
auto-created; their READMEs have the commands.
|
||||||
|
|
||||||
**Garage (the `/uploads/` bucket).** Public uploads live in a Garage bucket,
|
**Garage (the `/uploads/` bucket).** Public uploads live in a Garage bucket
|
||||||
with the `uploads` volume as a safety net. Nothing breaks while Garage is down
|
on the stpcore LXC (`adamf/stpcore`, whose README is the runbook: setup,
|
||||||
or not set up:
|
keys, the move from this host, backups), with the `uploads` volume here as a
|
||||||
|
safety net. Nothing breaks while stpcore is down or not set up:
|
||||||
|
|
||||||
- the backend writes to disk until `S3_ENDPOINT` is set, and falls back to
|
- the backend writes to disk until `S3_ENDPOINT` is set, and falls back to
|
||||||
disk (with a log line) whenever Garage refuses a write;
|
disk (with a log line) whenever Garage refuses a write or can't be reached;
|
||||||
- Caddy serves `/uploads/` from Garage and falls back to the volume when
|
- Caddy serves `/uploads/` from Garage and falls back to the volume when
|
||||||
Garage has no such file or is unreachable, and it starts without the
|
Garage has no such file or is unreachable (2s connect timeout);
|
||||||
`garage` container.
|
- `/garage/` answers 503 "offline".
|
||||||
|
|
||||||
Turning it on:
|
Pointing this stack at it: set `GARAGE_UPSTREAM` (stpcore's LAN IP),
|
||||||
|
`GARAGE_WEBUI_TOKEN` (same as stpcore's), `S3_ACCESS_KEY_ID` /
|
||||||
1. Fill in `GARAGE_RPC_SECRET`, `GARAGE_ADMIN_TOKEN`, `S3_ACCESS_KEY_ID` and
|
`S3_SECRET_ACCESS_KEY` (same as stpcore's, imported by its
|
||||||
`S3_SECRET_ACCESS_KEY` in `.env` **before** the deploy that adds the
|
`garage/bootstrap.sh`) and `S3_ENDPOINT=http://garage:3900`, then
|
||||||
containers (otherwise `garage` crash-loops on a blank secret until they
|
`docker compose up -d caddy backend usaco`. The backend logs
|
||||||
are set; nothing else is affected). `.env.example` says how to generate
|
`[upload] storing uploads in bucket uploads ...` on start.
|
||||||
each.
|
|
||||||
2. Deploy, then `garage/bootstrap.sh` (idempotent; it creates the layout, the
|
|
||||||
`uploads` bucket and the backend's key, and opens the bucket to the
|
|
||||||
website endpoint).
|
|
||||||
3. Set `S3_ENDPOINT=http://garage:3900` and `docker compose up -d backend`.
|
|
||||||
The backend logs `[upload] storing uploads in bucket uploads ...` on start.
|
|
||||||
4. Check: upload something through a canvas page or chat, then
|
|
||||||
`docker compose exec garage /garage bucket info uploads` shows the object
|
|
||||||
count going up, and the returned `/uploads/...` URL loads.
|
|
||||||
|
|
||||||
Moving the old files in (so they show in garage-webui, and so the bucket
|
Moving the old files in (so they show in garage-webui, and so the bucket
|
||||||
holds everything):
|
holds everything):
|
||||||
|
|
||||||
```
|
```
|
||||||
export $(grep -E '^S3_(ACCESS_KEY_ID|SECRET_ACCESS_KEY)=' .env)
|
export $(grep -E '^(S3_ACCESS_KEY_ID|S3_SECRET_ACCESS_KEY|GARAGE_UPSTREAM)=' .env)
|
||||||
docker run --rm --network web_server_app-network \
|
docker run --rm \
|
||||||
-v web_server_uploads:/data:ro \
|
-v web_server_uploads:/data:ro \
|
||||||
-e AWS_ACCESS_KEY_ID="$S3_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$S3_SECRET_ACCESS_KEY" \
|
-e AWS_ACCESS_KEY_ID="$S3_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$S3_SECRET_ACCESS_KEY" \
|
||||||
-e AWS_DEFAULT_REGION=garage \
|
-e AWS_DEFAULT_REGION=garage \
|
||||||
amazon/aws-cli:2.38.0 s3 sync /data s3://uploads --exclude 'private/*' \
|
amazon/aws-cli:2.38.0 s3 sync /data s3://uploads --exclude 'private/*' \
|
||||||
--endpoint-url http://garage:3900
|
--endpoint-url "http://$GARAGE_UPSTREAM:3900"
|
||||||
```
|
```
|
||||||
|
|
||||||
The copies left on the volume are then only a fallback for when Garage is
|
The copies left on the volume are then only a fallback for when Garage is
|
||||||
@@ -670,19 +676,14 @@ served from its disk copy, if it has one. Once the bucket has been trusted for
|
|||||||
a while, remove everything but `private/` from the volume.
|
a while, remove everything but `private/` from the volume.
|
||||||
|
|
||||||
**Rollback:** blank `S3_ENDPOINT` and `docker compose up -d backend`. Files
|
**Rollback:** blank `S3_ENDPOINT` and `docker compose up -d backend`. Files
|
||||||
written to the bucket in the meantime stay reachable as long as `garage` runs;
|
written to the bucket in the meantime stay reachable as long as stpcore runs;
|
||||||
to drop Garage entirely, first copy them back
|
to drop Garage entirely, first copy them back
|
||||||
(`aws s3 sync s3://uploads /data` with the volume mounted read-write).
|
(`aws s3 sync s3://uploads /data` with the volume mounted read-write).
|
||||||
|
|
||||||
**Managing files:** garage-webui at `/garage/` (site admin login). Files
|
**Managing files:** garage-webui at `/garage/` (site admin login). Files
|
||||||
uploaded there are public at `/uploads/<path>` and skip the backend's type
|
uploaded there are public at `/uploads/<path>` and skip the backend's type
|
||||||
checks; keep them under a prefix such as `media/`. Uploads through it are
|
checks; keep them under a prefix such as `media/`. Uploads through it are
|
||||||
capped at 2 GB by Caddy.
|
capped at 2 GB by Caddy, here and on stpcore.
|
||||||
|
|
||||||
**Backups:** Garage here is one node on the same disk — it is not a backup.
|
|
||||||
Back up `garage_meta` and `garage_data` together (meta without data, or the
|
|
||||||
reverse, is useless); Garage also snapshots its metadata every 6h inside
|
|
||||||
`garage_meta`.
|
|
||||||
|
|
||||||
**Gitea LXC.** Gitea runs in its own Proxmox LXC (§1), from a checkout of its
|
**Gitea LXC.** Gitea runs in its own Proxmox LXC (§1), from a checkout of its
|
||||||
own repo, `adamf/stpgit` (until 2026-11-24 this repo's `gitea/` directory),
|
own repo, `adamf/stpgit` (until 2026-11-24 this repo's `gitea/` directory),
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ backend (8080) ── Go API (GraphQL + REST)
|
|||||||
db (5432) ── PostgreSQL 16
|
db (5432) ── PostgreSQL 16
|
||||||
icecast2 (8000) ── Audio Streaming (Icecast2 + Liquidsoap)
|
icecast2 (8000) ── Audio Streaming (Icecast2 + Liquidsoap)
|
||||||
gitea (3000) ── Self-Hosted Git
|
gitea (3000) ── Self-Hosted Git
|
||||||
silverbullet (3000) ── Obsidian Notes Editor (SilverBullet 2.11.0)
|
|
||||||
silverbullet-public (3000) ── Public read-only notes site (same image, SB_READ_ONLY)
|
silverbullet-public (3000) ── Public read-only notes site (same image, SB_READ_ONLY)
|
||||||
silverbullet-git ── Commits/pushes notes edits to the notes repo
|
silverbullet-git ── Pulls the notes repo (the editor and its pushes are on stppriv)
|
||||||
python (8000) ── Python API (FastAPI)
|
python (8000) ── Python API (FastAPI)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -52,9 +51,9 @@ python (8000) ── Python API (FastAPI)
|
|||||||
- Fan shrines (GTO, Evangelion, Demoman, Skip Skip Benben)
|
- Fan shrines (GTO, Evangelion, Demoman, Skip Skip Benben)
|
||||||
- Self-hosted Git (Gitea) with CI/CD and commit feed on homepage
|
- Self-hosted Git (Gitea) with CI/CD and commit feed on homepage
|
||||||
- Printable CV with role-specific sections
|
- Printable CV with role-specific sections
|
||||||
- Job application tracker with status workflow and CSV export (admin-only, `/cv/jobs`)
|
- Job application tracker: runs on stppriv (`priv.<DOMAIN>/jobs/`), from the `adamf/job-tracker` repo
|
||||||
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
|
- Database-backed bookmarks grouped by category, managed via GraphQL (admin-only)
|
||||||
- Admin-gated routes: `/sb`, `/jobs`, `/tracker`, `/dozzle`, `/garage` and more require the admin session, checked by Caddy's `forward_auth` against the backend
|
- Admin-gated routes: `/tracker`, `/dozzle`, `/garage` and more require the admin session, checked by Caddy's `forward_auth` against the backend
|
||||||
- Landing page with animated stamps section
|
- Landing page with animated stamps section
|
||||||
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
|
- Route transitions (slide/fade) and performance optimizations (gzip, WOFF2 fonts, lazy loading)
|
||||||
- Backend healthcheck (reported in `docker ps`; nothing restarts on it)
|
- Backend healthcheck (reported in `docker ps`; nothing restarts on it)
|
||||||
@@ -67,10 +66,10 @@ python (8000) ── Python API (FastAPI)
|
|||||||
| `/stp` | Home dashboard with grid layout |
|
| `/stp` | Home dashboard with grid layout |
|
||||||
| `/admin` | Admin login + panel (authenticated) |
|
| `/admin` | Admin login + panel (authenticated) |
|
||||||
| `/cv` | Curriculum Vitae (printable) |
|
| `/cv` | Curriculum Vitae (printable) |
|
||||||
| `/cv/jobs` | Job application tracker (admin-only, hidden print) |
|
| `/cv/jobs` | 301 to the job tracker on stppriv |
|
||||||
| `/bookmarks` | Bookmarks (database-backed, grouped by category) |
|
| `/bookmarks` | Bookmarks (database-backed, grouped by category) |
|
||||||
| `/notes/:path` | Obsidian notes (read-only SilverBullet, public; `private/` excluded) |
|
| `/notes/:path` | Obsidian notes (read-only SilverBullet, public; `private/` excluded) |
|
||||||
| `/sb/` | Obsidian note editor (via SilverBullet, admin-only) |
|
| `/sb/` | 301 to the note editor on stppriv (`priv.<DOMAIN>/sb/`) |
|
||||||
| `/shrines` | Fan shrine index + individual shrines |
|
| `/shrines` | Fan shrine index + individual shrines |
|
||||||
|
|
||||||
## API
|
## API
|
||||||
@@ -180,11 +179,11 @@ Access tokens are valid for 7 days; refresh tokens for 365 days. `ValidateAdmin`
|
|||||||
| `/radio` | icecast:8000 | Audio streaming |
|
| `/radio` | icecast:8000 | Audio streaming |
|
||||||
| `/gitea` | gitea:3000 | Git service |
|
| `/gitea` | gitea:3000 | Git service |
|
||||||
| `/notes` | silverbullet-public:3000 | Obsidian notes (public, read-only) |
|
| `/notes` | silverbullet-public:3000 | Obsidian notes (public, read-only) |
|
||||||
| `/sb` | silverbullet:3000 | Obsidian notes editor (admin-only) |
|
| `/sb`, `/jobs` | 301 to `priv.<DOMAIN>` | Editor and job tracker, on stppriv |
|
||||||
| `/py` | python:8000 | Python API (FastAPI; docs at `/py/docs`) |
|
| `/py` | python:8000 | Python API (FastAPI; docs at `/py/docs`) |
|
||||||
| `/uploads` | local alias | User-uploaded files |
|
| `/uploads` | local alias | User-uploaded files |
|
||||||
|
|
||||||
`/sb` is protected by `forward_auth` to the backend's `/auth/validate-admin`. Requests without a valid admin session are redirected to `/admin/login`. The full table is `caddy/routes.caddy`; `DEPLOYMENT.md` §1 explains it.
|
Admin-only routes such as `/tracker` are protected by `forward_auth` to the backend's `/auth/validate-admin`. Requests without a valid admin session are redirected to `/admin/login`. The full table is `caddy/routes.caddy`; `DEPLOYMENT.md` §1 explains it.
|
||||||
|
|
||||||
### Deprecated Endpoints
|
### Deprecated Endpoints
|
||||||
|
|
||||||
@@ -213,11 +212,9 @@ Create a `.env` file in the project root. All services read from this file.
|
|||||||
| `UPTIMEKUMA_PORT` | Uptime Kuma port (planned) |
|
| `UPTIMEKUMA_PORT` | Uptime Kuma port (planned) |
|
||||||
| `WALLABAG_HOST` | Wallabag hostname (planned) |
|
| `WALLABAG_HOST` | Wallabag hostname (planned) |
|
||||||
| `WALLABAG_PORT` | Wallabag port (planned) |
|
| `WALLABAG_PORT` | Wallabag port (planned) |
|
||||||
| `SILVERBULLET_HOST` | SilverBullet hostname (defaults to `silverbullet`) |
|
|
||||||
| `SILVERBULLET_PORT` | SilverBullet port (defaults to `3000`) |
|
|
||||||
| `SILVERBULLET_PUBLIC_HOST` | Public notes SilverBullet hostname (defaults to `silverbullet-public`) |
|
| `SILVERBULLET_PUBLIC_HOST` | Public notes SilverBullet hostname (defaults to `silverbullet-public`) |
|
||||||
| `SILVERBULLET_PUBLIC_PORT` | Public notes SilverBullet port (defaults to `3000`) |
|
| `SILVERBULLET_PUBLIC_PORT` | Public notes SilverBullet port (defaults to `3000`) |
|
||||||
| `SILVERBULLET_GIT_INTERVAL` | Seconds between notes commit/push cycles (defaults to `300`) |
|
| `SILVERBULLET_GIT_INTERVAL` | Seconds between notes pulls (defaults to `300`) |
|
||||||
| `GITEA_RUNNER_HOST` | Gitea runner hostname |
|
| `GITEA_RUNNER_HOST` | Gitea runner hostname |
|
||||||
| `GITEA_RUNNER_NAME` | Gitea runner display name |
|
| `GITEA_RUNNER_NAME` | Gitea runner display name |
|
||||||
| `GITEA_RUNNER_REGISTRATION_TOKEN` | Token to register Gitea Actions runner |
|
| `GITEA_RUNNER_REGISTRATION_TOKEN` | Token to register Gitea Actions runner |
|
||||||
@@ -260,9 +257,9 @@ Gitea is not part of this stack. It runs in its own LXC from the `adamf/stpgit`
|
|||||||
### Obsidian Notes Setup
|
### Obsidian Notes Setup
|
||||||
|
|
||||||
1. Set `OBSIDIAN_DIR` in `.env` to the absolute path of your Obsidian vault on the host machine
|
1. Set `OBSIDIAN_DIR` in `.env` to the absolute path of your Obsidian vault on the host machine
|
||||||
2. The vault is mounted read-write into `silverbullet` at `/data`, which serves it as an
|
2. The vault is a pull-only clone of the notes repo (`silverbullet-git`, `SYNC_MODE=pull`),
|
||||||
editor at `/sb/`, and read-only into `silverbullet-public`, which serves it publicly at
|
mounted read-only into `silverbullet-public`, which serves it publicly at `/notes/` with
|
||||||
`/notes/` with `SB_READ_ONLY`
|
`SB_READ_ONLY`. The editor, and the vault's only writer, is on stppriv (`priv.<DOMAIN>/sb/`)
|
||||||
3. `private/` and `templates/` (at any depth), and dot-folders such as `.git`, are kept off
|
3. `private/` and `templates/` (at any depth), and dot-folders such as `.git`, are kept off
|
||||||
`/notes/` by `SB_SPACE_IGNORE` **and** Caddy deny rules — the Caddy rules are the ones that
|
`/notes/` by `SB_SPACE_IGNORE` **and** Caddy deny rules — the Caddy rules are the ones that
|
||||||
actually enforce it. See `DEPLOYMENT.md` ("Public notes privacy boundary")
|
actually enforce it. See `DEPLOYMENT.md` ("Public notes privacy boundary")
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ func validateBox(box *models.Box) error {
|
|||||||
if err := validateShadow(&box.Shadow); err != nil {
|
if err := validateShadow(&box.Shadow); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
box.X = max(box.X, 0)
|
|
||||||
box.Y = max(box.Y, 0)
|
box.Y = max(box.Y, 0)
|
||||||
box.W = max(box.W, minBoxSize)
|
box.W = max(box.W, minBoxSize)
|
||||||
box.H = max(box.H, minBoxSize)
|
box.H = max(box.H, minBoxSize)
|
||||||
|
|||||||
@@ -35,13 +35,14 @@ func TestValidateBox(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Geometry is clamped, not rejected: a drag past the canvas edge lands
|
// Geometry is clamped, not rejected: x may go negative, into the margin
|
||||||
// at the edge, and a box can never shrink below a grabbable size.
|
// left of a centred canvas, but nothing goes above the top or below a
|
||||||
|
// grabbable size.
|
||||||
box := models.Box{Page: "stp", Kind: "widget", Widget: str("Chat"), X: -30, Y: -1, W: 5, H: 0}
|
box := models.Box{Page: "stp", Kind: "widget", Widget: str("Chat"), X: -30, Y: -1, W: 5, H: 0}
|
||||||
if err := validateBox(&box); err != nil {
|
if err := validateBox(&box); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if box.X != 0 || box.Y != 0 || box.W != minBoxSize || box.H != minBoxSize {
|
if box.X != -30 || box.Y != 0 || box.W != minBoxSize || box.H != minBoxSize {
|
||||||
t.Fatalf("clamped to %d,%d %dx%d; want 0,0 %dx%d", box.X, box.Y, box.W, box.H, minBoxSize, minBoxSize)
|
t.Fatalf("clamped to %d,%d %dx%d; want -30,0 %dx%d", box.X, box.Y, box.W, box.H, minBoxSize, minBoxSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -96,7 +96,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
pythonURL := fmt.Sprintf("http://%s:%s", pythonHost, pythonPort)
|
pythonURL := fmt.Sprintf("http://%s:%s", pythonHost, pythonPort)
|
||||||
|
|
||||||
// Defaults match garage/garage.toml and garage/bootstrap.sh.
|
// Defaults match stpcore's garage/garage.toml and garage/bootstrap.sh.
|
||||||
s3Region := os.Getenv("S3_REGION")
|
s3Region := os.Getenv("S3_REGION")
|
||||||
if s3Region == "" {
|
if s3Region == "" {
|
||||||
s3Region = "garage"
|
s3Region = "garage"
|
||||||
@@ -154,7 +154,6 @@ func main() {
|
|||||||
Resolvers: &graph.Resolver{Store: &store},
|
Resolvers: &graph.Resolver{Store: &store},
|
||||||
Directives: graph.Directives(),
|
Directives: graph.Directives(),
|
||||||
}))
|
}))
|
||||||
gqlSrv.AddTransport(transport.Websocket{KeepAlivePingInterval: 10 * time.Second})
|
|
||||||
gqlSrv.AddTransport(transport.Options{})
|
gqlSrv.AddTransport(transport.Options{})
|
||||||
gqlSrv.AddTransport(transport.POST{})
|
gqlSrv.AddTransport(transport.POST{})
|
||||||
gqlSrv.AddTransport(transport.MultipartForm{})
|
gqlSrv.AddTransport(transport.MultipartForm{})
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
|
|
||||||
// RateLimiter is an in-memory sliding window per key, behind Caddy's limits.
|
// RateLimiter is an in-memory sliding window per key, behind Caddy's limits.
|
||||||
type RateLimiter struct {
|
type RateLimiter struct {
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
// Never evicted; grows with distinct client IPs.
|
attempts map[string][]time.Time
|
||||||
attempts map[string][]time.Time
|
max int
|
||||||
max int
|
window time.Duration
|
||||||
window time.Duration
|
lastSweep time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewRateLimiter(max int, window time.Duration) *RateLimiter {
|
func NewRateLimiter(max int, window time.Duration) *RateLimiter {
|
||||||
@@ -31,6 +31,7 @@ func (rl *RateLimiter) Allow(key string) bool {
|
|||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
cutoff := now.Add(-rl.window)
|
cutoff := now.Add(-rl.window)
|
||||||
|
rl.sweep(now, cutoff)
|
||||||
|
|
||||||
// Filtered in place, reusing the backing array.
|
// Filtered in place, reusing the backing array.
|
||||||
valid := rl.attempts[key][:0]
|
valid := rl.attempts[key][:0]
|
||||||
@@ -48,3 +49,17 @@ func (rl *RateLimiter) Allow(key string) bool {
|
|||||||
rl.attempts[key] = append(valid, now)
|
rl.attempts[key] = append(valid, now)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sweep drops keys with no attempt inside the window, at most once a window,
|
||||||
|
// so keys that are never seen again don't accumulate.
|
||||||
|
func (rl *RateLimiter) sweep(now, cutoff time.Time) {
|
||||||
|
if now.Sub(rl.lastSweep) < rl.window {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
rl.lastSweep = now
|
||||||
|
for key, times := range rl.attempts {
|
||||||
|
if len(times) == 0 || !times[len(times)-1].After(cutoff) {
|
||||||
|
delete(rl.attempts, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -58,6 +58,16 @@ func TestRateLimiterAllow(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.Run("keys idle past the window are evicted", func(t *testing.T) {
|
||||||
|
rl := NewRateLimiter(1, 5*time.Millisecond)
|
||||||
|
rl.Allow("gone")
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
rl.Allow("other")
|
||||||
|
if _, ok := rl.attempts["gone"]; ok {
|
||||||
|
t.Fatal("idle key still stored, want evicted")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
t.Run("max of zero denies everything", func(t *testing.T) {
|
t.Run("max of zero denies everything", func(t *testing.T) {
|
||||||
rl := NewRateLimiter(0, time.Minute)
|
rl := NewRateLimiter(0, time.Minute)
|
||||||
if rl.Allow("ip") {
|
if rl.Allow("ip") {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package services
|
package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -54,6 +55,24 @@ const (
|
|||||||
rateLimitMaxMsgs = 10
|
rateLimitMaxMsgs = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The route is public, so frame and field sizes are capped. Writes happen
|
||||||
|
// under mu, so a stalled client may hold it for at most writeWait.
|
||||||
|
// ChatPanel's maxlength of 1000 UTF-16 units is at most 3000 bytes, under
|
||||||
|
// maxContentBytes; over-limit messages are dropped silently.
|
||||||
|
const (
|
||||||
|
maxFrameBytes = 16 << 10
|
||||||
|
maxContentBytes = 4000
|
||||||
|
maxFileURLBytes = 512
|
||||||
|
writeWait = 5 * time.Second
|
||||||
|
)
|
||||||
|
|
||||||
|
func writeJSON(conn *websocket.Conn, v any) error {
|
||||||
|
if err := conn.SetWriteDeadline(time.Now().Add(writeWait)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return conn.WriteJSON(v)
|
||||||
|
}
|
||||||
|
|
||||||
type wsIncoming struct {
|
type wsIncoming struct {
|
||||||
Action string `json:"action,omitempty"`
|
Action string `json:"action,omitempty"`
|
||||||
ID uint `json:"id,omitempty"`
|
ID uint `json:"id,omitempty"`
|
||||||
@@ -81,6 +100,7 @@ func InitWebSocket(database *gorm.DB, domain string) {
|
|||||||
// isAdmin allows seeing, sending and deleting private messages.
|
// isAdmin allows seeing, sending and deleting private messages.
|
||||||
func HandleWebSocket(conn *websocket.Conn, isAdmin bool) {
|
func HandleWebSocket(conn *websocket.Conn, isAdmin bool) {
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
conn.SetReadLimit(maxFrameBytes)
|
||||||
|
|
||||||
// Register and snapshot under one lock, so a concurrent broadcast is
|
// Register and snapshot under one lock, so a concurrent broadcast is
|
||||||
// either in the history or delivered after it, never lost or reordered.
|
// either in the history or delivered after it, never lost or reordered.
|
||||||
@@ -94,9 +114,11 @@ func HandleWebSocket(conn *websocket.Conn, isAdmin bool) {
|
|||||||
if !isAdmin {
|
if !isAdmin {
|
||||||
historyQuery = historyQuery.Where("private = ?", false)
|
historyQuery = historyQuery.Where("private = ?", false)
|
||||||
}
|
}
|
||||||
historyQuery.Find(&history)
|
if err := historyQuery.Find(&history).Error; err != nil {
|
||||||
|
log.Printf("[ws] loading history: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := conn.WriteJSON(wsHistoryEvent{Action: "history", Messages: history}); err != nil {
|
if err := writeJSON(conn, wsHistoryEvent{Action: "history", Messages: history}); err != nil {
|
||||||
delete(clients, conn)
|
delete(clients, conn)
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
return
|
return
|
||||||
@@ -130,6 +152,10 @@ func HandleWebSocket(conn *websocket.Conn, isAdmin bool) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(incoming.Text) > maxContentBytes || len(incoming.FileURL) > maxFileURLBytes {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
msg := models.Message{
|
msg := models.Message{
|
||||||
Content: incoming.Text,
|
Content: incoming.Text,
|
||||||
FileURL: incoming.FileURL,
|
FileURL: incoming.FileURL,
|
||||||
@@ -138,17 +164,23 @@ func HandleWebSocket(conn *websocket.Conn, isAdmin bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mu.Lock()
|
mu.Lock()
|
||||||
wsDB.Create(&msg)
|
if err := wsDB.Create(&msg).Error; err != nil {
|
||||||
|
mu.Unlock()
|
||||||
|
log.Printf("[ws] saving message: %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
// Soft delete, so the table still grows; the chat does not.
|
// Soft delete, so the table still grows; the chat does not.
|
||||||
wsDB.Where("id NOT IN (?)",
|
if err := wsDB.Where("id NOT IN (?)",
|
||||||
wsDB.Model(&models.Message{}).Select("id").Order("created_at DESC").Limit(maxMessages),
|
wsDB.Model(&models.Message{}).Select("id").Order("created_at DESC").Limit(maxMessages),
|
||||||
).Delete(&models.Message{})
|
).Delete(&models.Message{}).Error; err != nil {
|
||||||
|
log.Printf("[ws] pruning messages: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
for client, clientAdmin := range clients {
|
for client, clientAdmin := range clients {
|
||||||
if msg.Private && !clientAdmin {
|
if msg.Private && !clientAdmin {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err := client.WriteJSON(msg); err != nil {
|
if err := writeJSON(client, msg); err != nil {
|
||||||
client.Close()
|
client.Close()
|
||||||
delete(clients, client)
|
delete(clients, client)
|
||||||
}
|
}
|
||||||
@@ -173,7 +205,7 @@ func deleteMessage(id uint) {
|
|||||||
|
|
||||||
event := wsDeleteEvent{Action: "delete", ID: id}
|
event := wsDeleteEvent{Action: "delete", ID: id}
|
||||||
for client := range clients {
|
for client := range clients {
|
||||||
if err := client.WriteJSON(event); err != nil {
|
if err := writeJSON(client, event); err != nil {
|
||||||
client.Close()
|
client.Close()
|
||||||
delete(clients, client)
|
delete(clients, client)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,10 @@
|
|||||||
handle @radar_offline {
|
handle @radar_offline {
|
||||||
respond "Partner Radar is offline." 503
|
respond "Partner Radar is offline." 503
|
||||||
}
|
}
|
||||||
|
@garage_offline vars garage_upstream yes
|
||||||
|
handle @garage_offline {
|
||||||
|
respond "The Garage admin UI (stpcore) is offline." 503
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,10 +22,10 @@ RUN set -e; \
|
|||||||
BACKEND_HOST=backend BACKEND_PORT=8080 BACKEND_ENDPOINT=/api \
|
BACKEND_HOST=backend BACKEND_PORT=8080 BACKEND_ENDPOINT=/api \
|
||||||
ICECAST_HOST=icecast2 ICECAST_PORT=8000 \
|
ICECAST_HOST=icecast2 ICECAST_PORT=8000 \
|
||||||
GITEA_HOST=gitea GITEA_PORT=3000 \
|
GITEA_HOST=gitea GITEA_PORT=3000 \
|
||||||
SILVERBULLET_HOST=silverbullet SILVERBULLET_PORT=3000 \
|
|
||||||
SILVERBULLET_PUBLIC_HOST=silverbullet-public SILVERBULLET_PUBLIC_PORT=3000 \
|
SILVERBULLET_PUBLIC_HOST=silverbullet-public SILVERBULLET_PUBLIC_PORT=3000 \
|
||||||
PYTHON_HOST=python PYTHON_PORT=8000 \
|
PYTHON_HOST=python PYTHON_PORT=8000 \
|
||||||
RECEIPT_WEB_UPSTREAM=127.0.0.1:9 RECEIPT_WEB_TOKEN=validate \
|
RECEIPT_WEB_UPSTREAM=127.0.0.1:9 RECEIPT_WEB_TOKEN=validate \
|
||||||
|
STPPRIV_LAN_IP=192.0.2.1 \
|
||||||
CLOUDFLARE_DNS_API_TOKEN=validate-placeholder-token-0000000000000 \
|
CLOUDFLARE_DNS_API_TOKEN=validate-placeholder-token-0000000000000 \
|
||||||
caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile; \
|
caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile; \
|
||||||
done; \
|
done; \
|
||||||
|
|||||||
+18
-8
@@ -105,25 +105,24 @@ must 404 - py-internal /py//internal/rowing/read --path-as-is -X POST
|
|||||||
|
|
||||||
echo "# admin gate, signed out: must redirect to the login, with the original URI"
|
echo "# admin gate, signed out: must redirect to the login, with the original URI"
|
||||||
for p in \
|
for p in \
|
||||||
/sb/ /sb/index.html /jobs/ /jobs/api/graphql /tracker/ /tracker/dashboard \
|
/tracker/ /tracker/dashboard \
|
||||||
/dozzle/ /garage/ /radio/admin/stats.xsl /uploads/private/x.png \
|
/dozzle/ /garage/ /radio/admin/stats.xsl /uploads/private/x.png; do
|
||||||
"/jobs/leads?x=1"; do
|
|
||||||
must 302 "$LOGIN$p" gate "$p"
|
must 302 "$LOGIN$p" gate "$p"
|
||||||
done
|
done
|
||||||
must 302 "${LOGIN}/uploads/x/../private/x.png" gate /uploads/x/../private/x.png --path-as-is
|
must 302 "${LOGIN}/uploads/x/../private/x.png" gate /uploads/x/../private/x.png --path-as-is
|
||||||
show gate "$BASE/SB/"
|
show gate "$BASE/TRACKER/"
|
||||||
must 302 "${LOGIN}/receipt/" permission /receipt/
|
must 302 "${LOGIN}/receipt/" permission /receipt/
|
||||||
|
|
||||||
if [ -n "${EDGE_COOKIE:-}" ]; then
|
if [ -n "${EDGE_COOKIE:-}" ]; then
|
||||||
echo "# admin gate, signed in: must be let through"
|
echo "# admin gate, signed in: must be let through"
|
||||||
for p in /sb/ /jobs/ /tracker/ /dozzle/ /garage/ /radio/admin/stats.xsl \
|
for p in /tracker/ /dozzle/ /garage/ /radio/admin/stats.xsl \
|
||||||
/receipt/; do
|
/receipt/; do
|
||||||
not_login gate "$p" -H "Cookie: $EDGE_COOKIE"
|
not_login gate "$p" -H "Cookie: $EDGE_COOKIE"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# carve-outs and public routes (status depends on the upstream)"
|
echo "# carve-outs and public routes (status depends on the upstream)"
|
||||||
for p in /jobs/api/capture /jobs/job-capture.user.js /tracker/api/v1/events \
|
for p in /tracker/api/v1/events \
|
||||||
/tracker/tracker.user.js /tracker/readyz /usaco/ /notes/ /radio/status.xsl \
|
/tracker/tracker.user.js /tracker/readyz /usaco/ /notes/ /radio/status.xsl \
|
||||||
/py/ /py/docs /api/ /api/me /; do
|
/py/ /py/docs /api/ /api/me /; do
|
||||||
show public "$BASE$p"
|
show public "$BASE$p"
|
||||||
@@ -138,9 +137,20 @@ must 301 "$GIT/adamf/stpweb/src/branch/main/README.md" gitea /gitea/adamf/stpweb
|
|||||||
must 301 "$GIT/adamf/stpweb.git/info/refs?service=git-upload-pack" gitea "/gitea/adamf/stpweb.git/info/refs?service=git-upload-pack"
|
must 301 "$GIT/adamf/stpweb.git/info/refs?service=git-upload-pack" gitea "/gitea/adamf/stpweb.git/info/refs?service=git-upload-pack"
|
||||||
must 301 "$GIT/adamf/stpweb/commit/0000000" gitea /gitea/adamf/stpweb/commit/0000000
|
must 301 "$GIT/adamf/stpweb/commit/0000000" gitea /gitea/adamf/stpweb/commit/0000000
|
||||||
|
|
||||||
|
echo "# the editor and job tracker are on stppriv: must 301 there, path kept"
|
||||||
|
PRIV="https://priv.${GIT_HOST#www.}"
|
||||||
|
for p in /sb/ /sb/index.html /SB/ /jobs/ /jobs/api/graphql "/jobs/leads?x=1" \
|
||||||
|
/jobs/api/capture /jobs/job-capture.user.js; do
|
||||||
|
must 301 "$PRIV$p" priv "$p"
|
||||||
|
done
|
||||||
|
must 301 "$PRIV/sb/" priv /sb
|
||||||
|
must 301 "$PRIV/jobs/" priv /jobs
|
||||||
|
must 301 "$PRIV/jobs/" priv /cv/jobs
|
||||||
|
must 301 "$PRIV/jobs/job-capture.user.js" priv /job-capture.user.js
|
||||||
|
|
||||||
echo "# bare prefixes and moved URLs"
|
echo "# bare prefixes and moved URLs"
|
||||||
for p in /api /radio /dozzle /garage /notes /sb /py /jobs /usaco \
|
for p in /api /radio /dozzle /garage /notes /py /usaco \
|
||||||
/tracker /receipt /cv/jobs /cv/leads /job-capture.user.js "/gitea?x=1"; do
|
/tracker /receipt /cv/leads "/gitea?x=1"; do
|
||||||
show redirect "$BASE$p"
|
show redirect "$BASE$p"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
+42
-40
@@ -44,17 +44,17 @@ redir /dozzle /dozzle/ 301
|
|||||||
redir /garage /garage/ 301
|
redir /garage /garage/ 301
|
||||||
redir /gitea https://git.{$DOMAIN}/ 301
|
redir /gitea https://git.{$DOMAIN}/ 301
|
||||||
redir /notes /notes/ 301
|
redir /notes /notes/ 301
|
||||||
redir /sb /sb/ 301
|
redir /sb https://priv.{$DOMAIN}/sb/ 301
|
||||||
redir /py /py/ 301
|
redir /py /py/ 301
|
||||||
redir /jobs /jobs/ 301
|
redir /jobs https://priv.{$DOMAIN}/jobs/ 301
|
||||||
redir /usaco /usaco/ 301
|
redir /usaco /usaco/ 301
|
||||||
redir /tracker /tracker/ 301
|
redir /tracker /tracker/ 301
|
||||||
redir /receipt /receipt/ 301
|
redir /receipt /receipt/ 301
|
||||||
|
|
||||||
# Old job tracker URLs; the userscript's old @updateURL finds its update here.
|
# Old job tracker URLs; the userscript's old @updateURL finds its update here.
|
||||||
redir /cv/jobs /jobs/ 301
|
redir /cv/jobs https://priv.{$DOMAIN}/jobs/ 301
|
||||||
redir /cv/leads /jobs/leads 301
|
redir /cv/leads https://priv.{$DOMAIN}/jobs/leads 301
|
||||||
redir /job-capture.user.js /jobs/job-capture.user.js 301
|
redir /job-capture.user.js https://priv.{$DOMAIN}/jobs/job-capture.user.js 301
|
||||||
|
|
||||||
# ---- Backend API ---------------------------------------------------------------
|
# ---- Backend API ---------------------------------------------------------------
|
||||||
|
|
||||||
@@ -66,6 +66,20 @@ handle {$BACKEND_ENDPOINT}/ws* {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# stppriv's admin_gate checks every one of its requests here from one LAN IP,
|
||||||
|
# so it would exhaust the per-IP api limit. Public traffic always arrives from
|
||||||
|
# cloudflared, so it can never match.
|
||||||
|
@stppriv_gate {
|
||||||
|
path {$BACKEND_ENDPOINT}/auth/validate-admin
|
||||||
|
remote_ip {$STPPRIV_LAN_IP}
|
||||||
|
}
|
||||||
|
handle @stppriv_gate {
|
||||||
|
uri strip_prefix {$BACKEND_ENDPOINT}
|
||||||
|
reverse_proxy {$BACKEND_HOST}:{$BACKEND_PORT} {
|
||||||
|
import proxy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# On top of the backend's own 5/min.
|
# On top of the backend's own 5/min.
|
||||||
handle {$BACKEND_ENDPOINT}/auth/login* {
|
handle {$BACKEND_ENDPOINT}/auth/login* {
|
||||||
import limit login 5 1m
|
import limit login 5 1m
|
||||||
@@ -110,14 +124,23 @@ handle /dozzle/* {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Holds Garage's admin token. 2 GB for video uploads.
|
# garage-webui on stpcore, behind its Caddy, which wants X-Core-Token (header_up
|
||||||
|
# replaces any client-sent one). Holds Garage's admin token. 2 GB for video
|
||||||
|
# uploads. A `route` so garage_upstream is set only after the gate passes.
|
||||||
handle /garage/* {
|
handle /garage/* {
|
||||||
import admin_gate
|
route {
|
||||||
request_body {
|
import admin_gate
|
||||||
max_size 2GB
|
request_body {
|
||||||
}
|
max_size 2GB
|
||||||
reverse_proxy garage-webui:3909 {
|
}
|
||||||
import proxy
|
vars garage_upstream yes
|
||||||
|
reverse_proxy garage:3909 {
|
||||||
|
import proxy
|
||||||
|
header_up X-Core-Token {env.GARAGE_WEBUI_TOKEN}
|
||||||
|
transport http {
|
||||||
|
dial_timeout 3s
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,13 +153,9 @@ handle /radio/admin/* {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# No prefix strip: with SB_URL_PREFIX the app builds its URLs from /sb, and a
|
# The notes editor is on stppriv, behind Cloudflare Access.
|
||||||
# stripped prefix loads a blank page.
|
|
||||||
handle /sb/* {
|
handle /sb/* {
|
||||||
import admin_gate
|
redir https://priv.{$DOMAIN}{uri} 301
|
||||||
reverse_proxy {$SILVERBULLET_HOST}:{$SILVERBULLET_PORT} {
|
|
||||||
import proxy
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ---- Public services -----------------------------------------------------------
|
# ---- Public services -----------------------------------------------------------
|
||||||
@@ -181,27 +200,10 @@ handle /py/* {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ---- Job tracker (/jobs/) ----
|
# ---- Job tracker (/jobs/) ----
|
||||||
# Not stripped: the app lives at /jobs/. The capture API (bearer token) and
|
# On stppriv. A 301 turns a POST into a GET, so capture clients must call
|
||||||
# the userscript (fetched without cookies, holds no secrets) bypass the gate.
|
# priv. directly.
|
||||||
handle /jobs/api/capture* {
|
|
||||||
import limit api 30 1s
|
|
||||||
reverse_proxy jobs:8080 {
|
|
||||||
import proxy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handle /jobs/job-capture.user.js {
|
|
||||||
reverse_proxy jobs:8080 {
|
|
||||||
import proxy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handle /jobs/* {
|
handle /jobs/* {
|
||||||
import admin_gate
|
redir https://priv.{$DOMAIN}{uri} 301
|
||||||
import limit api 30 1s
|
|
||||||
reverse_proxy jobs:8080 {
|
|
||||||
import proxy
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ---- USACO (/usaco/) ----
|
# ---- USACO (/usaco/) ----
|
||||||
@@ -276,8 +278,8 @@ handle /uploads/private/* {
|
|||||||
file_server
|
file_server
|
||||||
}
|
}
|
||||||
|
|
||||||
# Garage first, disk second: a 404, 5xx or dial error falls back to the
|
# Garage (on stpcore) first, disk second: a 404, 5xx or dial error falls back
|
||||||
# volume, so the bucket is the source of truth.
|
# to the volume, so the bucket is the source of truth.
|
||||||
handle /uploads/* {
|
handle /uploads/* {
|
||||||
import upload_headers
|
import upload_headers
|
||||||
vars uploads_fallback yes
|
vars uploads_fallback yes
|
||||||
|
|||||||
@@ -26,14 +26,6 @@ services:
|
|||||||
command: ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path /py --reload"]
|
command: ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PYTHON_PORT:-8000} --root-path /py --reload"]
|
||||||
volumes:
|
volumes:
|
||||||
- ./python/app:/app/app
|
- ./python/app:/app/app
|
||||||
# No hot reload in this image; use its own repo's `npm run dev` for that.
|
|
||||||
jobs:
|
|
||||||
environment:
|
|
||||||
- DEV_MODE=true
|
|
||||||
- SEED_DB=true
|
|
||||||
- GQL_PLAYGROUND=true
|
|
||||||
- GQL_INTROSPECTION=true
|
|
||||||
- MSGRAPH_REDIRECT_URI=https://localhost/jobs/api/email/callback
|
|
||||||
cloudflared:
|
cloudflared:
|
||||||
# Never start: a dev stack on the tunnel would get real visitors.
|
# Never start: a dev stack on the tunnel would get real visitors.
|
||||||
profiles:
|
profiles:
|
||||||
|
|||||||
+19
-109
@@ -17,18 +17,19 @@ networks:
|
|||||||
usaco-runner-net:
|
usaco-runner-net:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
internal: true
|
internal: true
|
||||||
|
# internal, and shared only with caddy: the admin gate is the only way in,
|
||||||
|
# since dozzle holds the Docker socket.
|
||||||
|
dozzle-net:
|
||||||
|
driver: bridge
|
||||||
|
internal: true
|
||||||
|
|
||||||
# Named volumes survive `down`; only `down -v` deletes them.
|
# Named volumes survive `down`; only `down -v` deletes them.
|
||||||
volumes:
|
volumes:
|
||||||
# Deleting this wipes posts, users and messages.
|
# Deleting this wipes posts, users and messages.
|
||||||
dbdata:
|
dbdata:
|
||||||
# Private attachments, plus any upload Garage refused. Caddy serves
|
# Private attachments, plus any upload Garage refused. Caddy serves
|
||||||
# /uploads/ from the bucket first, then from here.
|
# /uploads/ from the bucket (on stpcore) first, then from here.
|
||||||
uploads:
|
uploads:
|
||||||
# Back up meta and data together: the bytes are unreadable without meta.
|
|
||||||
# A fresh pair needs garage/bootstrap.sh.
|
|
||||||
garage_meta:
|
|
||||||
garage_data:
|
|
||||||
# Written by the one-shot `vue` build container, served by Caddy.
|
# Written by the one-shot `vue` build container, served by Caddy.
|
||||||
vue_dist:
|
vue_dist:
|
||||||
# Named only so the image's VOLUME doesn't leave anonymous volumes behind.
|
# Named only so the image's VOLUME doesn't leave anonymous volumes behind.
|
||||||
@@ -65,21 +66,23 @@ services:
|
|||||||
- ICECAST_PORT=${ICECAST_PORT}
|
- ICECAST_PORT=${ICECAST_PORT}
|
||||||
- GITEA_HOST=${GITEA_HOST}
|
- GITEA_HOST=${GITEA_HOST}
|
||||||
- GITEA_PORT=${GITEA_PORT}
|
- GITEA_PORT=${GITEA_PORT}
|
||||||
- SILVERBULLET_HOST=${SILVERBULLET_HOST:-silverbullet}
|
|
||||||
- SILVERBULLET_PORT=${SILVERBULLET_PORT:-3000}
|
|
||||||
- SILVERBULLET_PUBLIC_HOST=${SILVERBULLET_PUBLIC_HOST:-silverbullet-public}
|
- SILVERBULLET_PUBLIC_HOST=${SILVERBULLET_PUBLIC_HOST:-silverbullet-public}
|
||||||
- SILVERBULLET_PUBLIC_PORT=${SILVERBULLET_PUBLIC_PORT:-3000}
|
- SILVERBULLET_PUBLIC_PORT=${SILVERBULLET_PUBLIC_PORT:-3000}
|
||||||
- PYTHON_HOST=${PYTHON_HOST:-python}
|
- PYTHON_HOST=${PYTHON_HOST:-python}
|
||||||
- PYTHON_PORT=${PYTHON_PORT:-8000}
|
- PYTHON_PORT=${PYTHON_PORT:-8000}
|
||||||
# A dead port by default, so /receipt/ reads "offline".
|
# A dead port by default, so /receipt/ reads "offline".
|
||||||
- RECEIPT_WEB_UPSTREAM=${RECEIPT_WEB_UPSTREAM:-127.0.0.1:9}
|
- RECEIPT_WEB_UPSTREAM=${RECEIPT_WEB_UPSTREAM:-127.0.0.1:9}
|
||||||
|
- STPPRIV_LAN_IP=${STPPRIV_LAN_IP:-192.0.2.1}
|
||||||
- RECEIPT_WEB_TOKEN=${RECEIPT_WEB_TOKEN:-}
|
- RECEIPT_WEB_TOKEN=${RECEIPT_WEB_TOKEN:-}
|
||||||
|
- GARAGE_WEBUI_TOKEN=${GARAGE_WEBUI_TOKEN:-}
|
||||||
# The adamf/cto stack's web container; "offline" while that stack is down.
|
# The adamf/cto stack's web container; "offline" while that stack is down.
|
||||||
- RADAR_UPSTREAM=${RADAR_UPSTREAM:-radar-web:80}
|
- RADAR_UPSTREAM=${RADAR_UPSTREAM:-radar-web:80}
|
||||||
- CLOUDFLARE_DNS_API_TOKEN=${CLOUDFLARE_DNS_API_TOKEN:-}
|
- CLOUDFLARE_DNS_API_TOKEN=${CLOUDFLARE_DNS_API_TOKEN:-}
|
||||||
# Keeps the Gitea hop on the LAN; public DNS points at Cloudflare.
|
# Keeps the Gitea hop on the LAN; public DNS points at Cloudflare.
|
||||||
|
# `garage` is on stpcore; the 127.0.0.1 default fails fast to disk.
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||||
|
- "garage:${GARAGE_UPSTREAM:-127.0.0.1}"
|
||||||
networks:
|
networks:
|
||||||
app-network:
|
app-network:
|
||||||
# So cloudflared's origin (https://www.DOMAIN) lands here under a name
|
# So cloudflared's origin (https://www.DOMAIN) lands here under a name
|
||||||
@@ -90,6 +93,7 @@ services:
|
|||||||
- radar.${DOMAIN}
|
- radar.${DOMAIN}
|
||||||
# Matches cloudflared's extra_hosts.
|
# Matches cloudflared's extra_hosts.
|
||||||
ipv4_address: 172.28.255.251
|
ipv4_address: 172.28.255.251
|
||||||
|
dozzle-net:
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 443:443
|
- 443:443
|
||||||
@@ -142,6 +146,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||||
|
- "garage:${GARAGE_UPSTREAM:-127.0.0.1}"
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
env_file:
|
env_file:
|
||||||
@@ -149,7 +154,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
# Spotify refresh token; without this every deploy forces a re-auth.
|
# Spotify refresh token; without this every deploy forces a re-auth.
|
||||||
- ./backend/token/:/backend/token
|
- ./backend/token/:/backend/token
|
||||||
- ${OBSIDIAN_DIR}:/backend/notes
|
# Read-only: stppriv is the vault's only writer.
|
||||||
|
- ${OBSIDIAN_DIR}:/backend/notes:ro
|
||||||
- ./logs:/backend/logs
|
- ./logs:/backend/logs
|
||||||
- uploads:/backend/uploads
|
- uploads:/backend/uploads
|
||||||
- ./icecast2/fallback_music:/backend/fallback_music
|
- ./icecast2/fallback_music:/backend/fallback_music
|
||||||
@@ -198,25 +204,6 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:${LIQUIDSOAP_HARBOR_PORT:-8001}"
|
- "${LIQUIDSOAP_HARBOR_PORT:-8001}:${LIQUIDSOAP_HARBOR_PORT:-8001}"
|
||||||
|
|
||||||
# Vault editor at /sb/ (admin-gated).
|
|
||||||
silverbullet:
|
|
||||||
image: ghcr.io/silverbulletmd/silverbullet:2.11.0
|
|
||||||
container_name: "${SILVERBULLET_HOST:-silverbullet}"
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
environment:
|
|
||||||
SB_PORT: "${SILVERBULLET_PORT:-3000}"
|
|
||||||
# Caddy must not strip /sb/: the app builds its URLs from this.
|
|
||||||
SB_URL_PREFIX: /sb
|
|
||||||
# Newline separated; commas are silently ignored.
|
|
||||||
SB_SPACE_IGNORE: |
|
|
||||||
.obsidian
|
|
||||||
PUID: "1000"
|
|
||||||
PGID: "1000"
|
|
||||||
volumes:
|
|
||||||
- ${OBSIDIAN_DIR}:/data
|
|
||||||
|
|
||||||
# Public read-only notes at /notes/. private/ stays private only with all
|
# Public read-only notes at /notes/. private/ stays private only with all
|
||||||
# three: SB_SPACE_IGNORE (hides from listings, not direct fetches), Caddy's
|
# three: SB_SPACE_IGNORE (hides from listings, not direct fetches), Caddy's
|
||||||
# /notes/ deny regex (keep its folder list in step), and SB_REVISIONS
|
# /notes/ deny regex (keep its folder list in step), and SB_REVISIONS
|
||||||
@@ -242,8 +229,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ${OBSIDIAN_DIR}:/data:ro
|
- ${OBSIDIAN_DIR}:/data:ro
|
||||||
|
|
||||||
# Commits/pulls the vault. Separate from SilverBullet so its shell backend
|
# Pulls the vault (SYNC_MODE=pull: never commits or pushes). The editor and
|
||||||
# stays off (it would give command execution to anyone past the admin gate).
|
# the only writer is on stppriv; two writers would conflict.
|
||||||
silverbullet-git:
|
silverbullet-git:
|
||||||
image: alpine/git:v2.54.0
|
image: alpine/git:v2.54.0
|
||||||
container_name: "${SILVERBULLET_GIT_HOST:-silverbullet-git}"
|
container_name: "${SILVERBULLET_GIT_HOST:-silverbullet-git}"
|
||||||
@@ -256,6 +243,7 @@ services:
|
|||||||
# Match SilverBullet's uid so .git objects stay host-owned.
|
# Match SilverBullet's uid so .git objects stay host-owned.
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
environment:
|
environment:
|
||||||
|
SYNC_MODE: pull
|
||||||
SYNC_INTERVAL: "${SILVERBULLET_GIT_INTERVAL:-300}"
|
SYNC_INTERVAL: "${SILVERBULLET_GIT_INTERVAL:-300}"
|
||||||
GIT_AUTHOR_NAME: silverbullet
|
GIT_AUTHOR_NAME: silverbullet
|
||||||
GIT_AUTHOR_EMAIL: "silverbullet@${DOMAIN}"
|
GIT_AUTHOR_EMAIL: "silverbullet@${DOMAIN}"
|
||||||
@@ -292,41 +280,6 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
# Job tracker (adamf/job-tracker). No login of its own: it asks
|
|
||||||
# validate-admin with the visitor's cookies. ./jobs-data must be uid 1000.
|
|
||||||
jobs:
|
|
||||||
image: adam-french.co.uk/adamf/job-tracker:${JOBS_IMAGE_TAG:-latest}
|
|
||||||
container_name: jobs
|
|
||||||
restart: always
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
environment:
|
|
||||||
- DATABASE_URL=postgres://${POSTGRES_JOBS_USER:-jobs}:${POSTGRES_JOBS_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_JOBS_DB:-jobs}?sslmode=disable
|
|
||||||
- AUTH_VALIDATE_URL=http://${BACKEND_HOST}:${BACKEND_PORT}/auth/validate-admin
|
|
||||||
- CLAUDE_API_KEY=${CLAUDE_API_KEY:-}
|
|
||||||
- CLAUDE_MODEL=${CLAUDE_MODEL:-}
|
|
||||||
- EMAIL_BACKEND=${EMAIL_BACKEND:-}
|
|
||||||
- EMAIL_SYNC_ENABLED=${EMAIL_SYNC_ENABLED:-}
|
|
||||||
- EMAIL_SYNC_INTERVAL=${EMAIL_SYNC_INTERVAL:-}
|
|
||||||
- MSGRAPH_CLIENT_ID=${MSGRAPH_CLIENT_ID:-}
|
|
||||||
- MSGRAPH_CLIENT_SECRET=${MSGRAPH_CLIENT_SECRET:-}
|
|
||||||
- MSGRAPH_TENANT_ID=${MSGRAPH_TENANT_ID:-}
|
|
||||||
- MSGRAPH_REDIRECT_URI=${MSGRAPH_REDIRECT_URI:-}
|
|
||||||
- IMAP_HOST=${IMAP_HOST:-}
|
|
||||||
- IMAP_PORT=${IMAP_PORT:-}
|
|
||||||
- IMAP_EMAIL=${IMAP_EMAIL:-}
|
|
||||||
- IMAP_PASSWORD=${IMAP_PASSWORD:-}
|
|
||||||
- JOB_LEADS_ENABLED=${JOB_LEADS_ENABLED:-}
|
|
||||||
- JOB_LEADS_INTERVAL=${JOB_LEADS_INTERVAL:-}
|
|
||||||
- ADZUNA_APP_ID=${ADZUNA_APP_ID:-}
|
|
||||||
- ADZUNA_APP_KEY=${ADZUNA_APP_KEY:-}
|
|
||||||
- REED_API_KEY=${REED_API_KEY:-}
|
|
||||||
volumes:
|
|
||||||
- ./jobs-data:/data
|
|
||||||
|
|
||||||
# USACO log (adamf/usaco). Git is its store, cloned into ./usaco-data
|
# USACO log (adamf/usaco). Git is its store, cloned into ./usaco-data
|
||||||
# (must be uid 1000). The S3_* vars are all-or-nothing, hence the :+ forms.
|
# (must be uid 1000). The S3_* vars are all-or-nothing, hence the :+ forms.
|
||||||
# stop_grace_period must exceed the app's SHUTDOWN_GRACE (5m).
|
# stop_grace_period must exceed the app's SHUTDOWN_GRACE (5m).
|
||||||
@@ -339,6 +292,7 @@ services:
|
|||||||
- usaco-runner
|
- usaco-runner
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||||
|
- "garage:${GARAGE_UPSTREAM:-127.0.0.1}"
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- app-network
|
||||||
- usaco-runner-net
|
- usaco-runner-net
|
||||||
@@ -412,7 +366,7 @@ services:
|
|||||||
container_name: dozzle
|
container_name: dozzle
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- app-network
|
- dozzle-net
|
||||||
environment:
|
environment:
|
||||||
- DOZZLE_BASE=/dozzle
|
- DOZZLE_BASE=/dozzle
|
||||||
- DOZZLE_NO_ANALYTICS=true
|
- DOZZLE_NO_ANALYTICS=true
|
||||||
@@ -431,47 +385,3 @@ services:
|
|||||||
- AUTOHEAL_CONTAINER_LABEL=autoheal
|
- AUTOHEAL_CONTAINER_LABEL=autoheal
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
|
||||||
# Public uploads bucket. Nothing depends on it: Caddy and the backend fall
|
|
||||||
# back to the `uploads` volume. First run: garage/bootstrap.sh.
|
|
||||||
garage:
|
|
||||||
image: dxflrs/garage:v2.5.0
|
|
||||||
container_name: garage
|
|
||||||
restart: always
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
environment:
|
|
||||||
- GARAGE_RPC_SECRET=${GARAGE_RPC_SECRET}
|
|
||||||
- GARAGE_ADMIN_TOKEN=${GARAGE_ADMIN_TOKEN}
|
|
||||||
volumes:
|
|
||||||
- ./garage/garage.toml:/etc/garage.toml:ro
|
|
||||||
- garage_meta:/var/lib/garage/meta
|
|
||||||
- garage_data:/var/lib/garage/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "/garage", "status"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 3
|
|
||||||
start_period: 10s
|
|
||||||
|
|
||||||
# Admin-gated at /garage/; holds the admin token, so never publish it.
|
|
||||||
# Files uploaded here are public at /uploads/ with no backend checks.
|
|
||||||
garage-webui:
|
|
||||||
image: khairul169/garage-webui:1.1.0
|
|
||||||
container_name: garage-webui
|
|
||||||
restart: always
|
|
||||||
depends_on:
|
|
||||||
- garage
|
|
||||||
networks:
|
|
||||||
- app-network
|
|
||||||
environment:
|
|
||||||
- BASE_PATH=/garage
|
|
||||||
- API_BASE_URL=http://garage:3903
|
|
||||||
- API_ADMIN_KEY=${GARAGE_ADMIN_TOKEN}
|
|
||||||
- S3_ENDPOINT_URL=http://garage:3900
|
|
||||||
- S3_REGION=garage
|
|
||||||
# No /tmp in the image; large multipart uploads spool there.
|
|
||||||
tmpfs:
|
|
||||||
- /tmp
|
|
||||||
volumes:
|
|
||||||
- ./garage/garage.toml:/etc/garage.toml:ro
|
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# One-time, idempotent setup of a fresh garage_meta volume, run on the host
|
|
||||||
# (the image has no shell): node layout, bucket, the backend's key imported
|
|
||||||
# from .env (so a wiped volume keeps the same credentials), and website access.
|
|
||||||
# Optional: S3_BUCKET, GARAGE_CAPACITY, COMPOSE (to add the dev override).
|
|
||||||
set -eu
|
|
||||||
|
|
||||||
COMPOSE=${COMPOSE:-docker compose}
|
|
||||||
|
|
||||||
# .env isn't guaranteed to be valid shell, so it isn't sourced.
|
|
||||||
envval() {
|
|
||||||
eval "current=\${$1:-}"
|
|
||||||
if [ -n "$current" ]; then
|
|
||||||
printf '%s' "$current"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
[ -f .env ] || return 0
|
|
||||||
grep -E "^$1=" .env | tail -n 1 | cut -d= -f2- | sed -e 's/^"\(.*\)"$/\1/' -e "s/^'\(.*\)'$/\1/"
|
|
||||||
}
|
|
||||||
|
|
||||||
garage() {
|
|
||||||
$COMPOSE exec -T garage /garage "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
KEY_ID=$(envval S3_ACCESS_KEY_ID)
|
|
||||||
SECRET=$(envval S3_SECRET_ACCESS_KEY)
|
|
||||||
BUCKET=$(envval S3_BUCKET)
|
|
||||||
BUCKET=${BUCKET:-uploads}
|
|
||||||
CAPACITY=$(envval GARAGE_CAPACITY)
|
|
||||||
CAPACITY=${CAPACITY:-20G}
|
|
||||||
KEY_NAME=site-backend
|
|
||||||
|
|
||||||
# Garage rejects other shapes at import time with a less helpful message.
|
|
||||||
if ! printf '%s' "$KEY_ID" | grep -Eq '^GK[0-9a-f]{24}$'; then
|
|
||||||
echo "S3_ACCESS_KEY_ID must be GK followed by 24 hex chars (try: echo GK\$(openssl rand -hex 12))" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if ! printf '%s' "$SECRET" | grep -Eq '^[0-9a-f]{64}$'; then
|
|
||||||
echo "S3_SECRET_ACCESS_KEY must be 64 hex chars (try: openssl rand -hex 32)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 1. Layout. `node id -q` prints "<full id>@<addr>"; the id is what
|
|
||||||
# `layout assign` takes.
|
|
||||||
if garage layout show 2>/dev/null | grep -q "No nodes currently have a role"; then
|
|
||||||
NODE_ID=$(garage node id -q 2>/dev/null | cut -d@ -f1)
|
|
||||||
echo "Assigning node $(printf '%s' "$NODE_ID" | cut -c1-16) (capacity $CAPACITY)"
|
|
||||||
garage layout assign -z dc1 -c "$CAPACITY" "$NODE_ID"
|
|
||||||
garage layout apply --version 1
|
|
||||||
else
|
|
||||||
echo "Layout already applied"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 2. Bucket.
|
|
||||||
if garage bucket info "$BUCKET" >/dev/null 2>&1; then
|
|
||||||
echo "Bucket $BUCKET exists"
|
|
||||||
else
|
|
||||||
garage bucket create "$BUCKET"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 3. Key.
|
|
||||||
if garage key info "$KEY_ID" >/dev/null 2>&1; then
|
|
||||||
echo "Key $KEY_ID exists"
|
|
||||||
else
|
|
||||||
garage key import -n "$KEY_NAME" --yes "$KEY_ID" "$SECRET"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 4 and 5 are idempotent in Garage itself.
|
|
||||||
garage bucket allow --read --write "$BUCKET" --key "$KEY_ID"
|
|
||||||
garage bucket website --allow "$BUCKET"
|
|
||||||
|
|
||||||
echo "Garage ready: bucket $BUCKET, key $KEY_ID"
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
# Single node, replication_factor 1: back the volumes up like any other.
|
|
||||||
# No secrets here; they come from GARAGE_RPC_SECRET / GARAGE_ADMIN_TOKEN.
|
|
||||||
# 0.0.0.0 because bridge networks may lack IPv6. Ports: 3900 S3, 3901 RPC,
|
|
||||||
# 3902 website (bucket chosen by Host "<bucket><root_domain>"), 3903 admin.
|
|
||||||
metadata_dir = "/var/lib/garage/meta"
|
|
||||||
data_dir = "/var/lib/garage/data"
|
|
||||||
db_engine = "lmdb"
|
|
||||||
# LMDB can be left unreadable by a crash mid-write; a periodic snapshot of
|
|
||||||
# the metadata is what `garage meta` restores from.
|
|
||||||
metadata_auto_snapshot_interval = "6h"
|
|
||||||
|
|
||||||
replication_factor = 1
|
|
||||||
|
|
||||||
rpc_bind_addr = "0.0.0.0:3901"
|
|
||||||
rpc_public_addr = "127.0.0.1:3901"
|
|
||||||
|
|
||||||
[s3_api]
|
|
||||||
api_bind_addr = "0.0.0.0:3900"
|
|
||||||
# Any string works; it only has to match what clients sign with (S3_REGION).
|
|
||||||
s3_region = "garage"
|
|
||||||
root_domain = ".s3.garage"
|
|
||||||
|
|
||||||
[s3_web]
|
|
||||||
bind_addr = "0.0.0.0:3902"
|
|
||||||
root_domain = ".web.garage"
|
|
||||||
index = "index.html"
|
|
||||||
|
|
||||||
[admin]
|
|
||||||
api_bind_addr = "0.0.0.0:3903"
|
|
||||||
+16
-4
@@ -82,7 +82,10 @@ def _model_options(model: str, max_tokens: int) -> dict:
|
|||||||
"""
|
"""
|
||||||
if model.startswith(_NO_EFFORT_PREFIXES):
|
if model.startswith(_NO_EFFORT_PREFIXES):
|
||||||
return {"max_tokens": max_tokens}
|
return {"max_tokens": max_tokens}
|
||||||
return {"max_tokens": max_tokens + THINKING_HEADROOM, "output_config": {"effort": EFFORT}}
|
return {
|
||||||
|
"max_tokens": max_tokens + THINKING_HEADROOM,
|
||||||
|
"output_config": {"effort": EFFORT},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def ask_json(
|
def ask_json(
|
||||||
@@ -122,7 +125,11 @@ def ask_json(
|
|||||||
NotConfigured: no API key.
|
NotConfigured: no API key.
|
||||||
ReadError: with one of the three messages above.
|
ReadError: with one of the three messages above.
|
||||||
"""
|
"""
|
||||||
request = {"model": MODEL, "messages": messages, **_model_options(MODEL, max_tokens)}
|
request = {
|
||||||
|
"model": MODEL,
|
||||||
|
"messages": messages,
|
||||||
|
**_model_options(MODEL, max_tokens),
|
||||||
|
}
|
||||||
if system is not None:
|
if system is not None:
|
||||||
request["system"] = system
|
request["system"] = system
|
||||||
|
|
||||||
@@ -139,14 +146,19 @@ def ask_json(
|
|||||||
|
|
||||||
# A refusal is a 200; log it as such rather than as an unparseable reply.
|
# A refusal is a 200; log it as such rather than as an unparseable reply.
|
||||||
if getattr(message, "stop_reason", None) == "refusal":
|
if getattr(message, "stop_reason", None) == "refusal":
|
||||||
log.warning("Claude declined the request: %s", getattr(message, "stop_details", None))
|
log.warning(
|
||||||
|
"Claude declined the request: %s", getattr(message, "stop_details", None)
|
||||||
|
)
|
||||||
raise ReadError(failed)
|
raise ReadError(failed)
|
||||||
|
|
||||||
# By type: on a thinking model the first block may be a thinking block.
|
# By type: on a thinking model the first block may be a thinking block.
|
||||||
text = next((block.text for block in message.content if block.type == "text"), None)
|
text = next((block.text for block in message.content if block.type == "text"), None)
|
||||||
if text is None:
|
if text is None:
|
||||||
if getattr(message, "stop_reason", None) == "max_tokens":
|
if getattr(message, "stop_reason", None) == "max_tokens":
|
||||||
log.warning("Claude ran out of tokens before answering (max_tokens=%s)", request["max_tokens"])
|
log.warning(
|
||||||
|
"Claude ran out of tokens before answering (max_tokens=%s)",
|
||||||
|
request["max_tokens"],
|
||||||
|
)
|
||||||
raise ReadError(empty)
|
raise ReadError(empty)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Commits and syncs the vault. The "Sync notes" button (the vault's Sync.md)
|
# Syncs the vault with the notes repo.
|
||||||
# touches TRIGGER_FILE for an immediate sync; only its mtime matters, and it
|
# SYNC_MODE=push (default): commit local edits, pull --rebase, push. Use on
|
||||||
# must never be deleted here or SilverBullet re-uploads it in a loop.
|
# the ONE host that edits the vault (stppriv).
|
||||||
|
# SYNC_MODE=pull: fast-forward only, never commits or pushes. Use on every
|
||||||
|
# read-only consumer (stpweb's /notes/ and backend).
|
||||||
|
# The "Sync notes" button (the vault's Sync.md) touches TRIGGER_FILE for an
|
||||||
|
# immediate sync; only its mtime matters, and it must never be deleted here or
|
||||||
|
# SilverBullet re-uploads it in a loop.
|
||||||
|
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
SPACE=/space
|
SPACE=/space
|
||||||
|
MODE="${SYNC_MODE:-push}"
|
||||||
INTERVAL="${SYNC_INTERVAL:-300}"
|
INTERVAL="${SYNC_INTERVAL:-300}"
|
||||||
TRIGGER_FILE="$SPACE/${SYNC_TRIGGER_FILE:-sync-request.md}"
|
TRIGGER_FILE="$SPACE/${SYNC_TRIGGER_FILE:-sync-request.md}"
|
||||||
POLL=2
|
POLL=2
|
||||||
|
|
||||||
log() { echo "[git-sync] $(date -Iseconds) $*"; }
|
log() { echo "[git-sync] $(date -Iseconds) $*"; }
|
||||||
|
|
||||||
|
case "$MODE" in
|
||||||
|
push|pull) ;;
|
||||||
|
*) log "ERROR: SYNC_MODE must be push or pull, got '$MODE'"; while true; do sleep 3600; done ;;
|
||||||
|
esac
|
||||||
|
|
||||||
git config --global --add safe.directory "$SPACE"
|
git config --global --add safe.directory "$SPACE"
|
||||||
|
|
||||||
if [ ! -d "$SPACE/.git" ]; then
|
if [ ! -d "$SPACE/.git" ]; then
|
||||||
@@ -27,7 +38,7 @@ trigger_mtime() {
|
|||||||
[ -f "$TRIGGER_FILE" ] && stat -c %Y "$TRIGGER_FILE" 2>/dev/null || echo ""
|
[ -f "$TRIGGER_FILE" ] && stat -c %Y "$TRIGGER_FILE" 2>/dev/null || echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_once() {
|
sync_push() {
|
||||||
git add -A
|
git add -A
|
||||||
if ! git diff --cached --quiet; then
|
if ! git diff --cached --quiet; then
|
||||||
if git commit -q -m "notes: $(date -Iseconds)"; then
|
if git commit -q -m "notes: $(date -Iseconds)"; then
|
||||||
@@ -43,11 +54,15 @@ sync_once() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sync_pull() {
|
||||||
|
git pull --ff-only -q || log "WARN: pull failed (diverged, auth or network)"
|
||||||
|
}
|
||||||
|
|
||||||
last_trigger=$(trigger_mtime)
|
last_trigger=$(trigger_mtime)
|
||||||
log "watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
|
log "mode=$MODE, watching $SPACE every ${INTERVAL}s (on-demand via ${TRIGGER_FILE#$SPACE/})"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
sync_once
|
if [ "$MODE" = push ]; then sync_push; else sync_pull; fi
|
||||||
|
|
||||||
# Sleep in short slices so an on-demand request is picked up quickly.
|
# Sleep in short slices so an on-demand request is picked up quickly.
|
||||||
waited=0
|
waited=0
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ onUnmounted(() => {
|
|||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
v-model="messageInput"
|
v-model="messageInput"
|
||||||
|
maxlength="1000"
|
||||||
@keyup.enter="sendMessage"
|
@keyup.enter="sendMessage"
|
||||||
:aria-label="isPrivate ? 'Private chat message' : 'Chat message'"
|
:aria-label="isPrivate ? 'Private chat message' : 'Chat message'"
|
||||||
:placeholder="isPrivate ? 'Admins only' : ''"
|
:placeholder="isPrivate ? 'Admins only' : ''"
|
||||||
|
|||||||
@@ -20,9 +20,24 @@ const password = ref("");
|
|||||||
const submitting = ref(false);
|
const submitting = ref(false);
|
||||||
const errorMsg = ref("");
|
const errorMsg = ref("");
|
||||||
|
|
||||||
|
// stppriv's gate sends people here with an absolute priv.<domain> URL.
|
||||||
|
function isPrivUrl(dest) {
|
||||||
|
try {
|
||||||
|
const url = new URL(dest);
|
||||||
|
return url.protocol === "https:" && url.host === `priv.${window.location.hostname.replace(/^www\./, "")}`;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Caddy-gated paths aren't Vue routes, so landing on "404" means a full page
|
// Caddy-gated paths aren't Vue routes, so landing on "404" means a full page
|
||||||
// load. Only site-relative paths are followed, or it's an open redirect.
|
// load. Only site-relative paths (and stppriv) are followed, or it's an open
|
||||||
|
// redirect.
|
||||||
function goTo(dest) {
|
function goTo(dest) {
|
||||||
|
if (isPrivUrl(dest)) {
|
||||||
|
window.location.assign(dest);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (typeof dest !== "string" || !dest.startsWith("/") || dest.startsWith("//")) {
|
if (typeof dest !== "string" || !dest.startsWith("/") || dest.startsWith("//")) {
|
||||||
router.push(home());
|
router.push(home());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -158,15 +158,15 @@
|
|||||||
<path class="dg-edge dg-edge--pink" d="M712,819 H796" />
|
<path class="dg-edge dg-edge--pink" d="M712,819 H796" />
|
||||||
<rect class="dg-band" x="16" y="844" width="1068" height="30" opacity="0.18" />
|
<rect class="dg-band" x="16" y="844" width="1068" height="30" opacity="0.18" />
|
||||||
<rect class="dg-box" x="800" y="847" width="280" height="24" rx="3" />
|
<rect class="dg-box" x="800" y="847" width="280" height="24" rx="3" />
|
||||||
<text class="dg-code" x="812" y="863" style="fill: var(--color-primary)">garage-webui:3909</text>
|
<text class="dg-code" x="812" y="863" style="fill: var(--color-primary)">garage:3909</text>
|
||||||
<text class="dg-small" x="1070" y="863" text-anchor="end">bucket admin</text>
|
<text class="dg-small" x="1070" y="863" text-anchor="end">stpcore · bucket admin</text>
|
||||||
<circle class="dg-dot dg-dot--pink" cx="24" cy="859" r="4" />
|
<circle class="dg-dot dg-dot--pink" cx="24" cy="859" r="4" />
|
||||||
<text class="dg-code" x="36" y="863" style="fill: var(--color-secondary)">/garage/</text>
|
<text class="dg-code" x="36" y="863" style="fill: var(--color-secondary)">/garage/</text>
|
||||||
<text class="dg-small" x="390" y="863">prefix kept · body up to 2G · unbuffered</text>
|
<text class="dg-small" x="390" y="863">prefix kept · body up to 2G · unbuffered</text>
|
||||||
<path class="dg-edge dg-edge--pink" d="M712,859 H796" />
|
<path class="dg-edge dg-edge--pink" d="M712,859 H796" />
|
||||||
<rect class="dg-box" x="800" y="887" width="280" height="24" rx="3" />
|
<rect class="dg-box" x="800" y="887" width="280" height="24" rx="3" />
|
||||||
<text class="dg-code" x="812" y="903" style="fill: var(--color-primary)">garage:3902</text>
|
<text class="dg-code" x="812" y="903" style="fill: var(--color-primary)">garage:3902</text>
|
||||||
<text class="dg-small" x="1070" y="903" text-anchor="end">S3 website endpoint</text>
|
<text class="dg-small" x="1070" y="903" text-anchor="end">stpcore · S3 website</text>
|
||||||
<circle class="dg-dot" cx="24" cy="899" r="4" />
|
<circle class="dg-dot" cx="24" cy="899" r="4" />
|
||||||
<text class="dg-code" x="36" y="903" style="fill: var(--color-secondary)">/uploads/</text>
|
<text class="dg-code" x="36" y="903" style="fill: var(--color-secondary)">/uploads/</text>
|
||||||
<text class="dg-small" x="390" y="903">strip · Host uploads.web.garage · 2s connect</text>
|
<text class="dg-small" x="390" y="903">strip · Host uploads.web.garage · 2s connect</text>
|
||||||
|
|||||||
@@ -162,7 +162,7 @@
|
|||||||
<g>
|
<g>
|
||||||
<rect class="dg-box" x="480" y="676" width="180" height="46" rx="4" />
|
<rect class="dg-box" x="480" y="676" width="180" height="46" rx="4" />
|
||||||
<text class="dg-title" x="570" y="696" text-anchor="middle">GARAGE-WEBUI</text>
|
<text class="dg-title" x="570" y="696" text-anchor="middle">GARAGE-WEBUI</text>
|
||||||
<text class="dg-code" x="570" y="713" text-anchor="middle">:3909</text>
|
<text class="dg-small" x="570" y="713" text-anchor="middle" style="fill: var(--color-tertiary)">:3909 · on the stpcore LXC</text>
|
||||||
<path class="dg-edge" d="M400,699 H476" />
|
<path class="dg-edge" d="M400,699 H476" />
|
||||||
<text class="dg-edge-label dg-edge-label--mint" x="440" y="692" text-anchor="middle">/garage/</text>
|
<text class="dg-edge-label dg-edge-label--mint" x="440" y="692" text-anchor="middle">/garage/</text>
|
||||||
</g>
|
</g>
|
||||||
@@ -211,7 +211,7 @@
|
|||||||
|
|
||||||
<rect class="dg-box dg-box--tint" x="740" y="676" width="200" height="154" rx="4" style="stroke: var(--color-secondary)" />
|
<rect class="dg-box dg-box--tint" x="740" y="676" width="200" height="154" rx="4" style="stroke: var(--color-secondary)" />
|
||||||
<text class="dg-title" x="840" y="700" text-anchor="middle" style="fill: var(--color-secondary)">GARAGE</text>
|
<text class="dg-title" x="840" y="700" text-anchor="middle" style="fill: var(--color-secondary)">GARAGE</text>
|
||||||
<text class="dg-small" x="840" y="716" text-anchor="middle">S3 object store</text>
|
<text class="dg-small" x="840" y="716" text-anchor="middle" style="fill: var(--color-tertiary)">S3 · on the stpcore LXC</text>
|
||||||
<text class="dg-code" x="756" y="740">:3900 S3 API</text>
|
<text class="dg-code" x="756" y="740">:3900 S3 API</text>
|
||||||
<text class="dg-code" x="756" y="760">:3903 admin API</text>
|
<text class="dg-code" x="756" y="760">:3903 admin API</text>
|
||||||
<text class="dg-code" x="756" y="816">:3902 website</text>
|
<text class="dg-code" x="756" y="816">:3902 website</text>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const social_links = [
|
|||||||
{ name: "Github", link: "https://github.com/SteveThePug" },
|
{ name: "Github", link: "https://github.com/SteveThePug" },
|
||||||
{ name: "Spotify", link: "https://open.spotify.com/user/stevethepug" },
|
{ name: "Spotify", link: "https://open.spotify.com/user/stevethepug" },
|
||||||
{ name: "Notes", link: "/notes/" },
|
{ name: "Notes", link: "/notes/" },
|
||||||
{ name: "Notes (edit)", link: "/sb/" },
|
{ name: "Notes (edit)", link: "https://priv.adam-french.co.uk/sb/" },
|
||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ function nudge(mode, event) {
|
|||||||
if (mode.includes("s") && event.key === "ArrowDown") next.h += step;
|
if (mode.includes("s") && event.key === "ArrowDown") next.h += step;
|
||||||
if (mode.includes("s") && event.key === "ArrowUp") next.h = Math.max(40, next.h - step);
|
if (mode.includes("s") && event.key === "ArrowUp") next.h = Math.max(40, next.h - step);
|
||||||
}
|
}
|
||||||
next.x = Math.max(0, next.x);
|
|
||||||
next.y = Math.max(0, next.y);
|
next.y = Math.max(0, next.y);
|
||||||
emit("commit", next);
|
emit("commit", next);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ function nearest(moving, targets, threshold) {
|
|||||||
// `lo`/`hi`: whether the gesture moves this axis's start/end edge.
|
// `lo`/`hi`: whether the gesture moves this axis's start/end edge.
|
||||||
function resolve(start, size, delta, lo, hi, shift) {
|
function resolve(start, size, delta, lo, hi, shift) {
|
||||||
const fit = (n) => (shift === null ? grid(n) : Math.round(n + shift));
|
const fit = (n) => (shift === null ? grid(n) : Math.round(n + shift));
|
||||||
if (lo && hi) return [Math.max(0, fit(start + delta)), size];
|
if (lo && hi) return [fit(start + delta), size];
|
||||||
if (hi) return [start, Math.max(MIN_SIZE, fit(size + delta))];
|
if (hi) return [start, Math.max(MIN_SIZE, fit(size + delta))];
|
||||||
if (lo) {
|
if (lo) {
|
||||||
const s = Math.max(0, Math.min(fit(start + delta), start + size - MIN_SIZE));
|
const s = Math.min(fit(start + delta), start + size - MIN_SIZE);
|
||||||
return [s, start + size - s];
|
return [s, start + size - s];
|
||||||
}
|
}
|
||||||
return [start, size];
|
return [start, size];
|
||||||
|
|||||||
Reference in New Issue
Block a user