Skip to content

Commit 9d2e308

Browse files
committed
Let users try v1.0-RC1 without changing the stable channel
Signed-off-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com>
1 parent 95d6769 commit 9d2e308

6 files changed

Lines changed: 162 additions & 2 deletions

File tree

‎PACKAGE-INSTALL.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
Repository-backed installation commands for DocumentDB.
44

5+
> This repository serves v0.117-0. v1.0-RC1 is for testing only, gets no fixes (those go into
6+
> RC2 or 1.0), has no upgrade path, and isn't in this repository; see
7+
> [Try the 1.0 release candidate](https://documentdb.io/docs/getting-started/release-candidate/).
8+
9+
## Clean-host installer
10+
11+
On a clean Ubuntu 24.04 or EL9 host, download and run the installer:
12+
13+
```sh
14+
curl -fsSLo documentdb-install.sh https://documentdb.io/install.sh &&
15+
sh documentdb-install.sh
16+
```
17+
18+
This installs v0.117-0 from this repository on PostgreSQL 18; add `--pg-major 17`
19+
for 17. To try v1.0-RC1 instead, enable PGDG and install the RC1 packages from the
20+
[release](https://github.com/documentdb/documentdb/releases/tag/v1.0-RC1) first, as the
21+
[RC guide](https://documentdb.io/docs/getting-started/release-candidate/) shows. The
22+
installer then reuses them, adds no DocumentDB repository, and only runs setup.
23+
24+
The site serves the `install.sh` attached to the release named in
25+
`scripts/publish-installer.mjs`, and the build fails if its SHA256 changes.
26+
527
## What is published
628

729
Starting with **v0.116-0**, DocumentDB ships a multi-package layout with a setup wizard and

‎app/services/articleService.ts‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,25 @@ The current official release publishes the full stack — extension, gateway, se
190190
> [!NOTE]
191191
> Need another distribution or PostgreSQL major? We welcome community builds. Check out the matching release tag and use the version-parameterized [packaging scripts](https://github.com/documentdb/documentdb/blob/v0.117-0/packaging/README.md). \`build_packages.sh\` builds the extension, \`gateway/build_gateway_packages.sh\` builds the gateway, and \`build_extra_packages.sh\` builds the common, tools, stand-alone, and meta packages. PostgreSQL 15 is extension-only because the setup tools require PostgreSQL 16 or newer. These builds are on demand and are not official release assets hosted by documentdb.io.
192192
193+
> [!NOTE]
194+
> Want to try DocumentDB 1.0? [v1.0-RC1](/docs/getting-started/release-candidate) is for testing only, gets no fixes (those go into RC2 or 1.0) and has no upgrade path. It isn't in the package repository, so the commands below install v0.117-0.
195+
193196
You do not need PostgreSQL already installed — the setup wizard creates and manages its own instance. The install does add the PGDG repository and pull PostgreSQL, PostGIS and around 160 packages (about 140 MB), so pick a host you are willing to have PGDG on.
194197
198+
## Clean-host installer
199+
200+
On a fresh Ubuntu 24.04 or EL9 host, download and run the installer:
201+
202+
\`\`\`sh
203+
curl -fsSLo documentdb-install.sh https://documentdb.io/install.sh &&
204+
sh documentdb-install.sh
205+
\`\`\`
206+
207+
This installs v0.117-0 from the package repository on PostgreSQL 18; add \`--pg-major 17\` for 17.
208+
To try v1.0-RC1 instead, enable PGDG and install the RC1 packages from the [release](https://github.com/documentdb/documentdb/releases/tag/v1.0-RC1) first, as the [RC guide](/docs/getting-started/release-candidate) shows, then run the same installer.
209+
It reuses the installed packages, adds no DocumentDB repository and only runs setup.
210+
RC1 has no maintenance or supported upgrades, so use a disposable host.
211+
195212
## Install
196213
197214
### Ubuntu 24.04, PostgreSQL 18 (APT)
@@ -392,7 +409,9 @@ It does **not** install the gateway, create a network endpoint for drivers, or r
392409
393410
Use the extension package for your PostgreSQL major: \`postgresql-N-documentdb\` on Ubuntu
394411
or \`postgresqlN-documentdb\` on EL9. You own PostgreSQL configuration, extension activation,
395-
and service restarts. Follow the matching release's [manual package instructions](https://github.com/documentdb/documentdb/blob/v0.117-0/packaging/README.md),
412+
and service restarts. Create \`documentdb_extended_rum\` as well as \`documentdb\`:
413+
\`CREATE EXTENSION documentdb CASCADE\` does not pull it in, and without it every index
414+
creation fails. Follow the matching release's [manual package instructions](https://github.com/documentdb/documentdb/blob/v0.117-0/packaging/README.md),
396415
or the [extension-only offline instructions](/docs/linux-packages/offline#smaller-offline-cases)
397416
when PostgreSQL and all extension dependencies are already installed.
398417
@@ -1239,6 +1258,7 @@ The \`latest\` tag is a convenience alias. Pin an explicit tag for anything repr
12391258
| \`ghcr.io/documentdb/documentdb/documentdb-local:pg18-0.117.0\` | DocumentDB 0.117.0 on PostgreSQL 18 |
12401259
| \`…:pg17-0.117.0\` | DocumentDB 0.117.0 on PostgreSQL 17 |
12411260
| \`…:pg16-0.117.0\` · \`…:pg15-0.117.0\` | PostgreSQL 16 and 15 |
1261+
| \`…:pg15-1.0.0-rc1\` · \`…:pg16-1.0.0-rc1\` · \`…:pg17-1.0.0-rc1\` · \`…:pg18-1.0.0-rc1\` | [v1.0-RC1](https://github.com/documentdb/documentdb/releases/tag/v1.0-RC1), for testing only, with [no fixes to RC1 and no upgrade path](/docs/getting-started/release-candidate). No date for 1.0 yet. Use a new, empty data volume. The \`pgNN-1.0.0\` tags point at the same images today but will move to the final 1.0 build. |
12421262
| \`…:latest\` | Currently identical to \`pg17-0.117.0\` |
12431263
12441264
> \`latest\` tracks **PostgreSQL 17**, while the \`documentdb\` package on Linux pins

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"scripts": {
66
"dev": "npm run compile && next dev --turbopack",
7-
"build": "npm run build:next && npm run build:blogs && npm run build:sitemap",
7+
"build": "npm run build:next && npm run build:blogs && npm run build:sitemap && npm run build:installer",
8+
"build:installer": "node scripts/publish-installer.mjs",
89
"build:next": "npm run compile && next build --turbopack",
910
"build:blogs": "bundle exec jekyll build --config blogs/_config.yml --source blogs --destination out/blogs --baseurl \"${JEKYLL_BASE_PATH:-/blogs}\"",
1011
"build:sitemap": "node scripts/generate-sitemap.mjs",

‎scripts/publish-installer.mjs‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { createHash } from 'node:crypto';
2+
import { mkdir, writeFile } from 'node:fs/promises';
3+
import { resolve } from 'node:path';
4+
import { pathToFileURL } from 'node:url';
5+
6+
// v0.117-0 ships no installer; RC1's installs from the stable repository.
7+
// Release assets can be replaced, so the digest is pinned too.
8+
export const installerSource = {
9+
release: 'v1.0-RC1',
10+
sha256: '4b380e6632533df8a8267a68bb1978909cae5253d4c0e1ac2d0d14839171621a',
11+
};
12+
13+
export async function publishInstaller(outputDirectory = 'out') {
14+
if (!/^v\d[\w.-]*$/.test(installerSource.release) ||
15+
!/^[a-f0-9]{64}$/.test(installerSource.sha256)) {
16+
throw new Error('Installer source must name a release tag and SHA256');
17+
}
18+
const url = `https://github.com/documentdb/documentdb/releases/download/${installerSource.release}/install.sh`;
19+
const response = await fetch(url, { signal: AbortSignal.timeout(60_000) });
20+
if (!response.ok) {
21+
throw new Error(`Installer download failed: HTTP ${response.status}`);
22+
}
23+
const script = Buffer.from(await response.arrayBuffer());
24+
const digest = createHash('sha256').update(script).digest('hex');
25+
if (digest !== installerSource.sha256) {
26+
throw new Error(`Installer checksum mismatch: ${digest}`);
27+
}
28+
await mkdir(outputDirectory, { recursive: true });
29+
await writeFile(resolve(outputDirectory, 'install.sh'), script);
30+
}
31+
32+
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
33+
await publishInstaller();
34+
}

‎tests/packageArticles.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
buildRpmInstallCommand,
1414
buildSetupCommand,
1515
} from '../app/lib/packageInstall';
16+
import { FALLBACK_RELEASE } from '../app/lib/releaseInfo';
1617

1718
function getCodeBlocks(content: string, language: string): string[] {
1819
const pattern = new RegExp('```' + language + '\\n([\\s\\S]*?)\\n```', 'g');
@@ -273,6 +274,23 @@ describe('Linux package articles', () => {
273274
);
274275
});
275276

277+
it('keeps package download and source links on the mirrored release', () => {
278+
const tags = [
279+
...`${linuxPackagesGuideContent}\n${linuxPackagesOperationsContent}`.matchAll(/documentdb\/(?:releases\/download|blob)\/(v[^/]+)\//g),
280+
].map((match) => match[1]);
281+
282+
expect(tags.length).toBeGreaterThan(0);
283+
expect(new Set(tags)).toEqual(new Set([FALLBACK_RELEASE.tagName]));
284+
});
285+
286+
it('serves the stable installer and adds RC1 only through preinstalled release packages', () => {
287+
expect(linuxPackagesGuideContent).toContain('https://documentdb.io/install.sh');
288+
expect(linuxPackagesGuideContent).toContain('installs v0.117-0 from the package repository');
289+
expect(linuxPackagesGuideContent).toContain('releases/tag/v1.0-RC1');
290+
expect(linuxPackagesGuideContent).toContain('adds no DocumentDB repository');
291+
expect(linuxPackagesGuideContent).not.toContain('--version v1.0-RC1');
292+
});
293+
276294
it('uses the current release package guide and artifact version', () => {
277295
const offlineGuide = getArticleByPath('linux-packages', ['offline']);
278296

‎tests/publishInstaller.test.ts‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { afterEach, describe, expect, it, vi } from 'vitest';
2+
import { createHash } from 'node:crypto';
3+
import { mkdtemp, readFile, rm } from 'node:fs/promises';
4+
import { tmpdir } from 'node:os';
5+
import path from 'node:path';
6+
import { installerSource, publishInstaller } from '../scripts/publish-installer.mjs';
7+
8+
const originalSource = { ...installerSource };
9+
const directories: string[] = [];
10+
const script = '#!/bin/sh\nprintf "installer fixture\\n"\n';
11+
12+
async function outputDirectory() {
13+
const directory = await mkdtemp(path.join(tmpdir(), 'documentdb-installer-'));
14+
directories.push(directory);
15+
return directory;
16+
}
17+
18+
afterEach(async () => {
19+
Object.assign(installerSource, originalSource);
20+
vi.unstubAllGlobals();
21+
await Promise.all(directories.splice(0).map((directory) => rm(directory, { recursive: true })));
22+
});
23+
24+
describe('published installer', () => {
25+
it('pins a release tag and checksum', () => {
26+
expect(installerSource.release).toMatch(/^v\d/);
27+
expect(installerSource.sha256).toMatch(/^[a-f0-9]{64}$/);
28+
});
29+
30+
it('publishes the verified bytes without changing the execution barrier', async () => {
31+
installerSource.release = 'v9.9-0';
32+
installerSource.sha256 = createHash('sha256').update(script).digest('hex');
33+
const download = vi.fn().mockResolvedValue(new Response(script));
34+
vi.stubGlobal('fetch', download);
35+
const directory = await outputDirectory();
36+
await publishInstaller(directory);
37+
expect(await readFile(path.join(directory, 'install.sh'), 'utf8')).toBe(script);
38+
expect(download.mock.calls[0][0]).toBe(
39+
'https://github.com/documentdb/documentdb/releases/download/v9.9-0/install.sh',
40+
);
41+
});
42+
43+
it.each(['HTTP error', 'checksum mismatch', 'network error'])('refuses %s without publishing', async (failure) => {
44+
installerSource.release = 'v9.9-0';
45+
installerSource.sha256 = '0'.repeat(64);
46+
const download = vi.fn();
47+
if (failure === 'network error') {
48+
download.mockRejectedValue(new Error('network error'));
49+
} else {
50+
download.mockResolvedValue(new Response(script, { status: failure === 'HTTP error' ? 404 : 200 }));
51+
}
52+
vi.stubGlobal('fetch', download);
53+
const directory = await outputDirectory();
54+
await expect(publishInstaller(directory)).rejects.toThrow();
55+
await expect(readFile(path.join(directory, 'install.sh'))).rejects.toThrow();
56+
});
57+
58+
it('rejects a moving source reference before downloading', async () => {
59+
installerSource.release = 'latest';
60+
const download = vi.fn();
61+
vi.stubGlobal('fetch', download);
62+
await expect(publishInstaller(await outputDirectory())).rejects.toThrow('release tag');
63+
expect(download).not.toHaveBeenCalled();
64+
});
65+
});

0 commit comments

Comments
 (0)