Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
build: pin the PostgreSQL pgvector image to a verified multi-platform digest (#10485)
[._.]/ Adam Eivy72ab0f750eb1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 8ac3b3c9d9..15759104a0 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -530,7 +530,7 @@ jobs:actions: writeservices:postgres:- image: pgvector/pgvector:pg17+ image: pgvector/pgvector:pg17@sha256:ac08538c6f8b9904c33c8224c5e5706dbe760aca29db1d096972b4052c22a75denv:POSTGRES_USER: portosPOSTGRES_PASSWORD: portosdiff --git a/docker-compose.yml b/docker-compose.ymlindex 12211ac1cf..54fa8efbc1 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -8,7 +8,7 @@services:db:- image: pgvector/pgvector:pg17+ image: pgvector/pgvector:pg17@sha256:ac08538c6f8b9904c33c8224c5e5706dbe760aca29db1d096972b4052c22a75dcontainer_name: portos-dbrestart: unless-stoppedports:diff --git a/docs/STORAGE.md b/docs/STORAGE.mdindex 130fe577b9..c06ea28909 100644--- a/docs/STORAGE.md+++ b/docs/STORAGE.md@@ -348,6 +348,7 @@ The escape hatch is **guarded from bitrot by the test suite** (tests boot with `3. **Docker unavailable:** if Docker or Compose is missing, or the daemon is stopped, setup exits non-zero with restoration instructions, even when native PostgreSQL is healthy. Both interactive and unattended runs preserve `.env` and never offer a backend switch.4. **`PGMODE=native`:** first checks whether the configured role can authenticate to the configured database and its base `memories` table exists. A healthy database exits immediately without re-provisioning. Otherwise it runs `scripts/db.sh setup-native` (Homebrew install, role, database, extensions, schema) and verifies readiness again. The endpoint defaults to `localhost:5432` (`PGHOST`/`PGPORT` override it, from the shell or `.env`). Both the provisioning script and the readiness probes use that same selected endpoint: an unavailable selected endpoint fails without sending SQL to any other cluster on the machine.5. **Failure is non-zero exit.** A started-but-unresponsive container or a failed native bootstrap exits non-zero with an actionable message — so the `&&`-chained `npm start` halts here instead of crash-looping under PM2 against an unready database.+6. **The Docker image is digest-pinned.** `docker-compose.yml` (and the CI Postgres service) reference `pgvector/pgvector:pg17@sha256:<manifest-list digest>` — the readable tag plus the multi-platform (linux/amd64 + linux/arm64) index digest — so every install at one revision runs identical image contents and nothing pulls an unspecified newer image. Refresh only in a dependency-update PR: resolve the tag's index digest from the registry (`docker buildx imagetools inspect pgvector/pgvector:pg17`), confirm the index lists both architectures and its digest equals the SHA-256 of the manifest body, update both files together (`scripts/dbImageDigestPin.test.js` guards tag-only regressions), then verify a fresh start and an existing named volume both come up healthy with the base `memories` table, without replacing the volume.**Mode selection does not migrate data.** Native and Docker PostgreSQL are separate databases; setup checks schema readiness, not whether one contains your existing records. Keep an existing install pointed at the database holding its data. Back up before an intentional move between modes (see [Backup & Restore](./BACKUP.md)).diff --git a/scripts/dbImageDigestPin.test.js b/scripts/dbImageDigestPin.test.jsnew file mode 100644index 0000000000..511c935ab9--- /dev/null+++ b/scripts/dbImageDigestPin.test.js@@ -0,0 +1,30 @@+import { readFileSync } from 'fs';+import { dirname, join } from 'path';+import { fileURLToPath } from 'url';+import { describe, it, expect } from 'vitest';++const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');+const PINNED = /^pgvector\/pgvector:pg\d+@sha256:[0-9a-f]{64}$/;++// Regression caught: a tag-only database image makes installs at the same+// revision provision different PostgreSQL/pgvector contents depending on pull+// date. Digest changes must be explicit dependency-update PRs.+describe('database image is pinned to a manifest digest', () => {+ const sources = {+ 'docker-compose.yml': readFileSync(join(ROOT, 'docker-compose.yml'), 'utf8'),+ '.github/workflows/ci.yml': readFileSync(join(ROOT, '.github/workflows/ci.yml'), 'utf8'),+ };++ for (const [file, text] of Object.entries(sources)) {+ it(`${file} references every pgvector image by tag@digest`, () => {+ const refs = [...text.matchAll(/^\s*image:\s*(pgvector\/\S+)\s*$/gm)].map((m) => m[1]);+ expect(refs.length).toBeGreaterThan(0);+ for (const ref of refs) expect(ref).toMatch(PINNED);+ });+ }++ it('compose and CI pin the same digest', () => {+ const digests = Object.values(sources).flatMap((t) => [...t.matchAll(/pgvector\/pgvector:pg\d+@(sha256:[0-9a-f]{64})/g)].map((m) => m[1]));+ expect(new Set(digests).size).toBe(1);+ });+});