From 769a21a76621aad5ee07e9db0246153d1d9888ef Mon Sep 17 00:00:00 2001 From: Shuai Tian Date: Wed, 29 Oct 2025 10:21:23 +0000 Subject: [PATCH 1/4] Add APT/YUM package repository support - Add workflow to build full APT and YUM repositories from latest documentdb/documentdb release - Create package browser page with setup instructions - Add Packages link to navbar and homepage - Include setup scripts for easy repository installation - Support GPG signing for packages (optional) - Download packages including pre-releases - Build proper debian and RPM repository metadata --- .github/scripts/download_packages.sh | 541 +++++++++++++++++++++++++++ .github/scripts/setup-apt.sh | 28 ++ .github/scripts/setup-yum.sh | 28 ++ .github/workflows/nextjs.yml | 27 +- PACKAGES.md | 61 +++ app/components/Navbar.tsx | 6 + app/packages/page.tsx | 194 ++++++++++ app/page.tsx | 9 + 8 files changed, 889 insertions(+), 5 deletions(-) create mode 100755 .github/scripts/download_packages.sh create mode 100755 .github/scripts/setup-apt.sh create mode 100755 .github/scripts/setup-yum.sh create mode 100644 PACKAGES.md create mode 100644 app/packages/page.tsx diff --git a/.github/scripts/download_packages.sh b/.github/scripts/download_packages.sh new file mode 100755 index 0000000..c3b901a --- /dev/null +++ b/.github/scripts/download_packages.sh @@ -0,0 +1,541 @@ +#!/bin/bash +set -e + +# Repository to download packages from +REPO="documentdb/documentdb" + +# Repository configuration +SUITE="${SUITE:-stable}" +COMPONENTS="${COMPONENTS:-main}" +ORIGIN="${ORIGIN:-DocumentDB}" +DESCRIPTION="${DESCRIPTION:-DocumentDB APT and YUM Repository}" + +GOT_DEB=0 +GOT_RPM=0 +DEB_POOL="out/deb/pool/${COMPONENTS}" +DEB_DISTS="dists/${SUITE}" +DEB_DISTS_COMPONENTS="${DEB_DISTS}/${COMPONENTS}/binary-amd64" +GPG_TTY="" +export GPG_TTY + +generate_hashes() { + HASH_TYPE="$1" + HASH_COMMAND="$2" + echo "${HASH_TYPE}:" + find "${COMPONENTS}" -type f | while read -r file + do + echo " $(${HASH_COMMAND} "$file" | cut -d" " -f1) $(wc -c "$file" | awk '{print $1}')" + done +} + +echo "Downloading packages from $REPO releases" + +# Get the latest release info (including pre-releases) +if release=$(curl -fqs "https://api.github.com/repos/${REPO}/releases" | python3 -c "import sys, json; releases = json.load(sys.stdin); print(json.dumps(releases[0])) if releases else sys.exit(1)") +then + tag="$(echo "$release" | python3 -c "import sys, json; print(json.load(sys.stdin)['tag_name'])")" + echo "Found latest release: $tag" + + # Create packages directory for direct downloads + mkdir -p out/packages + + # Process each asset + echo "$release" | python3 -c " +import sys, json +data = json.load(sys.stdin) +for asset in data.get('assets', []): + print(f\"{asset['name']}|{asset['browser_download_url']}\") +" | while IFS='|' read -r filename download_url + do + if [ -z "$filename" ]; then + continue + fi + + echo "Processing: $filename" + + # Determine file type and handle accordingly + if [[ "$filename" == *.deb ]]; then + GOT_DEB=1 + mkdir -p "$DEB_POOL" + echo " Downloading DEB package to pool" + wget -q -P "$DEB_POOL" "$download_url" + # Also copy to packages for direct download + cp "$DEB_POOL/$filename" out/packages/ + elif [[ "$filename" == *.rpm ]]; then + GOT_RPM=1 + mkdir -p out/rpm + echo " Downloading RPM package" + wget -q -P out/rpm "$download_url" + # Also copy to packages for direct download + cp "out/rpm/$filename" out/packages/ + else + # Other files go directly to packages + echo " Downloading to packages directory" + wget -q -P out/packages "$download_url" + fi + done + + # Save release metadata + echo "$release" | python3 -c " +import sys, json +data = json.load(sys.stdin) +output = { + 'tag_name': data['tag_name'], + 'name': data.get('name', data['tag_name']), + 'published_at': data['published_at'], + 'html_url': data['html_url'], + 'assets': [{ + 'name': asset['name'], + 'browser_download_url': asset['browser_download_url'], + 'size': asset['size'], + 'download_count': asset.get('download_count', 0) + } for asset in data.get('assets', [])] +} +print(json.dumps(output, indent=2)) +" > out/packages/release-info.json + + echo "Successfully processed packages from $REPO" +else + echo "Error: Could not fetch release information for $REPO" + exit 1 +fi + +# Build DEB repository if we have DEB packages +if [ -d "$DEB_POOL" ] && [ "$(ls -A $DEB_POOL/*.deb 2>/dev/null)" ]; then + echo "Building APT repository..." + pushd out/deb >/dev/null + + mkdir -p "${DEB_DISTS_COMPONENTS}" + + echo "Scanning DEB packages and creating Packages file" + dpkg-scanpackages --arch amd64 pool/ > "${DEB_DISTS_COMPONENTS}/Packages" + gzip -k -f "${DEB_DISTS_COMPONENTS}/Packages" + + pushd "${DEB_DISTS}" >/dev/null + + echo "Creating Release file" + { + echo "Origin: ${ORIGIN}" + echo "Label: DocumentDB" + echo "Suite: ${SUITE}" + echo "Codename: ${SUITE}" + echo "Version: 1.0" + echo "Architectures: amd64" + echo "Components: ${COMPONENTS}" + echo "Description: ${DESCRIPTION}" + echo "Date: $(date -Ru)" + generate_hashes MD5Sum md5sum + generate_hashes SHA1 sha1sum + generate_hashes SHA256 sha256sum + } > Release + + # Sign if GPG is available + if [ -n "$GPG_FINGERPRINT" ]; then + echo "Signing Release file with GPG" + gpg --default-key "$GPG_FINGERPRINT" --detach-sign --armor -o Release.gpg Release + gpg --default-key "$GPG_FINGERPRINT" --clearsign -o InRelease Release + else + echo "Warning: GPG_FINGERPRINT not set, skipping package signing" + fi + + popd >/dev/null + popd >/dev/null + echo "APT repository built successfully" +fi + +# Build RPM repository if we have RPM packages +if [ -d "out/rpm" ] && [ "$(ls -A out/rpm/*.rpm 2>/dev/null)" ]; then + echo "Building YUM repository..." + pushd out/rpm >/dev/null + + # Sign RPMs if GPG is available + if [ -n "$GPG_FINGERPRINT" ]; then + echo "Signing RPM packages" + for rpm_file in *.rpm; do + rpm --define "%_signature gpg" --define "%_gpg_name ${GPG_FINGERPRINT}" --addsign "$rpm_file" || echo "Warning: Could not sign $rpm_file" + done + fi + + echo "Creating YUM repository metadata" + createrepo_c . + + # Sign repository metadata if GPG is available + if [ -n "$GPG_FINGERPRINT" ]; then + echo "Signing repository metadata" + gpg --default-key "$GPG_FINGERPRINT" --detach-sign --armor repodata/repomd.xml + fi + + popd >/dev/null + echo "YUM repository built successfully" +fi + +# Create comprehensive index page +cat > out/packages/index.html << 'HTMLEOF' + + + + + + DocumentDB Package Repository + + + +
+

📦 DocumentDB Package Repository

+

Official APT and YUM repositories for DocumentDB

+
+ +
+
+

Loading release information...

+
+ +
+

Quick Setup

+
+ + +
+ +
+

For Debian/Ubuntu Systems

+
+ # Add the repository + echo "deb [arch=amd64] https://documentdb.github.io/deb stable main" | sudo tee /etc/apt/sources.list.d/documentdb.list + + # Update and install + sudo apt-get update + sudo apt-get install documentdb +
+

Or use our setup script:

+
+ curl -sSL https://documentdb.github.io/setup-apt.sh | sudo bash +
+
+ +
+

For RHEL/CentOS/Fedora Systems

+
+ # Add the repository + sudo tee /etc/yum.repos.d/documentdb.repo <<EOF + [documentdb] + name=DocumentDB Repository + baseurl=https://documentdb.github.io/rpm + enabled=1 + gpgcheck=0 + EOF + + # Install + sudo yum install documentdb +
+

Or use our setup script:

+
+ curl -sSL https://documentdb.github.io/setup-yum.sh | sudo bash +
+
+
+ +
+

Direct Downloads

+
    +
  • Loading packages...
  • +
+
+ +
+

Repository URLs

+
    +
  • APT Repository: https://documentdb.github.io/deb
  • +
  • YUM Repository: https://documentdb.github.io/rpm
  • +
  • Metadata: release-info.json
  • +
+
+
+ + + + +HTMLEOF + +echo "Package repository setup complete!" +echo "" +echo "Repository structure:" +ls -lh out/ + +# Copy setup scripts to the root of out directory for easy access +echo "" +echo "Copying setup scripts..." +cp .github/scripts/setup-apt.sh out/ +cp .github/scripts/setup-yum.sh out/ +echo "Setup scripts copied to root" + +# Create an index file for the packages +cat > out/packages/index.html << 'EOF' + + + + + + DocumentDB Packages + + + +

DocumentDB Packages

+
+

Loading release information...

+
+ + + + + +EOF + +echo "Package download complete!" +ls -lh out/packages/ diff --git a/.github/scripts/setup-apt.sh b/.github/scripts/setup-apt.sh new file mode 100755 index 0000000..2ff85b4 --- /dev/null +++ b/.github/scripts/setup-apt.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# DocumentDB APT Repository Setup Script + +set -e + +REPO_URL="https://documentdb.github.io/deb" +SUITE="stable" +COMPONENT="main" +LIST_FILE="/etc/apt/sources.list.d/documentdb.list" + +echo "Setting up DocumentDB APT repository..." + +# Add repository to sources list +echo "deb [arch=amd64] $REPO_URL $SUITE $COMPONENT" | sudo tee $LIST_FILE + +# Note: If GPG key is available, download it +# Uncomment the following lines once GPG key is published +# echo "Importing GPG key..." +# wget -qO - https://documentdb.github.io/gpg-key.asc | sudo apt-key add - + +echo "Updating package list..." +sudo apt-get update + +echo "" +echo "✓ DocumentDB repository has been added!" +echo "" +echo "You can now install DocumentDB with:" +echo " sudo apt-get install documentdb" diff --git a/.github/scripts/setup-yum.sh b/.github/scripts/setup-yum.sh new file mode 100755 index 0000000..1d941a9 --- /dev/null +++ b/.github/scripts/setup-yum.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# DocumentDB YUM Repository Setup Script + +set -e + +REPO_FILE="/etc/yum.repos.d/documentdb.repo" + +echo "Setting up DocumentDB YUM repository..." + +# Create repository configuration +sudo tee $REPO_FILE > /dev/null <> $GITHUB_ENV + echo "✓ GPG key loaded: ${{ steps.import_gpg.outputs.fingerprint }}" + else + echo "⚠ No GPG key configured - packages will not be signed" + fi - name: Detect package manager id: detect-package-manager run: | @@ -75,6 +90,8 @@ jobs: run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} - name: Build with Next.js run: ${{ steps.detect-package-manager.outputs.runner }} next build + - name: Download DocumentDB packages from latest release + run: .github/scripts/download_packages.sh - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/PACKAGES.md b/PACKAGES.md new file mode 100644 index 0000000..ff827c0 --- /dev/null +++ b/PACKAGES.md @@ -0,0 +1,61 @@ +# DocumentDB Package Repository + +This site hosts APT and YUM repositories for DocumentDB packages. + +## Quick Installation + +### Debian/Ubuntu +```bash +curl -sSL https://documentdb.github.io/setup-apt.sh | sudo bash +sudo apt-get install documentdb +``` + +### RHEL/CentOS/Fedora +```bash +curl -sSL https://documentdb.github.io/setup-yum.sh | sudo bash +sudo yum install documentdb # or dnf +``` + +## Manual Setup + +### APT Repository (Debian/Ubuntu) +```bash +echo "deb [arch=amd64] https://documentdb.github.io/deb stable main" | \ + sudo tee /etc/apt/sources.list.d/documentdb.list +sudo apt-get update +sudo apt-get install documentdb +``` + +### YUM Repository (RHEL/CentOS/Fedora) +```bash +sudo tee /etc/yum.repos.d/documentdb.repo < Docs + + Packages + +
+ {/* Header */} +
+

+ 📦 DocumentDB Package Repository +

+

+ Official APT and YUM repositories for DocumentDB packages +

+
+ + {/* Quick Install Cards */} +
+ {/* Debian/Ubuntu Card */} +
+
+
+ + + +
+

Debian/Ubuntu

+
+
+ + curl -sSL https://documentdb.github.io/setup-apt.sh | sudo bash +
+ sudo apt-get install documentdb +
+
+ + View setup script → + +
+ + {/* RHEL/CentOS/Fedora Card */} +
+
+
+ + + +
+

RHEL/CentOS/Fedora

+
+
+ + curl -sSL https://documentdb.github.io/setup-yum.sh | sudo bash +
+ sudo yum install documentdb +
+
+ + View setup script → + +
+
+ + {/* Manual Setup Section */} +
+

Manual Setup

+ + {/* APT Manual Setup */} +
+

+ APT Repository (Debian/Ubuntu) +

+
+
+                {`echo "deb [arch=amd64] https://documentdb.github.io/deb stable main" | \\
+  sudo tee /etc/apt/sources.list.d/documentdb.list
+sudo apt-get update
+sudo apt-get install documentdb`}
+              
+
+
+ + {/* YUM Manual Setup */} +
+

+ YUM Repository (RHEL/CentOS/Fedora) +

+
+
+                {`sudo tee /etc/yum.repos.d/documentdb.repo <
+              
+
+
+
+ + {/* Direct Downloads */} +
+

Direct Downloads

+

+ Browse and download packages directly without adding the repository. +

+ + + + + Browse All Packages + +
+ + {/* Repository Information */} +
+

Repository Information

+
    +
  • + • +
    + APT Repository:{" "} + + https://documentdb.github.io/deb + +
    +
  • +
  • + • +
    + YUM Repository:{" "} + + https://documentdb.github.io/rpm + +
    +
  • +
  • + • + +
  • +
+
+ + {/* Updates Info */} +
+

📢 Automatic Updates

+

+ The repository is automatically updated whenever a new release is published in the{" "} + + documentdb/documentdb + {" "} + repository. +

+

+ For more information about DocumentDB, visit the{" "} + + main site + {" "} + or check out the{" "} + + documentation + + . +

+
+
+ + ); +} diff --git a/app/page.tsx b/app/page.tsx index 21a3199..0bbd13b 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -21,6 +21,15 @@ export default function Home() { > Get Started + + + + + Download Packages + Date: Wed, 29 Oct 2025 11:35:24 +0000 Subject: [PATCH 2/4] make it more clear --- .github/scripts/download_packages.sh | 360 --------------------------- .github/scripts/setup-apt.sh | 28 --- .github/scripts/setup-yum.sh | 28 --- app/packages/page.tsx | 40 +-- 4 files changed, 26 insertions(+), 430 deletions(-) delete mode 100755 .github/scripts/setup-apt.sh delete mode 100755 .github/scripts/setup-yum.sh diff --git a/.github/scripts/download_packages.sh b/.github/scripts/download_packages.sh index c3b901a..79af6a3 100755 --- a/.github/scripts/download_packages.sh +++ b/.github/scripts/download_packages.sh @@ -169,373 +169,13 @@ if [ -d "out/rpm" ] && [ "$(ls -A out/rpm/*.rpm 2>/dev/null)" ]; then echo "YUM repository built successfully" fi -# Create comprehensive index page -cat > out/packages/index.html << 'HTMLEOF' - - - - - - DocumentDB Package Repository - - - -
-

📦 DocumentDB Package Repository

-

Official APT and YUM repositories for DocumentDB

-
- -
- - - - -HTMLEOF echo "Package repository setup complete!" echo "" echo "Repository structure:" ls -lh out/ -# Copy setup scripts to the root of out directory for easy access -echo "" -echo "Copying setup scripts..." -cp .github/scripts/setup-apt.sh out/ -cp .github/scripts/setup-yum.sh out/ -echo "Setup scripts copied to root" - # Create an index file for the packages -cat > out/packages/index.html << 'EOF' - - - - - - DocumentDB Packages - - - -

DocumentDB Packages

-
-

Loading release information...

-
-
    -
  • Loading packages...
  • -
- - - - -EOF echo "Package download complete!" ls -lh out/packages/ diff --git a/.github/scripts/setup-apt.sh b/.github/scripts/setup-apt.sh deleted file mode 100755 index 2ff85b4..0000000 --- a/.github/scripts/setup-apt.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# DocumentDB APT Repository Setup Script - -set -e - -REPO_URL="https://documentdb.github.io/deb" -SUITE="stable" -COMPONENT="main" -LIST_FILE="/etc/apt/sources.list.d/documentdb.list" - -echo "Setting up DocumentDB APT repository..." - -# Add repository to sources list -echo "deb [arch=amd64] $REPO_URL $SUITE $COMPONENT" | sudo tee $LIST_FILE - -# Note: If GPG key is available, download it -# Uncomment the following lines once GPG key is published -# echo "Importing GPG key..." -# wget -qO - https://documentdb.github.io/gpg-key.asc | sudo apt-key add - - -echo "Updating package list..." -sudo apt-get update - -echo "" -echo "✓ DocumentDB repository has been added!" -echo "" -echo "You can now install DocumentDB with:" -echo " sudo apt-get install documentdb" diff --git a/.github/scripts/setup-yum.sh b/.github/scripts/setup-yum.sh deleted file mode 100755 index 1d941a9..0000000 --- a/.github/scripts/setup-yum.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# DocumentDB YUM Repository Setup Script - -set -e - -REPO_FILE="/etc/yum.repos.d/documentdb.repo" - -echo "Setting up DocumentDB YUM repository..." - -# Create repository configuration -sudo tee $REPO_FILE > /dev/null <
- curl -sSL https://documentdb.github.io/setup-apt.sh | sudo bash + # Add repository +
+ echo "deb [trusted=yes] https://documentdb.github.io/deb stable main" | sudo tee /etc/apt/sources.list.d/documentdb.list +
+ sudo apt-get update +
+
+ # Install DocumentDB
sudo apt-get install documentdb
- - View setup script → - {/* RHEL/CentOS/Fedora Card */} @@ -53,17 +54,28 @@ export default function PackagesPage() {
- curl -sSL https://documentdb.github.io/setup-yum.sh | sudo bash + # Add repository +
+ sudo tee /etc/yum.repos.d/documentdb.repo <<EOF +
+ [documentdb] +
+ name=DocumentDB Repository +
+ baseurl=https://documentdb.github.io/rpm +
+ enabled=1 +
+ gpgcheck=0 +
+ EOF +
+
+ # Install DocumentDB
sudo yum install documentdb
- - View setup script → - From 8ca930328ffb7b2e493cd2e6d9f33dd14201dfb4 Mon Sep 17 00:00:00 2001 From: Shuai Tian Date: Wed, 29 Oct 2025 11:39:00 +0000 Subject: [PATCH 3/4] delete repeated doc --- PACKAGES.md | 61 ----------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 PACKAGES.md diff --git a/PACKAGES.md b/PACKAGES.md deleted file mode 100644 index ff827c0..0000000 --- a/PACKAGES.md +++ /dev/null @@ -1,61 +0,0 @@ -# DocumentDB Package Repository - -This site hosts APT and YUM repositories for DocumentDB packages. - -## Quick Installation - -### Debian/Ubuntu -```bash -curl -sSL https://documentdb.github.io/setup-apt.sh | sudo bash -sudo apt-get install documentdb -``` - -### RHEL/CentOS/Fedora -```bash -curl -sSL https://documentdb.github.io/setup-yum.sh | sudo bash -sudo yum install documentdb # or dnf -``` - -## Manual Setup - -### APT Repository (Debian/Ubuntu) -```bash -echo "deb [arch=amd64] https://documentdb.github.io/deb stable main" | \ - sudo tee /etc/apt/sources.list.d/documentdb.list -sudo apt-get update -sudo apt-get install documentdb -``` - -### YUM Repository (RHEL/CentOS/Fedora) -```bash -sudo tee /etc/yum.repos.d/documentdb.repo < Date: Wed, 29 Oct 2025 11:43:45 +0000 Subject: [PATCH 4/4] update guidance --- app/packages/page.tsx | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/app/packages/page.tsx b/app/packages/page.tsx index 0197c87..45287d9 100644 --- a/app/packages/page.tsx +++ b/app/packages/page.tsx @@ -173,33 +173,6 @@ sudo yum install documentdb`}
- {/* Updates Info */} -
-

📢 Automatic Updates

-

- The repository is automatically updated whenever a new release is published in the{" "} - - documentdb/documentdb - {" "} - repository. -

-

- For more information about DocumentDB, visit the{" "} - - main site - {" "} - or check out the{" "} - - documentation - - . -

-
);