Compare commits

..
1 Commits
Author SHA1 Message Date
autonomic-bot 64b1974eb8 chore: runtime RSA keys + docspec 1.21.4 on 2.0.0+v6.0.4 (valkey 9.1.3 kept)
cc-ci/testme cc-ci: success
2026-11-13 04:58:19 +00:00
4 changed files with 57 additions and 78 deletions
+1 -2
View File
@@ -1,4 +1,5 @@
TYPE=lasuite-docs TYPE=lasuite-docs
DOMAIN=lasuite-docs.example.com DOMAIN=lasuite-docs.example.com
## Domain aliases ## Domain aliases
@@ -26,8 +27,6 @@ SECRET_POSTGRES_P_VERSION=v1
SECRET_Y_API_KEY_VERSION=v1 SECRET_Y_API_KEY_VERSION=v1
# DJANGO_HOST_EMAIL_PASSWORD # DJANGO_HOST_EMAIL_PASSWORD
SECRET_EMAIL_PASS_VERSION=v1 SECRET_EMAIL_PASS_VERSION=v1
# (the two RSA JWT keys are no longer secrets: the jwt-keys service generates
# them into the jwt_keys volume on first deploy — see README)
############################################################################## ##############################################################################
# EMAIL # EMAIL
+1 -1
View File
@@ -29,7 +29,7 @@ You should then be able to visit the landing page of your app, but not yet to lo
## RSA keys ## RSA keys
Since v6, the backend and the collaboration server (`yhub`) authenticate each other with signed tokens. Each needs its own RSA private key, never the same one. The recipe generates both automatically on first deploy into the `jwt_keys` volume (the `jwt-keys` service, using Node crypto) and reuses them on later deploys. They are not Swarm secrets because abra cannot generate PEM keys and Swarm secrets must exist before the stack is deployed. Since v6, the backend and the collaboration server (`yhub`) authenticate each other with signed tokens. Each needs its own RSA private key, never the same one. The recipe generates both automatically on first deploy into the `jwt_keys` volume (the `jwt-keys` service, using the yhub image's Node crypto) and reuses them on later deploys. They are not Swarm secrets because abra cannot generate PEM keys and Swarm secrets must exist before the stack is deployed.
## Upgrading from v5 to v6 ## Upgrading from v5 to v6
+43 -58
View File
@@ -57,7 +57,6 @@ x-common-env: &common-env
# Collaboration server (yhub), reached in-stack # Collaboration server (yhub), reached in-stack
YHUB_API_BASE_URL: http://yhub:3002 YHUB_API_BASE_URL: http://yhub:3002
# RSA key signing the tokens the backend presents to yhub and y-provider # RSA key signing the tokens the backend presents to yhub and y-provider
# (generated at runtime by the jwt-keys service, shared via the jwt_keys volume)
JWT_PRIVATE_KEY_FILE: /keys/jwt.pem JWT_PRIVATE_KEY_FILE: /keys/jwt.pem
# Email app URL (used in email templates; matches recipe DOMAIN) # Email app URL (used in email templates; matches recipe DOMAIN)
DJANGO_EMAIL_URL_APP: "https://${DOMAIN}" DJANGO_EMAIL_URL_APP: "https://${DOMAIN}"
@@ -106,7 +105,6 @@ x-yhub-env: &yhub-env
COLLABORATION_BACKEND_BASE_URL: https://${DOMAIN} COLLABORATION_BACKEND_BASE_URL: https://${DOMAIN}
COLLABORATION_SERVER_ORIGIN: https://${DOMAIN} COLLABORATION_SERVER_ORIGIN: https://${DOMAIN}
Y_PROVIDER_API_KEY_FILE: /run/secrets/y_api_key Y_PROVIDER_API_KEY_FILE: /run/secrets/y_api_key
# (generated at runtime by the jwt-keys service, shared via the jwt_keys volume)
YHUB_JWT_PRIVATE_KEY_FILE: /keys/yhub-jwt.pem YHUB_JWT_PRIVATE_KEY_FILE: /keys/yhub-jwt.pem
# Seed documents from the pre-v6 media bucket the first time they are opened. # Seed documents from the pre-v6 media bucket the first time they are opened.
# Only turn off once `abra app cmd <app> backend migrate_documents` covered all documents. # Only turn off once `abra app cmd <app> backend migrate_documents` covered all documents.
@@ -122,7 +120,7 @@ x-minio-env: &minio-env
services: services:
app: app:
image: lasuite/impress-frontend:v6.1.0 image: lasuite/impress-frontend:v6.0.4
networks: networks:
- backend - backend
deploy: deploy:
@@ -139,7 +137,7 @@ services:
start_period: 10s start_period: 10s
backend: backend:
image: lasuite/impress-backend:v6.1.0 image: lasuite/impress-backend:v6.0.4
networks: networks:
- backend - backend
environment: environment:
@@ -175,7 +173,7 @@ services:
- email_pass - email_pass
celery: celery:
image: lasuite/impress-backend:v6.1.0 image: lasuite/impress-backend:v6.0.4
networks: networks:
- backend - backend
healthcheck: healthcheck:
@@ -208,7 +206,7 @@ services:
# Collaboration server: serves the websocket and holds the document content # Collaboration server: serves the websocket and holds the document content
yhub: yhub:
image: lasuite/impress-yhub:v6.1.0 image: lasuite/impress-yhub:v6.0.4
networks: networks:
- backend - backend
environment: *yhub-env environment: *yhub-env
@@ -219,22 +217,10 @@ services:
timeout: 5s timeout: 5s
retries: 20 retries: 20
start_period: 30s start_period: 30s
# The server never creates its schema: run the idempotent init-db before every start. # The server never creates its schema: run the idempotent init-db before every start
# The v6.1.0 yhub image is distroless (no shell), so the init-db + server chain is a entrypoint: >
# plain Node script: wait for the RSA key, build POSTGRES from the secret, init-db, sh -c "while [ ! -s /keys/yhub-jwt.pem ]; do sleep 1; done; export POSTGRES=\"postgres://docs:$$(node -e 'process.stdout.write(encodeURIComponent(require(\"fs\").readFileSync(\"/run/secrets/postgres_p\",\"utf8\").trim()))')@db:5432/yhub\" && node node_modules/@y/hub/bin/init-db.js && exec /usr/local/bin/entrypoint \"$$@\"" --
# then exec the server exactly as the image's default Cmd would. command: ["node", "--import", "./dist/sentry.js", "dist/server.js"]
entrypoint:
- /nodejs/bin/node
- "-e"
- |-
const fs = require("fs"), cp = require("child_process");
const key = "/keys/yhub-jwt.pem";
const sleep = () => { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 1000); };
for (let i = 0; i < 300 && !(fs.existsSync(key) && fs.statSync(key).size > 0); i++) sleep();
if (!(fs.existsSync(key) && fs.statSync(key).size > 0)) { console.error("yhub: RSA key never appeared in /keys"); process.exit(1); }
process.env.POSTGRES = "postgres://docs:" + encodeURIComponent(fs.readFileSync("/run/secrets/postgres_p", "utf8").trim()) + "@db:5432/yhub";
cp.execFileSync(process.execPath, ["node_modules/@y/hub/bin/init-db.js"], { stdio: "inherit" });
cp.execFileSync(process.execPath, ["--import", "./dist/sentry.js", "dist/server.js"], { stdio: "inherit" });
volumes: volumes:
- jwt_keys:/keys:ro - jwt_keys:/keys:ro
secrets: secrets:
@@ -245,7 +231,7 @@ services:
# Valkey of yhub: holds updates not yet persisted to postgres, so it is a store, not a cache # Valkey of yhub: holds updates not yet persisted to postgres, so it is a store, not a cache
yhub-valkey: yhub-valkey:
image: valkey/valkey:9.2.0-alpine image: valkey/valkey:9.1.3-alpine
command: ["valkey-server", "--maxmemory-policy", "volatile-lru", "--appendonly", "yes", "--appendfsync", "everysec"] command: ["valkey-server", "--maxmemory-policy", "volatile-lru", "--appendonly", "yes", "--appendfsync", "everysec"]
healthcheck: healthcheck:
test: ["CMD", "valkey-cli", "ping"] test: ["CMD", "valkey-cli", "ping"]
@@ -260,45 +246,12 @@ services:
labels: labels:
backupbot.backup: "${ENABLE_BACKUPS:-true}" backupbot.backup: "${ENABLE_BACKUPS:-true}"
# Conversion service only since v6 (no longer serves the collaboration)
y-provider:
image: lasuite/impress-y-provider:v6.1.0
networks:
- backend
healthcheck:
# y-provider returns 403 on unauthenticated requests; wget exit 4 = network error (server down), anything else = server is responding
test: ["CMD-SHELL", "wget -qO /dev/null http://localhost:4444/ 2>/dev/null; test $$? -ne 4"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
environment: *yprovider-env
user: "${DOCKER_USER:-1000}"
entrypoint: >
sh -c "export Y_PROVIDER_API_KEY=\"$$(cat /run/secrets/y_api_key)\" && exec /usr/local/bin/entrypoint \"$$@\"" --
command: ["yarn", "start"]
secrets:
- y_api_key
docspec:
image: ghcr.io/docspec/api:1.21.4
networks:
- backend
healthcheck:
# Use 127.0.0.1, which is required instead of localhost for this healthcheck
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
# Generates the two RSA keys the backend and yhub sign with, into a shared volume. # Generates the two RSA keys the backend and yhub sign with, into a shared volume.
# They cannot be abra-generated secrets (PEM format) and Swarm secrets cannot be # They cannot be abra-generated secrets (PEM format) and Swarm secrets cannot be
# created at deploy time, so this idempotent sidecar creates them once and keeps them # created at deploy time, so this idempotent sidecar creates them once and keeps them
# on the volume across redeploys. Both consumers wait for their file before starting. # on the volume across redeploys. Both consumers wait for their file before starting.
# Uses a plain Node image (not the yhub image): yhub v6.1.0 is distroless (no shell).
jwt-keys: jwt-keys:
image: node:22-alpine image: lasuite/impress-yhub:v6.0.4
networks: networks:
- backend - backend
user: "0" user: "0"
@@ -326,6 +279,38 @@ services:
chmod 0400 /keys/jwt.pem /keys/yhub-jwt.pem chmod 0400 /keys/jwt.pem /keys/yhub-jwt.pem
while true; do sleep 3600; done while true; do sleep 3600; done
# Conversion service only since v6 (no longer serves the collaboration)
y-provider:
image: lasuite/impress-y-provider:v6.0.4
networks:
- backend
healthcheck:
# y-provider returns 403 on unauthenticated requests; wget exit 4 = network error (server down), anything else = server is responding
test: ["CMD-SHELL", "wget -qO /dev/null http://localhost:4444/ 2>/dev/null; test $$? -ne 4"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
environment: *yprovider-env
user: "${DOCKER_USER:-1000}"
entrypoint: >
sh -c "export Y_PROVIDER_API_KEY=\"$$(cat /run/secrets/y_api_key)\" && exec /usr/local/bin/entrypoint \"$$@\"" --
command: ["yarn", "start"]
secrets:
- y_api_key
docspec:
image: ghcr.io/docspec/api:1.21.4
networks:
- backend
healthcheck:
# Use 127.0.0.1, which is required instead of localhost for this healtcheck because of elixir/busybox bindings
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3000/health"]
interval: 15s
timeout: 5s
retries: 3
start_period: 10s
db: db:
image: pgautoupgrade/pgautoupgrade:18-debian image: pgautoupgrade/pgautoupgrade:18-debian
networks: networks:
@@ -395,7 +380,7 @@ services:
- minio_ru - minio_ru
web: web:
image: nginx:1.31.9 image: nginx:1.31.8
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8083"] test: ["CMD", "curl", "-f", "http://localhost:8083"]
interval: 15s interval: 15s
+11 -16
View File
@@ -1,18 +1,13 @@
Fix upstream main + make v6.1.0 deployable; runtime RSA keys + docspec 1.21.4. Deployability + docspec fix on top of 2.0.0+v6.0.4.
- Upstream `compose.yml` at `34e6c91` contains unresolved merge-conflict markers The backend and yhub RSA keys are now generated automatically on first deploy
(valkey 9.1.4 vs 9.1.3) around the `yhub-valkey` service — abra FATA into the `jwt_keys` volume (the `jwt-keys` service) and reused afterwards; no
`yaml: line 230: could not find expected ':'`. Resolved here to a single manual secret insertion is needed. `SECRET_JWT_PK_VERSION` and
`yhub-valkey` bumped to `valkey/valkey:9.2.0-alpine`. `SECRET_YHUB_JWT_PK_VERSION` are no longer used.
- The yhub v6.1.0 image is distroless (no shell, no /usr/local/bin/entrypoint), so
upstream's renovate bump broke the yhub service entirely. The entrypoint is now a
plain `node -e` script: wait for the RSA key, build POSTGRES from the secret, run
the idempotent init-db, then exec the server (same default Cmd).
- The two RSA JWT keys (backend ↔ yhub) are now generated at runtime by a `jwt-keys`
sidecar (`node:22-alpine`) into the `jwt_keys` volume; consumers wait for their
file. `SECRET_JWT_PK_VERSION`/`SECRET_YHUB_JWT_PK_VERSION` are gone — fresh
installs deploy without manual `abra app secret insert` of PEMs.
- Docspec moves to the Rust `ghcr.io/docspec/api:1.21.4` (port 3000), which Docs
>= 5.7 expects; the archived Elixir `ghcr.io/docspecio/api` (port 4000) is removed.
Recommended release: `abra recipe release lasuite-docs -y` Docspec moves to the Rust `ghcr.io/docspec/api:1.21.4` (port 3000), which Docs
>= 5.7 expects; the archived Elixir `ghcr.io/docspecio/api` (port 4000) is
removed.
`yhub-valkey` is 9.1.3-alpine (from upstream 2.0.0); safe for this standalone,
no-auth deployment (see the valkey 9 release notes).