Skip to content

Commit 135097e

Browse files
Fix Linux package install guide and Package Finder (#73)
* docs: correct package install guidance Align package docs with the published extension packages and source packaging behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Guanzhou Song <guanzhousong@microsoft.com> * Correct Package Install * docs: warn about DEBIAN_FRONTEND tzdata hang and TERM tput abort in package install flow Two high-severity gaps that block new users following /packages and /docs/getting-started/packages in a clean Docker container: 1. apt install hangs on the tzdata postinst prompt when the docs recommend omitting sudo for a clean root container, because the default front-end is interactive. Users are stuck with no visible error. 2. ./scripts/build_and_start_gateway.sh calls tput setaf under set -e -u. In any non-TTY context (docker exec without -t, docker exec -d, nohup, background &, CI) tput aborts the script before the build starts. The error message and absence of any build output make this look like a silent build failure. Verified end-to-end with the new wording in a fresh Ubuntu 22.04 amd64 container (PG 16): apt install completes, gateway builds, and mongosh connects to DocumentDB v0.110-0. Edits: - app/services/articleService.ts: expand the clean-container note, add 'export TERM=xterm' to the host gateway example with a precise comment explaining when to skip it, add an expectation-setter for first-build time, and add two troubleshooting bullets covering both failure modes. - app/packages/page.tsx: APT-only inline tip directing root-container users to run 'export DEBIAN_FRONTEND=noninteractive' as a separate step before the chained apt command (a single-command prefix would not cover the second 'apt install' in the chain). - PACKAGE-INSTALL.md: mirror the same wording so the spec mirror stays in sync with the rendered guide. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: Guanzhou Song <guanzhousong@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 64e020c commit 135097e

4 files changed

Lines changed: 259 additions & 97 deletions

File tree

‎PACKAGE-INSTALL.md‎

Lines changed: 102 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
# DocumentDB Package Installation
22

3-
Verified installation commands for the DocumentDB PostgreSQL extension.
3+
Repository-backed installation commands for the DocumentDB PostgreSQL extension package.
44

5-
## What was validated
5+
## What is published
66

7-
- Repository-backed installs were exercised in Docker on Ubuntu 22.04, Ubuntu 24.04, Debian 11, Debian 12, Rocky Linux 8, and Rocky Linux 9.
8-
- Both `amd64`/`x86_64` and `arm64`/`aarch64` variants were checked.
9-
- PostgreSQL package variants `16`, `17`, and `18` were resolved successfully for the supported repository-backed combinations, with one exception: Debian 11 currently resolves PostgreSQL `16` and `17` only.
7+
- Repository-backed extension packages are published for Ubuntu 22.04, Ubuntu 24.04, Debian 11, Debian 12, Debian 13, RHEL-compatible 8, and RHEL-compatible 9 targets.
8+
- Both `amd64`/`x86_64` and `arm64`/`aarch64` variants are published.
9+
- PostgreSQL package variants `16`, `17`, and `18` are published for the supported repository-backed combinations, with one exception: Debian 11 currently resolves PostgreSQL `16` and `17` only.
1010
- Debian 13 `.deb` assets are published on GitHub Releases, and the APT repository now publishes a `deb13` component for repository-backed installs.
11+
- The published package repository installs the PostgreSQL extension package. It does not currently publish a gateway package, setup helper, or systemd service in either the repository-backed install flow or GitHub Releases.
1112

1213
## Supported PostgreSQL Versions
1314

1415
- Ubuntu 22.04 / 24.04: 16, 17, 18
1516
- Debian 11: 16, 17
1617
- Debian 12: 16, 17, 18
1718
- Debian 13: 16, 17, 18
18-
- RHEL-family 8 / 9: 16, 17, 18
19+
- RHEL-compatible 8 / 9: 16, 17, 18
1920

2021
## Repository-backed package installs
2122

22-
These commands install the required PostgreSQL upstream repositories first, then add the DocumentDB package repository, and finally install the DocumentDB extension package.
23+
These commands install the required PostgreSQL upstream repositories first, then add the DocumentDB package repository, and finally install the DocumentDB PostgreSQL extension package.
24+
25+
> These commands assume a regular Linux host where you use `sudo`. If you are testing in a clean container that already runs as `root`, omit `sudo` from the package-install commands.
26+
>
27+
> On Debian and Ubuntu in a clean container, also run `export DEBIAN_FRONTEND=noninteractive` in the shell before the APT commands. Without it, `tzdata` (and a few other packages) prompt for input during `apt install` and the install hangs with no visible error.
2328
2429
### Ubuntu 22.04 (Jammy)
2530

@@ -86,7 +91,7 @@ sudo apt update && \
8691
sudo apt install -y postgresql-16-documentdb
8792
```
8893

89-
### RHEL / Rocky / AlmaLinux / CentOS Stream 8
94+
### RHEL-compatible 8
9095

9196
```bash
9297
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \
@@ -107,7 +112,7 @@ printf '%s\n' \
107112
sudo dnf install -y postgresql16-documentdb
108113
```
109114

110-
### RHEL / Rocky / AlmaLinux / CentOS Stream 9
115+
### RHEL-compatible 9
111116

112117
```bash
113118
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
@@ -155,9 +160,94 @@ dnf --showduplicates list postgresql16-documentdb
155160
sudo dnf install postgresql16-documentdb-<VERSION>
156161
```
157162

163+
## From package install to a local `mongosh` endpoint
164+
165+
The repository-backed install gives you the PostgreSQL extension package. To expose a local MongoDB-compatible endpoint on the same host, run PostgreSQL and the gateway from the source repository against the packaged extension files.
166+
167+
### Prerequisites
168+
169+
- `git`
170+
- `curl`
171+
- Native build tools for Rust crates that link against OpenSSL
172+
- A current Rust toolchain via `rustup`
173+
- `mongosh`
174+
175+
> Run the PostgreSQL and gateway steps from an unprivileged user account, not `root`. PostgreSQL will not initialize as `root`.
176+
>
177+
> If you are following these steps in a clean container that starts as `root`, finish the package-install commands as `root`, then switch to an unprivileged account such as `postgres` before you start PostgreSQL or the gateway.
178+
179+
```bash
180+
# from a root shell inside the container
181+
su - postgres
182+
```
183+
184+
Example package-manager installs:
185+
186+
```bash
187+
# Debian / Ubuntu
188+
sudo apt install -y git curl build-essential pkg-config libssl-dev
189+
190+
# RHEL-compatible
191+
sudo dnf install -y git curl gcc gcc-c++ make pkgconf-pkg-config openssl-devel
192+
```
193+
194+
Install a current Rust toolchain with `rustup`, then load it into your shell:
195+
196+
```bash
197+
curl https://sh.rustup.rs -sSf | sh -s -- -y
198+
. "$HOME/.cargo/env"
199+
```
200+
201+
In a clean container that starts as `root`, install the system packages above and install `mongosh` while you are still `root`. Then switch to the unprivileged user and run the `rustup` commands plus the remaining gateway steps from that user's shell.
202+
203+
### Example host flow
204+
205+
Replace `<PG_MAJOR>` with the PostgreSQL major version you installed from the package repository, such as `16`, `17`, or `18`.
206+
207+
If you do not already have `mongosh`, install it with the official MongoDB shell instructions for your distro before continuing:
208+
209+
- https://www.mongodb.com/docs/mongodb-shell/install/
210+
211+
```bash
212+
git clone https://github.com/documentdb/documentdb.git
213+
cd documentdb
214+
215+
export PG_VERSION_USED=<PG_MAJOR>
216+
217+
# Required in non-interactive shells (CI, `docker exec` without `-t`,
218+
# `docker exec -d`, `nohup`, background `&`). build_and_start_gateway.sh
219+
# calls `tput` for colored output and aborts under `set -u` / `set -e` if
220+
# TERM is unset or set to `dumb`. Skip this line in a normal interactive
221+
# terminal where TERM is already `xterm`, `xterm-256color`, etc.
222+
export TERM=xterm
223+
224+
./scripts/start_oss_server.sh -c -u <YOUR_USERNAME> -a <YOUR_PASSWORD>
225+
226+
./scripts/build_and_start_gateway.sh -c \
227+
-u <YOUR_USERNAME> \
228+
-p <YOUR_PASSWORD> \
229+
-P 9712
230+
```
231+
232+
- `./scripts/start_oss_server.sh -c` initializes a fresh local PostgreSQL data directory under `~/.documentdb/data`.
233+
- `./scripts/build_and_start_gateway.sh -c` forces a clean gateway rebuild; after the first successful build, you can omit `-c` on later restarts.
234+
- Keep the gateway command running in the foreground. It listens on port `10260` and connects to PostgreSQL on port `9712`.
235+
- The first gateway build downloads several hundred Rust crates and typically takes a few minutes before the gateway begins listening on port `10260`. Subsequent runs without `-c` are much faster.
236+
237+
Then connect with `mongosh`:
238+
239+
```bash
240+
mongosh localhost:10260 \
241+
-u <YOUR_USERNAME> \
242+
-p <YOUR_PASSWORD> \
243+
--authenticationMechanism SCRAM-SHA-256 \
244+
--tls \
245+
--tlsAllowInvalidCertificates
246+
```
247+
158248
## Direct downloads
159249

160-
GitHub Releases contains `.deb` and `.rpm` assets for every published combination, including Debian 13 release assets.
250+
GitHub Releases contains `.deb` and `.rpm` extension assets for every published combination, including Debian 13 release assets. It does not currently publish a gateway package.
161251

162252
Examples:
163253

@@ -174,4 +264,5 @@ rhel9-postgresql18-documentdb-0.110.0-1.el9.x86_64.rpm
174264

175265
- The APT repository currently publishes components for `ubuntu22`, `ubuntu24`, `deb11`, `deb12`, and `deb13`.
176266
- Debian 11 PostgreSQL 18 assets exist, but the upstream Bullseye PostGIS dependency is not currently installable from PGDG.
177-
- The RPM flow depends on EPEL plus PostgreSQL's upstream RPM repository because DocumentDB depends on PostgreSQL, `pg_cron`, `pgvector`, PostGIS, and `rum`.
267+
- 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 16/17.
268+
- On Debian/Ubuntu, the distro-packaged `cargo` can be older than the current gateway workspace lockfile. `rustup` avoids that mismatch.

‎app/lib/packageInstall.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const aptTargetLabels: Record<AptDistro, string> = {
1414
};
1515

1616
export const rpmTargetLabels: Record<RpmDistro, string> = {
17-
rhel8: "RHEL 8 / Rocky 8 / AlmaLinux 8 / CentOS Stream 8",
18-
rhel9: "RHEL 9 / Rocky 9 / AlmaLinux 9 / CentOS Stream 9",
17+
rhel8: "RHEL-compatible 8 (tested on Rocky Linux 8)",
18+
rhel9: "RHEL-compatible 9 (tested on Rocky Linux 9)",
1919
};
2020

2121
export const aptTargetPgVersions: Record<AptDistro, AptPgVersion[]> = {
@@ -53,7 +53,7 @@ echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.
5353
curl -fsSL https://documentdb.io/documentdb-archive-keyring.gpg | sudo gpg --dearmor --yes -o /usr/share/keyrings/documentdb-archive-keyring.gpg && \\
5454
echo "deb [arch=${aptArch} signed-by=/usr/share/keyrings/documentdb-archive-keyring.gpg] https://documentdb.io/deb stable ${aptTarget}" | sudo tee /etc/apt/sources.list.d/documentdb.list >/dev/null && \\
5555
sudo apt update && \\
56-
sudo apt install -y postgresql-${aptPgVersion}-documentdb documentdb_gateway`;
56+
sudo apt install -y postgresql-${aptPgVersion}-documentdb`;
5757
}
5858

5959
export function buildRpmInstallCommand(
@@ -78,5 +78,5 @@ printf '%s\\n' \\
7878
'enabled=1' \\
7979
'gpgcheck=1' \\
8080
'gpgkey=https://documentdb.io/documentdb-archive-keyring.gpg' | sudo tee /etc/yum.repos.d/documentdb.repo >/dev/null && \\
81-
sudo dnf install -y postgresql${rpmPgVersion}-documentdb documentdb-gateway`;
81+
sudo dnf install -y postgresql${rpmPgVersion}-documentdb`;
8282
}

‎app/packages/page.tsx‎

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,11 @@ export default function PackagesPage() {
7979
const rpmCommand = buildRpmInstallCommand(rpmTarget, rpmArch, rpmPgVersion);
8080
const selectedPackageNames =
8181
packageFamily === "apt"
82-
? `postgresql-${aptPgVersion}-documentdb + documentdb_gateway`
83-
: `postgresql${rpmPgVersion}-documentdb + documentdb-gateway`;
82+
? `postgresql-${aptPgVersion}-documentdb`
83+
: `postgresql${rpmPgVersion}-documentdb`;
8484
const selectedTargetText =
8585
packageFamily === "apt" ? aptTargetLabels[aptTarget] : rpmTargetLabels[rpmTarget];
8686
const selectedArchText = packageFamily === "apt" ? aptArch : rpmArch;
87-
const selectedPgVersion = packageFamily === "apt" ? aptPgVersion : rpmPgVersion;
88-
const setupCommand = `sudo documentdb-setup \\
89-
--username <YOUR_USERNAME> \\
90-
--password <YOUR_PASSWORD> \\
91-
--pg-version ${selectedPgVersion} \\
92-
--load-sample-data`;
9387

9488
return (
9589
<div className="min-h-screen bg-neutral-900 py-12">
@@ -99,9 +93,9 @@ export default function PackagesPage() {
9993
Download DocumentDB
10094
</h1>
10195
<p className="mx-auto max-w-3xl text-lg text-gray-300">
102-
Choose Docker for the fastest local setup, or Linux packages for managed host
103-
installations. The generated package commands configure the PostgreSQL
104-
dependency repositories and install the packages required by DocumentDB.
96+
Choose Docker for the fastest local setup, or Linux packages for PostgreSQL
97+
extension installs. The generated package commands configure the PostgreSQL
98+
dependency repositories and install the DocumentDB extension package.
10599
</p>
106100
<div className="mt-4 flex flex-wrap justify-center gap-3 text-sm">
107101
<span className="rounded-full border border-green-500/30 bg-green-500/20 px-3 py-1 text-green-300">
@@ -287,21 +281,30 @@ export default function PackagesPage() {
287281
The generated command adds the PostgreSQL upstream repositories that provide
288282
PostgreSQL, <code className="text-gray-300">pg_cron</code>,{" "}
289283
<code className="text-gray-300">pgvector</code>, PostGIS, and{" "}
290-
<code className="text-gray-300">rum</code>.
284+
<code className="text-gray-300">rum</code> for PostgreSQL 16/17.
291285
</p>
292286
<p className="mt-2 text-sm text-gray-400">
293-
It also installs the PostgreSQL extension package plus the gateway package
294-
required for MongoDB-compatible connections on port 10260.
287+
It installs the PostgreSQL extension package. The published package repository
288+
does not currently include a gateway package, setup helper, or systemd service.
295289
</p>
290+
{packageFamily === "apt" ? (
291+
<p className="mt-2 text-sm text-gray-400">
292+
Running in a clean Debian/Ubuntu container as <code className="text-gray-300">root</code>?
293+
Run <code className="text-gray-300">export DEBIAN_FRONTEND=noninteractive</code> in the shell first
294+
(and omit <code className="text-gray-300">sudo</code> from the command above).
295+
Without it, <code className="text-gray-300">tzdata</code> prompts for input partway through
296+
and the install hangs with no visible error.
297+
</p>
298+
) : null}
296299
<div className="mt-4 rounded-lg border border-neutral-700 bg-neutral-900/60 p-4">
297300
<p className="mb-3 text-sm font-semibold text-white">
298-
Then initialize and start DocumentDB
301+
Need the MongoDB-compatible gateway?
299302
</p>
300-
<CommandSnippet command={setupCommand} label="Setup" />
301303
<p className="mt-3 text-sm text-gray-400">
302-
Use <code className="text-gray-300">--skip-pg-init</code> and{" "}
303-
<code className="text-gray-300">--pg-port</code> if you want to attach
304-
DocumentDB to an existing PostgreSQL cluster instead of creating a new one.
304+
Use the Docker image for the fastest gateway-backed local setup. If you want a
305+
package-backed host install that still works with <code className="text-gray-300">mongosh</code>,
306+
the Linux package guide includes the exact non-root gateway follow-up commands
307+
and host build prerequisites.
305308
</p>
306309
</div>
307310
{packageFamily === "apt" ? (
@@ -351,7 +354,7 @@ export default function PackagesPage() {
351354
<tr>
352355
<td className="px-3 py-3 font-semibold text-red-300">RPM</td>
353356
<td className="px-3 py-3">
354-
RHEL 8/9, Rocky, AlmaLinux, CentOS Stream
357+
RHEL-compatible 8/9 (tested on Rocky Linux)
355358
</td>
356359
<td className="px-3 py-3">x86_64, aarch64</td>
357360
<td className="px-3 py-3">16, 17, 18</td>
@@ -463,19 +466,13 @@ export default function PackagesPage() {
463466
<div className="rounded-md border border-neutral-700 bg-black p-3">
464467
<code className="text-xs text-green-400 sm:text-sm">
465468
sudo apt update && apt search documentdb && apt-cache policy
466-
postgresql-16-documentdb documentdb_gateway
469+
postgresql-16-documentdb
467470
</code>
468471
</div>
469472
<div className="rounded-md border border-neutral-700 bg-black p-3">
470473
<code className="text-xs text-green-400 sm:text-sm">
471474
sudo dnf clean all && dnf search documentdb && rpm -qi
472-
postgresql16-documentdb documentdb-gateway
473-
</code>
474-
</div>
475-
<div className="rounded-md border border-neutral-700 bg-black p-3">
476-
<code className="text-xs text-green-400 sm:text-sm">
477-
sudo systemctl status documentdb-gateway --no-pager && sudo journalctl -u
478-
documentdb-gateway --no-pager -n 20
475+
postgresql16-documentdb
479476
</code>
480477
</div>
481478
</div>
@@ -488,9 +485,10 @@ export default function PackagesPage() {
488485
3. Connect and try it
489486
</h2>
490487
<p className="text-sm leading-6 text-gray-400">
491-
After you run <code className="text-gray-300">documentdb-setup</code> and the
492-
gateway is listening on port 10260, follow one of these guides to make your first
493-
connection.
488+
Docker starts a gateway-backed local endpoint on port 10260. Linux packages install
489+
the PostgreSQL extension; the Linux package guide adds the extra source-gateway
490+
steps needed when you want a host install that still exposes a MongoDB-compatible
491+
endpoint.
494492
</p>
495493
</div>
496494

0 commit comments

Comments
 (0)