Skip to content

Commit 9e3ee73

Browse files
authored
Point the install pages at the latest channel and the new installer (#252)
* Point the install pages at the latest channel and new installer The v1.2-0 install.sh installs from `latest` by default, keeps `stable` behind --stable and pins a release with --version, so the pages that show it or the repository lines would otherwise describe the wrong release. The site fallback and drift check now cover both channels, so a deploy fails if either fallback disagrees with its channel's feed. Signed-off-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com> * Say what the 1.2 image does to an existing data volume The Docker commands pull latest, which is 1.2 and updates the extensions on a 1.0 volume at start, one way. The page still said a newer image leaves the volume's schema alone. Signed-off-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com> --------- Signed-off-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com> Co-authored-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com>
1 parent 331376b commit 9e3ee73

12 files changed

Lines changed: 585 additions & 167 deletions

‎.github/scripts/check_release_drift.js‎

Lines changed: 77 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,58 @@
11
#!/usr/bin/env node
22
/**
3-
* Fails the build when the site's fallback release drifts from the release the
4-
* package repository actually mirrors.
3+
* Fails the build when either of the site's fallback releases drifts from the
4+
* release its package channel actually mirrors.
55
*
66
* The /packages page used to hardcode its versions, and they went stale: the
77
* page still advertised 0.114-0 (and 0.113-0 for the repository examples) after
8-
* v0.116-0 had been published and mirrored. The page now reads
9-
* out/packages/release-info.json at runtime, but it still needs a compiled-in
10-
* fallback for the first paint and for the case where that fetch fails - so the
11-
* fallback can drift in exactly the same way, just less visibly.
8+
* v0.116-0 had been published and mirrored. The page now reads each channel's
9+
* release feed at runtime, but it still needs a compiled-in fallback for the
10+
* first paint and for the case where that fetch fails - so the fallback can
11+
* drift in exactly the same way, just less visibly.
1212
*
13-
* This check closes that loop: whenever the deployment mirrors a release, the
14-
* fallback baked into the bundle must name the same one.
13+
* This check closes that loop: whenever the deployment mirrors the releases,
14+
* each fallback baked into the bundle must name its channel's release.
1515
*
16-
* Skipped when release-info.json is absent, which is the normal case for a
17-
* site-only build (BUILD_PACKAGES=false, or any fork without the packaging
18-
* secrets). There is nothing to compare against then.
16+
* Skipped when neither feed exists, which is the normal case for a site-only
17+
* build (BUILD_PACKAGES=false, or any fork without the packaging secrets).
18+
* There is nothing to compare against then.
1919
*/
2020

2121
const fs = require("node:fs");
2222
const path = require("node:path");
2323

24-
const releaseInfoPath = path.join(process.cwd(), "out", "packages", "release-info.json");
25-
const fallbackSourcePath = path.join(process.cwd(), "app", "lib", "releaseInfo.ts");
24+
// Mirrors releaseInfoPaths in app/lib/releaseInfo.ts.
25+
const channels = [
26+
{ channel: "latest", feed: path.join("out", "packages", "release-info-latest.json") },
27+
{ channel: "stable", feed: path.join("out", "packages", "release-info.json") },
28+
];
29+
const fallbackSourcePath = path.join("app", "lib", "releaseInfo.ts");
2630

27-
if (!fs.existsSync(releaseInfoPath)) {
28-
console.log(`No ${path.relative(process.cwd(), releaseInfoPath)}; skipping release drift check.`);
31+
const present = channels.filter(({ feed }) => fs.existsSync(feed));
32+
if (present.length === 0) {
33+
console.log("No release feeds in out/packages; skipping release drift check.");
2934
process.exit(0);
3035
}
36+
// A deploy mirrors both channels, so a lone feed means the other channel was not built.
37+
if (present.length !== channels.length) {
38+
const missing = channels.filter((entry) => !present.includes(entry)).map(({ feed }) => feed);
39+
console.error(`Release drift: ${missing.join(", ")} is missing; cannot verify every fallback release.`);
40+
process.exit(1);
41+
}
3142

3243
const source = fs.readFileSync(fallbackSourcePath, "utf8");
44+
const fallbacks = source.slice(source.indexOf("export const FALLBACK_RELEASES"));
3345

34-
/** Reads a string field out of the FALLBACK_RELEASE object literal. */
35-
function fallbackField(field) {
36-
const match = new RegExp(`${field}:\\s*"([^"]+)"`).exec(source);
46+
/** Reads a string field out of FALLBACK_RELEASES[channel]. */
47+
function fallbackField(channel, field) {
48+
const entry = new RegExp(`\\b${channel}:\\s*\\{([^}]*)\\}`).exec(fallbacks);
49+
const match = entry && new RegExp(`\\b${field}:\\s*"([^"]+)"`).exec(entry[1]);
3750
return match ? match[1] : null;
3851
}
3952

40-
const mirrored = JSON.parse(fs.readFileSync(releaseInfoPath, "utf8"));
41-
const mirroredTag = mirrored.tag_name;
42-
if (typeof mirroredTag !== "string" || mirroredTag.length === 0) {
43-
console.error("release-info.json has no tag_name; cannot verify the site's fallback release.");
44-
process.exit(1);
45-
}
46-
47-
const fallbackTag = fallbackField("tagName");
48-
if (fallbackTag !== mirroredTag) {
49-
console.error(
50-
[
51-
"Release drift: the site's fallback release does not match the mirrored release.",
52-
"",
53-
` mirrored (out/packages/release-info.json): ${mirroredTag}`,
54-
` fallback (app/lib/releaseInfo.ts): ${fallbackTag ?? "<not found>"}`,
55-
"",
56-
"Update FALLBACK_RELEASE in app/lib/releaseInfo.ts to the mirrored release.",
57-
"It is what visitors see before the release feed loads, and permanently if",
58-
"that fetch fails.",
59-
].join("\n"),
60-
);
61-
process.exit(1);
62-
}
63-
6453
// The version strings are derived from real asset filenames, so a mismatch here
6554
// means the fallback would render install commands for packages the release
6655
// does not contain.
67-
const assetNames = Array.isArray(mirrored.assets)
68-
? mirrored.assets.map((asset) => asset && asset.name).filter((name) => typeof name === "string")
69-
: [];
70-
7156
const derived = [
7257
{
7358
field: "aptVersion",
@@ -84,26 +69,60 @@ const derived = [
8469
];
8570

8671
let failed = false;
87-
for (const { field, pattern } of derived) {
88-
const actual = assetNames.map((name) => pattern.exec(name)).find((m) => m && m[1]);
89-
if (!actual) {
90-
// The release simply does not ship that package shape; the fallback keeps
91-
// whatever it had, which is not drift.
72+
for (const { channel, feed } of channels) {
73+
const mirrored = JSON.parse(fs.readFileSync(feed, "utf8"));
74+
const mirroredTag = mirrored.tag_name;
75+
if (typeof mirroredTag !== "string" || mirroredTag.length === 0) {
76+
console.error(`${feed} has no tag_name; cannot verify the ${channel} fallback release.`);
77+
failed = true;
9278
continue;
9379
}
94-
const expected = actual[1];
95-
const declared = fallbackField(field);
96-
if (declared !== expected) {
80+
81+
const fallbackTag = fallbackField(channel, "tagName");
82+
if (fallbackTag !== mirroredTag) {
9783
console.error(
98-
`Release drift: FALLBACK_RELEASE.${field} is "${declared}" but ${mirroredTag} ships "${expected}".`,
84+
[
85+
`Release drift: the site's ${channel} fallback release does not match the mirrored release.`,
86+
"",
87+
` mirrored (${feed}): ${mirroredTag}`,
88+
` fallback (FALLBACK_RELEASES.${channel}): ${fallbackTag ?? "<not found>"}`,
89+
"",
90+
].join("\n"),
9991
);
10092
failed = true;
93+
continue;
94+
}
95+
96+
const assetNames = Array.isArray(mirrored.assets)
97+
? mirrored.assets.map((asset) => asset && asset.name).filter((name) => typeof name === "string")
98+
: [];
99+
let channelFailed = false;
100+
for (const { field, pattern } of derived) {
101+
const actual = assetNames.map((name) => pattern.exec(name)).find((m) => m && m[1]);
102+
if (!actual) {
103+
// The release simply does not ship that package shape; the fallback keeps
104+
// whatever it had, which is not drift.
105+
continue;
106+
}
107+
const expected = actual[1];
108+
const declared = fallbackField(channel, field);
109+
if (declared !== expected) {
110+
console.error(
111+
`Release drift: FALLBACK_RELEASES.${channel}.${field} is "${declared}" but ${mirroredTag} ships "${expected}".`,
112+
);
113+
channelFailed = true;
114+
}
115+
}
116+
failed ||= channelFailed;
117+
if (!channelFailed) {
118+
console.log(`The ${channel} fallback matches the mirrored release (${mirroredTag}).`);
101119
}
102120
}
103121

104122
if (failed) {
105-
console.error("\nUpdate FALLBACK_RELEASE in app/lib/releaseInfo.ts.");
123+
console.error(
124+
"\nUpdate FALLBACK_RELEASES in app/lib/releaseInfo.ts. It is what visitors see before the\n" +
125+
"release feeds load, and permanently if a fetch fails.",
126+
);
106127
process.exit(1);
107128
}
108-
109-
console.log(`Release fallback matches the mirrored release (${mirroredTag}).`);

‎PACKAGE-INSTALL.md‎

Lines changed: 73 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Repository-backed installation commands for DocumentDB.
44

5-
> The `stable` channel serves v1.0-0; see [Release channels](#release-channels).
5+
> The `latest` channel serves v1.2-0 and `stable` serves v1.0-0; see [Release channels](#release-channels).
66
77
## Clean-host installer
88

@@ -13,26 +13,39 @@ curl -fsSLo documentdb-install.sh https://documentdb.io/install.sh &&
1313
sudo sh documentdb-install.sh
1414
```
1515

16-
This installs v1.0-0 from this repository on PostgreSQL 18; add `--pg-major 17`
17-
for 17. On a host where DocumentDB is already set up, it only reports that instance's status
18-
and doesn't upgrade it; to move an existing install to 1.0, see
19-
[Upgrading an existing install](#upgrading-an-existing-install).
16+
This installs v1.2-0 from the `latest` channel on PostgreSQL 18; add `--pg-major 17` for 17.
17+
The host keeps that channel, so `apt upgrade` and `dnf upgrade` follow `latest` to new releases.
18+
To choose another release, add one option:
19+
20+
- `--stable`: the `stable` channel (v1.0-0), with the same repository definition the 1.0
21+
installer wrote.
22+
- `--version 1.0.0`: exactly that release (1.0.0 or later; `1.2` means `1.2.0`), downloaded from
23+
its GitHub release and checked against its `SHA256SUMS`. No DocumentDB repository is
24+
configured, so the package manager never upgrades it.
25+
26+
The installer only sets up new installs: on a host where DocumentDB is already installed it
27+
changes no packages. To move an existing install to a newer release, see
28+
[Upgrading an existing install](#upgrading-an-existing-install). A host whose DocumentDB
29+
repository file is the other channel's is refused, not rewritten: rerun with the matching option,
30+
or remove `/etc/apt/sources.list.d/documentdb.list` or `/etc/yum.repos.d/documentdb.repo` to
31+
switch.
2032

2133
The site serves the `install.sh` attached to the release named in
2234
`scripts/publish-installer.mjs`, and the build fails if its SHA256 changes.
2335

2436
## Release channels
2537

2638
The repository publishes two channels, each signed with the same key and listing only its own
27-
release's packages. The commands on this page use `stable`.
39+
release's packages. The commands on this page use `latest`.
2840

2941
| Channel | Release | APT source | DNF `baseurl` |
3042
|---|---|---|---|
43+
| `latest` | v1.2-0 | `https://documentdb.io/deb latest ubuntu24` | `https://documentdb.io/rpm/latest/rhel9` |
3144
| `stable` | v1.0-0 | `https://documentdb.io/deb stable ubuntu24` | `https://documentdb.io/rpm/rhel9` |
32-
| `latest` | the newest release | `https://documentdb.io/deb latest ubuntu24` | `https://documentdb.io/rpm/latest/rhel9` |
3345

34-
Release metadata is at `https://documentdb.io/packages/release-info.json` for `stable` and
35-
`https://documentdb.io/packages/release-info-latest.json` for `latest`.
46+
`stable` takes new releases later than `latest`. Release metadata is at
47+
`https://documentdb.io/packages/release-info-latest.json` for `latest` and
48+
`https://documentdb.io/packages/release-info.json` for `stable`.
3649

3750
## What is published
3851

@@ -91,6 +104,9 @@ release tag. Those paths are not part of the current hosted support matrix.
91104
This is the recommended path. It installs the whole stack and brings up a working
92105
wire-protocol endpoint.
93106

107+
These commands use the `latest` channel. For `stable` (v1.0-0), write `stable` in place of
108+
`latest` in the DocumentDB APT line, or use `baseurl=https://documentdb.io/rpm/rhel9` on EL9.
109+
94110
> These commands assume a regular Linux host where you use `sudo`. In a clean container that
95111
> already runs as `root`, omit `sudo`, and on Debian/Ubuntu also
96112
> `export DEBIAN_FRONTEND=noninteractive` first, or `tzdata` will hang the install with an
@@ -104,7 +120,7 @@ sudo apt install -y curl ca-certificates gnupg && \
104120
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor --yes -o /usr/share/keyrings/postgresql.gpg && \
105121
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt noble-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list >/dev/null && \
106122
curl -fsSL https://documentdb.io/documentdb-archive-keyring.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/documentdb-archive-keyring.gpg && \
107-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/documentdb-archive-keyring.gpg] https://documentdb.io/deb stable ubuntu24" | sudo tee /etc/apt/sources.list.d/documentdb.list >/dev/null && \
123+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/documentdb-archive-keyring.gpg] https://documentdb.io/deb latest ubuntu24" | sudo tee /etc/apt/sources.list.d/documentdb.list >/dev/null && \
108124
sudo apt update && \
109125
sudo apt install -y documentdb
110126
```
@@ -127,7 +143,7 @@ sudo rpm --import https://documentdb.io/documentdb-archive-keyring.gpg && \
127143
printf '%s\n' \
128144
'[documentdb]' \
129145
'name=DocumentDB Repository' \
130-
'baseurl=https://documentdb.io/rpm/rhel9' \
146+
'baseurl=https://documentdb.io/rpm/latest/rhel9' \
131147
'enabled=1' \
132148
'gpgcheck=1' \
133149
'gpgkey=https://documentdb.io/documentdb-archive-keyring.gpg' | sudo tee /etc/yum.repos.d/documentdb.repo >/dev/null && \
@@ -148,7 +164,7 @@ sudo rpm --import https://documentdb.io/documentdb-archive-keyring.gpg && \
148164
printf '%s\n' \
149165
'[documentdb]' \
150166
'name=DocumentDB Repository' \
151-
'baseurl=https://documentdb.io/rpm/rhel9' \
167+
'baseurl=https://documentdb.io/rpm/latest/rhel9' \
152168
'enabled=1' \
153169
'gpgcheck=1' \
154170
'gpgkey=https://documentdb.io/documentdb-archive-keyring.gpg' | sudo tee /etc/yum.repos.d/documentdb.repo >/dev/null && \
@@ -238,7 +254,7 @@ Before using this anywhere but a private machine:
238254

239255
```bash
240256
sudo documentdb-setup --status # gateway listener, service states, resolved paths
241-
documentdb-gateway --version # DocumentDB version (1.0.0)
257+
documentdb-gateway --version # DocumentDB version (1.2.0 on latest)
242258
dpkg -l | grep documentdb # or: rpm -qa | grep documentdb
243259
```
244260

@@ -381,7 +397,8 @@ The current release publishes PostgreSQL 17 and 18. Install `documentdb-17` or
381397

382398
## Upgrading an existing install
383399

384-
Package installs from v0.116 or v0.117 upgrade in place to 1.0. Move the entire stack
400+
Package installs from v0.116 or v0.117 upgrade in place to 1.0 from the `stable` channel; to
401+
take a 1.0.0 install to 1.2, [switch it to `latest`](#switch-from-stable-to-latest). Move the entire stack
385402
together; upgrading only `postgresql-N-documentdb` does not update the gateway, tools, common
386403
payload, or `documentdb-N`. These steps use systemd; upgrading a host without it isn't covered here.
387404
On a package-managed private PostgreSQL 18 instance:
@@ -465,8 +482,40 @@ Confirm afterwards with:
465482
SELECT extname, extversion FROM pg_extension WHERE extname LIKE 'documentdb%';
466483
```
467484

485+
## Switch from `stable` to `latest`
486+
487+
`stable` still serves 1.0.0 and takes new releases later than `latest`, which serves 1.2. To move a
488+
1.0.0 install to 1.2 now, point its one repository file at `latest` and upgrade the packages.
489+
This is one-way: 1.0 does not run correctly on data that 1.2 has updated, so back up the data
490+
directory first.
491+
492+
```bash
493+
# Debian / Ubuntu
494+
sudo sed -i 's/ stable ubuntu24$/ latest ubuntu24/' /etc/apt/sources.list.d/documentdb.list &&
495+
sudo apt update &&
496+
sudo apt upgrade
497+
498+
# EL9: use this instead of the apt commands above
499+
sudo sed -i 's|/rpm/rhel9$|/rpm/latest/rhel9|' /etc/yum.repos.d/documentdb.repo &&
500+
sudo dnf upgrade
501+
```
502+
503+
Then re-run setup with the PostgreSQL major, plus any `--data-dir` or `--pg-port` you installed
504+
with. It restarts PostgreSQL once to load the new libraries, updates the extensions, and starts the
505+
gateway; without `--admin-user` it keeps every admin user and password:
506+
507+
```bash
508+
sudo documentdb-setup --pg-version 18 --yes
509+
```
510+
511+
For an adopted PostgreSQL instance, run `sudo documentdb-setup --target-postgres-instance 18/main --yes`
512+
(with your cluster name) instead, then the restart and setup commands it prints.
513+
468514
## Version pinning
469515

516+
Each channel lists only its own release. To install one exact release that the package manager
517+
never upgrades, use the installer's `--version` option instead.
518+
470519
Run the repository setup for your distro first, then:
471520

472521
### APT
@@ -492,17 +541,17 @@ published in the documentdb.io package repositories. Community builds are welcom
492541
For example, after checking out the matching release tag, build an extension package with:
493542

494543
```bash
495-
./packaging/build_packages.sh --os deb12 --pg 16 --version 1.0.0
544+
./packaging/build_packages.sh --os deb12 --pg 16 --version 1.2.0
496545
```
497546

498-
`v1.0-0` and `v1.0-RC2` are on the same commit, so pass `--version`; without it the scripts can build RC-versioned packages. That command builds only `postgresql-N-documentdb`. A custom full-stack package set uses
547+
Without `--version`, the script takes the version from the checked-out release tag, or else from the control file; at `v1.2-0` both give 1.2.0. That command builds only `postgresql-N-documentdb`. A custom full-stack package set uses
499548
three entry points:
500549

501550
- `packaging/build_packages.sh` — PostgreSQL extension
502551
- `packaging/gateway/build_gateway_packages.sh` — wire-protocol gateway
503552
- `packaging/build_extra_packages.sh` — tools, common payload, `documentdb-N`, and meta package
504553

505-
The [v1.0 packaging guide](https://github.com/documentdb/documentdb/blob/v1.0-0/packaging/README.md)
554+
The [v1.2 packaging guide](https://github.com/documentdb/documentdb/blob/v1.2-0/packaging/README.md)
506555
documents their required arguments, version formats, prerequisites, and accepted targets.
507556
PostgreSQL 15 remains extension-only for package-managed installs because the setup tools
508557
require PostgreSQL 16 or newer.
@@ -517,9 +566,9 @@ they do not retain packages from older releases.
517566
Examples:
518567

519568
```text
520-
ubuntu24.04-documentdb_1.0.0_all.deb
521-
ubuntu24.04-postgresql-18-documentdb_1.0-0_amd64.deb
522-
rhel9-postgresql18-documentdb-1.0.0-1.el9.x86_64.rpm
569+
ubuntu24.04-documentdb_1.2.0_all.deb
570+
ubuntu24.04-postgresql-18-documentdb_1.2-0_amd64.deb
571+
rhel9-postgresql18-documentdb-1.2.0-1.el9.x86_64.rpm
523572
```
524573

525574
For a full stack, pass the five packages for the selected PostgreSQL major to one command:
@@ -531,10 +580,12 @@ dependencies are not included still fails. Alternatively, use the repository-bac
531580
above.
532581

533582
- GitHub Releases: https://github.com/documentdb/documentdb/releases
534-
- Release metadata: https://documentdb.io/packages/release-info.json
583+
- Release metadata: https://documentdb.io/packages/release-info-latest.json (`latest`),
584+
https://documentdb.io/packages/release-info.json (`stable`)
535585

536586
## Notes
537587

538-
- The current release publishes the `ubuntu24` APT component and the `rpm/rhel9` repository.
588+
- Each channel publishes the `ubuntu24` APT component and an `rhel9` RPM repository
589+
(`rpm/latest/rhel9` and `rpm/rhel9`).
539590
- The RPM flow depends on EPEL plus PostgreSQL's upstream RPM repository because DocumentDB depends on PostgreSQL, `pg_cron`, `pgvector`, PostGIS, and `rum` for PostgreSQL 17.
540591
- On Debian/Ubuntu, the distro-packaged `cargo` can be older than the current gateway workspace lockfile. `rustup` avoids that mismatch.

0 commit comments

Comments
 (0)