Skip to content

Ship scripts and sample-data in gateway packages (DEB + RPM) #563

@guanzhousongmicrosoft

Description

@guanzhousongmicrosoft

Parent Issue

Part of #561 (Make DocumentDB usable from package install)

Problem

The gateway package currently ships only the binary, config, and systemd unit. The documentdb-setup CLI (#562) and the Docker emulator entrypoint both depend on helper scripts (utils.sh, start_oss_server.sh, emulator_entrypoint.sh, etc.) and sample data files. Without these, neither the setup CLI nor the Docker image can function from package-installed paths.

Solution

Include the following in gateway packages at standardized paths:

Scripts (/usr/share/documentdb/scripts/)

  • documentdb-setup.sh -> installed as /usr/bin/documentdb-setup (755)
  • utils.sh
  • start_oss_server.sh
  • build_and_start_gateway.sh
  • emulator_entrypoint.sh
  • init_documentdb_data.sh
  • setup_psqlrc.sh

Sample Data (/usr/share/documentdb/sample-data/)

  • 01-users.js
  • 02-products.js
  • 03-orders.js
  • 04-analytics.js
  • README.md

Changes

DEB (pg_documentdb_gw/documentdb_gateway/Cargo.toml):

  • Add 13 asset entries under [package.metadata.deb]
  • Add depends = ["jq"] (required by documentdb-setup)
  • Update maintainer-scripts/postinst with quick-start hint

RPM (packaging/rpm/spec/documentdb_gateway.spec):

  • Add Requires: jq
  • Add %install commands to copy scripts + sample-data
  • Add %files entries for the new paths

Runtime Dependency

jq is required by documentdb-setup for safe JSON construction (SQL injection prevention via jq -n --arg). Added as a package dependency so dpkg -i / rpm -i will flag it.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status
No status
Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions