diff --git a/.github/scripts/download_packages.sh b/.github/scripts/download_packages.sh index 79af6a3..478bf47 100755 --- a/.github/scripts/download_packages.sh +++ b/.github/scripts/download_packages.sh @@ -1,20 +1,52 @@ #!/bin/bash set -e -# Repository to download packages from REPO="documentdb/documentdb" - -# Repository configuration +OUT_DIR="out" +DOCUMENTDB_VERSION="${DOCUMENTDB_VERSION:-latest}" +MULTI_VERSION="${MULTI_VERSION:-true}" SUITE="${SUITE:-stable}" COMPONENTS="${COMPONENTS:-main}" ORIGIN="${ORIGIN:-DocumentDB}" DESCRIPTION="${DESCRIPTION:-DocumentDB APT and YUM Repository}" +sign_deb_package() { + local package_file="$1" + if [ -n "$GPG_FINGERPRINT" ] && [ -f "$package_file" ]; then + echo " Signing DEB package: $(basename "$package_file")" + if command -v dpkg-sig >/dev/null 2>&1; then + dpkg-sig --sign builder --gpg-options "--default-key $GPG_FINGERPRINT" "$package_file" || echo " Warning: Could not sign $(basename "$package_file")" + else + echo " Warning: dpkg-sig not available, skipping DEB package signing" + fi + fi +} + GOT_DEB=0 GOT_RPM=0 DEB_POOL="out/deb/pool/${COMPONENTS}" +# Debian/Ubuntu pools +DEB_POOL_DEB11="out/deb/pool/deb11" +DEB_POOL_DEB12="out/deb/pool/deb12" +DEB_POOL_UBUNTU22="out/deb/pool/ubuntu22" +DEB_POOL_UBUNTU24="out/deb/pool/ubuntu24" +# RPM pools +RPM_POOL_RHEL8="out/rpm/rhel8" +RPM_POOL_RHEL9="out/rpm/rhel9" + DEB_DISTS="dists/${SUITE}" -DEB_DISTS_COMPONENTS="${DEB_DISTS}/${COMPONENTS}/binary-amd64" +# AMD64 directories +DEB_DISTS_COMPONENTS_AMD64="${DEB_DISTS}/${COMPONENTS}/binary-amd64" +DEB_DISTS_DEB11_AMD64="${DEB_DISTS}/deb11/binary-amd64" +DEB_DISTS_DEB12_AMD64="${DEB_DISTS}/deb12/binary-amd64" +DEB_DISTS_UBUNTU22_AMD64="${DEB_DISTS}/ubuntu22/binary-amd64" +DEB_DISTS_UBUNTU24_AMD64="${DEB_DISTS}/ubuntu24/binary-amd64" +# ARM64 directories +DEB_DISTS_COMPONENTS_ARM64="${DEB_DISTS}/${COMPONENTS}/binary-arm64" +DEB_DISTS_DEB11_ARM64="${DEB_DISTS}/deb11/binary-arm64" +DEB_DISTS_DEB12_ARM64="${DEB_DISTS}/deb12/binary-arm64" +DEB_DISTS_UBUNTU22_ARM64="${DEB_DISTS}/ubuntu22/binary-arm64" +DEB_DISTS_UBUNTU24_ARM64="${DEB_DISTS}/ubuntu24/binary-arm64" GPG_TTY="" export GPG_TTY @@ -22,61 +54,108 @@ 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}')" + for component in ${COMPONENTS} deb11 deb12 ubuntu22 ubuntu24; do + if [ -d "$component" ]; then + find "$component" -type f | while read -r file + do + echo " $(${HASH_COMMAND} "$file" | cut -d" " -f1) $(wc -c "$file" | awk '{print $1}') $file" + done + fi 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 +if [ "$DOCUMENTDB_VERSION" = "latest" ]; then + 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 "Using latest release: $tag" + else + echo "Error: Could not fetch latest release information" + exit 1 + fi +else + tag="$DOCUMENTDB_VERSION" + if ! release=$(curl -fqs "https://api.github.com/repos/${REPO}/releases/tags/$tag") + then + echo "Error: Version $tag not found in releases" + exit 1 + fi + echo "Using specified release: $tag" +fi + +mkdir -p out/packages + ASSETS_FILE=$(mktemp) 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 +" > "$ASSETS_FILE" + + # Process each asset + 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/ + wget -q -P out/packages "$download_url" + + if [[ "$filename" =~ ^deb11-postgresql-[0-9]+-documentdb.*\.deb$ ]]; then + GOT_DEB=1 + mkdir -p "$DEB_POOL_DEB11" + clean_name=$(echo "$filename" | sed 's/^deb11-//') + cp "out/packages/$filename" "$DEB_POOL_DEB11/$clean_name" + sign_deb_package "$DEB_POOL_DEB11/$clean_name" + elif [[ "$filename" =~ ^deb12-postgresql-[0-9]+-documentdb.*\.deb$ ]]; then + GOT_DEB=1 + mkdir -p "$DEB_POOL_DEB12" + clean_name=$(echo "$filename" | sed 's/^deb12-//') + cp "out/packages/$filename" "$DEB_POOL_DEB12/$clean_name" + sign_deb_package "$DEB_POOL_DEB12/$clean_name" + elif [[ "$filename" =~ ^ubuntu22\.04-postgresql-[0-9]+-documentdb.*\.deb$ ]]; then + GOT_DEB=1 + mkdir -p "$DEB_POOL_UBUNTU22" + clean_name=$(echo "$filename" | sed 's/^ubuntu22\.04-//') + cp "out/packages/$filename" "$DEB_POOL_UBUNTU22/$clean_name" + sign_deb_package "$DEB_POOL_UBUNTU22/$clean_name" + elif [[ "$filename" =~ ^ubuntu24\.04-postgresql-[0-9]+-documentdb.*\.deb$ ]]; then + GOT_DEB=1 + mkdir -p "$DEB_POOL_UBUNTU24" + clean_name=$(echo "$filename" | sed 's/^ubuntu24\.04-//') + cp "out/packages/$filename" "$DEB_POOL_UBUNTU24/$clean_name" + sign_deb_package "$DEB_POOL_UBUNTU24/$clean_name" + fi 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/ + echo "Processing RPM: $filename" + wget -q -P out/packages "$download_url" + + if [[ "$filename" =~ ^rhel8-postgresql[0-9]+-documentdb.*\.rpm$ ]]; then + GOT_RPM=1 + mkdir -p "$RPM_POOL_RHEL8" + clean_name=$(echo "$filename" | sed 's/^rhel8-//') + echo " Adding to RHEL 8: $filename -> $clean_name" + cp "out/packages/$filename" "$RPM_POOL_RHEL8/$clean_name" + elif [[ "$filename" =~ ^rhel9-postgresql[0-9]+-documentdb.*\.rpm$ ]]; then + GOT_RPM=1 + mkdir -p "$RPM_POOL_RHEL9" + clean_name=$(echo "$filename" | sed 's/^rhel9-//') + echo " Adding to RHEL 9: $filename -> $clean_name" + cp "out/packages/$filename" "$RPM_POOL_RHEL9/$clean_name" + else + echo " Skipping RPM (does not match patterns): $filename" + fi else - # Other files go directly to packages - echo " Downloading to packages directory" wget -q -P out/packages "$download_url" fi - done + done < "$ASSETS_FILE" - # Save release metadata - echo "$release" | python3 -c " +rm -f "$ASSETS_FILE" + +echo "$release" | python3 -c " import sys, json data = json.load(sys.stdin) output = { @@ -93,36 +172,145 @@ output = { } 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..." +echo "Successfully processed packages from $REPO" +echo "GOT_DEB=$GOT_DEB, GOT_RPM=$GOT_RPM" +echo "Checking final RPM repository structure:" +for pool in "$RPM_POOL_RHEL8" "$RPM_POOL_RHEL9"; do + if [ -d "$pool" ]; then + echo " $pool: $(ls -1 $pool/*.rpm 2>/dev/null | wc -l) RPM files" + ls -la "$pool"/ 2>/dev/null || echo " Cannot list contents" + else + echo " $pool: Directory does not exist" + fi +done + +if [ "$GOT_DEB" = "1" ]; then + echo "Building APT repository with multiple distribution components..." pushd out/deb >/dev/null - mkdir -p "${DEB_DISTS_COMPONENTS}" + if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + mkdir -p "${DEB_DISTS_COMPONENTS_AMD64}" "${DEB_DISTS_COMPONENTS_ARM64}" + dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_COMPONENTS_AMD64}/Packages" + dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_COMPONENTS_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_COMPONENTS_AMD64}/Packages" "${DEB_DISTS_COMPONENTS_ARM64}/Packages" + fi + + if [ -d "pool/deb11" ] && [ "$(ls -A pool/deb11/*.deb 2>/dev/null)" ]; then + mkdir -p "${DEB_DISTS_DEB11_AMD64}" "${DEB_DISTS_DEB11_ARM64}" + dpkg-scanpackages --arch amd64 pool/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" + dpkg-scanpackages --arch arm64 pool/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_DEB11_AMD64}/Packages" "${DEB_DISTS_DEB11_ARM64}/Packages" + fi - echo "Scanning DEB packages and creating Packages file" - dpkg-scanpackages --arch amd64 pool/ > "${DEB_DISTS_COMPONENTS}/Packages" - gzip -k -f "${DEB_DISTS_COMPONENTS}/Packages" + if [ -d "pool/deb12" ] && [ "$(ls -A pool/deb12/*.deb 2>/dev/null)" ]; then + mkdir -p "${DEB_DISTS_DEB12_AMD64}" "${DEB_DISTS_DEB12_ARM64}" + dpkg-scanpackages --arch amd64 pool/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" + dpkg-scanpackages --arch arm64 pool/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_DEB12_AMD64}/Packages" "${DEB_DISTS_DEB12_ARM64}/Packages" + fi + + if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + mkdir -p "${DEB_DISTS_UBUNTU22_AMD64}" "${DEB_DISTS_UBUNTU22_ARM64}" + dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" + dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU22_AMD64}/Packages" "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + fi + + if [ -d "pool/ubuntu24" ] && [ "$(ls -A pool/ubuntu24/*.deb 2>/dev/null)" ]; then + mkdir -p "${DEB_DISTS_UBUNTU24_AMD64}" "${DEB_DISTS_UBUNTU24_ARM64}" + dpkg-scanpackages --arch amd64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" + dpkg-scanpackages --arch arm64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU24_AMD64}/Packages" "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + fi + + # Create deb11 component (Debian 11 Bullseye) + if [ -d "pool/deb11" ] && [ "$(ls -A pool/deb11/*.deb 2>/dev/null)" ]; then + # AMD64 packages + mkdir -p "${DEB_DISTS_DEB11_AMD64}" + echo "Scanning Debian 11 AMD64 packages for deb11 component" + dpkg-scanpackages --arch amd64 pool/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" + gzip -k -f "${DEB_DISTS_DEB11_AMD64}/Packages" + + # ARM64 packages + mkdir -p "${DEB_DISTS_DEB11_ARM64}" + echo "Scanning Debian 11 ARM64 packages for deb11 component" + dpkg-scanpackages --arch arm64 pool/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_DEB11_ARM64}/Packages" + fi + + # Create deb12 component (Debian 12 Bookworm) + if [ -d "pool/deb12" ] && [ "$(ls -A pool/deb12/*.deb 2>/dev/null)" ]; then + # AMD64 packages + mkdir -p "${DEB_DISTS_DEB12_AMD64}" + echo "Scanning Debian 12 AMD64 packages for deb12 component" + dpkg-scanpackages --arch amd64 pool/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" + gzip -k -f "${DEB_DISTS_DEB12_AMD64}/Packages" + + # ARM64 packages + mkdir -p "${DEB_DISTS_DEB12_ARM64}" + echo "Scanning Debian 12 ARM64 packages for deb12 component" + dpkg-scanpackages --arch arm64 pool/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_DEB12_ARM64}/Packages" + fi + + # Create ubuntu22 component (Ubuntu 22.04 Jammy) + if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + # AMD64 packages + mkdir -p "${DEB_DISTS_UBUNTU22_AMD64}" + echo "Scanning Ubuntu 22.04 AMD64 packages for ubuntu22 component" + dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU22_AMD64}/Packages" + + # ARM64 packages + mkdir -p "${DEB_DISTS_UBUNTU22_ARM64}" + echo "Scanning Ubuntu 22.04 ARM64 packages for ubuntu22 component" + dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + fi + + # Create ubuntu24 component (Ubuntu 24.04 Noble) + if [ -d "pool/ubuntu24" ] && [ "$(ls -A pool/ubuntu24/*.deb 2>/dev/null)" ]; then + # AMD64 packages + mkdir -p "${DEB_DISTS_UBUNTU24_AMD64}" + echo "Scanning Ubuntu 24.04 AMD64 packages for ubuntu24 component" + dpkg-scanpackages --arch amd64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU24_AMD64}/Packages" + + # ARM64 packages + mkdir -p "${DEB_DISTS_UBUNTU24_ARM64}" + echo "Scanning Ubuntu 24.04 ARM64 packages for ubuntu24 component" + dpkg-scanpackages --arch arm64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + gzip -k -f "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + fi pushd "${DEB_DISTS}" >/dev/null echo "Creating Release file" + # Determine which components we actually have + AVAILABLE_COMPONENTS="" + [ -d "${COMPONENTS}/binary-amd64" ] && AVAILABLE_COMPONENTS="${AVAILABLE_COMPONENTS} ${COMPONENTS}" + [ -d "deb11/binary-amd64" ] && AVAILABLE_COMPONENTS="${AVAILABLE_COMPONENTS} deb11" + [ -d "deb12/binary-amd64" ] && AVAILABLE_COMPONENTS="${AVAILABLE_COMPONENTS} deb12" + [ -d "ubuntu22/binary-amd64" ] && AVAILABLE_COMPONENTS="${AVAILABLE_COMPONENTS} ubuntu22" + [ -d "ubuntu24/binary-amd64" ] && AVAILABLE_COMPONENTS="${AVAILABLE_COMPONENTS} ubuntu24" + AVAILABLE_COMPONENTS=$(echo $AVAILABLE_COMPONENTS | sed 's/^ *//') + + # Determine available architectures + AVAILABLE_ARCHITECTURES="" + [ -d "${COMPONENTS}/binary-amd64" ] || [ -d "deb11/binary-amd64" ] || [ -d "deb12/binary-amd64" ] || [ -d "ubuntu22/binary-amd64" ] || [ -d "ubuntu24/binary-amd64" ] && AVAILABLE_ARCHITECTURES="${AVAILABLE_ARCHITECTURES} amd64" + [ -d "${COMPONENTS}/binary-arm64" ] || [ -d "deb11/binary-arm64" ] || [ -d "deb12/binary-arm64" ] || [ -d "ubuntu22/binary-arm64" ] || [ -d "ubuntu24/binary-arm64" ] && AVAILABLE_ARCHITECTURES="${AVAILABLE_ARCHITECTURES} arm64" + AVAILABLE_ARCHITECTURES=$(echo $AVAILABLE_ARCHITECTURES | sed 's/^ *//') + { 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 "Architectures: ${AVAILABLE_ARCHITECTURES}" + echo "Components: ${AVAILABLE_COMPONENTS}" + echo "Description: ${DESCRIPTION} - Multiple distributions supported" echo "Date: $(date -Ru)" generate_hashes MD5Sum md5sum generate_hashes SHA1 sha1sum @@ -134,48 +322,92 @@ if [ -d "$DEB_POOL" ] && [ "$(ls -A $DEB_POOL/*.deb 2>/dev/null)" ]; 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 + + # Export public key for users to import + echo "Exporting GPG public key" + gpg --armor --export "$GPG_FINGERPRINT" > documentdb-archive-keyring.gpg + + # Also create the key in the main directory for easy access + gpg --armor --export "$GPG_FINGERPRINT" > ../../../documentdb-archive-keyring.gpg else echo "Warning: GPG_FINGERPRINT not set, skipping package signing" fi popd >/dev/null - popd >/dev/null - echo "APT repository built successfully" + + + echo "APT repository built successfully with multiple distribution support" 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 +if [ "$GOT_RPM" = "1" ]; then + echo "Building YUM repositories..." - # 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 + # Adjust RPM pool paths if we're in the wrong directory after APT processing + if [[ "$PWD" == */out/deb ]]; then + RHEL8_POOL="../rpm/rhel8" + RHEL9_POOL="../rpm/rhel9" + MAIN_POOL="../rpm/main" + else + RHEL8_POOL="$RPM_POOL_RHEL8" + RHEL9_POOL="$RPM_POOL_RHEL9" + MAIN_POOL="out/rpm/main" fi - echo "Creating YUM repository metadata" - createrepo_c . + for POOL in "$RHEL8_POOL" "$RHEL9_POOL"; do + if [ -d "$POOL" ] && [ "$(find "$POOL" -name "*.rpm" -type f | wc -l)" -gt 0 ]; then + echo "Processing YUM repository: $POOL" + pushd "$POOL" >/dev/null + + if [ -n "$GPG_FINGERPRINT" ]; then + for rpm_file in *.rpm; do + rpm --define "%_signature gpg" --define "%_gpg_name ${GPG_FINGERPRINT}" --addsign "$rpm_file" 2>/dev/null || true + done + fi + + echo "Running createrepo_c in $(pwd)" + if createrepo_c .; then + echo "Repository metadata created successfully" + ls -la repodata/ 2>/dev/null || echo "No repodata directory found" + else + echo "ERROR: createrepo_c failed for $POOL" + fi + + if [ -n "$GPG_FINGERPRINT" ] && [ -f repodata/repomd.xml ]; then + gpg --default-key "$GPG_FINGERPRINT" --detach-sign --armor repodata/repomd.xml 2>/dev/null || true + fi + + popd >/dev/null + else + echo "Skipping $POOL: directory not found or no RPM files" + fi + done - # 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 + # Create main repository for backward compatibility + if [ -d "$RHEL8_POOL" ] && [ "$(find "$RHEL8_POOL" -name "*.rpm" -type f | wc -l)" -gt 0 ]; then + echo "Creating main YUM repository" + mkdir -p "$MAIN_POOL" + cp "$RHEL8_POOL"/*.rpm "$MAIN_POOL"/ 2>/dev/null || true + pushd "$MAIN_POOL" >/dev/null + echo "Running createrepo_c for main repository in $(pwd)" + if createrepo_c .; then + echo "Main repository metadata created successfully" + ls -la repodata/ 2>/dev/null || echo "No repodata directory found" + else + echo "ERROR: createrepo_c failed for main repository" + fi + if [ -n "$GPG_FINGERPRINT" ] && [ -f repodata/repomd.xml ]; then + gpg --default-key "$GPG_FINGERPRINT" --detach-sign --armor repodata/repomd.xml 2>/dev/null || true + fi + popd >/dev/null fi - popd >/dev/null - echo "YUM repository built successfully" + echo "YUM repositories built successfully" fi echo "Package repository setup complete!" echo "" -echo "Repository structure:" -ls -lh out/ - -# Create an index file for the packages - -echo "Package download complete!" -ls -lh out/packages/ +echo "Repository URLs:" +echo " APT: https://documentdb.io/deb stable main" +echo " YUM: https://documentdb.io/rpm/rhel8 (or /rhel9, /main)" +echo " Browse: https://documentdb.io/packages/" diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index fa2e64a..8cb65da 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -24,28 +24,37 @@ concurrency: jobs: # Build job build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4 - name: Install required packages run: | until sudo apt-get update; do sleep 1; done - sudo apt-get install -y createrepo-c dpkg-dev gnupg2 python3 + sudo apt-get install -y createrepo-c dpkg-dev dpkg-sig gnupg2 python3 - name: Setup GPG id: import_gpg uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} continue-on-error: true - - name: Set GPG fingerprint + - name: Set GPG fingerprint and version config run: | + # Configure GPG signing if [ -n "${{ steps.import_gpg.outputs.fingerprint }}" ]; then echo "GPG_FINGERPRINT=${{ steps.import_gpg.outputs.fingerprint }}" >> $GITHUB_ENV - echo "✓ GPG key loaded: ${{ steps.import_gpg.outputs.fingerprint }}" + echo "✅ GPG key loaded successfully" + echo " Fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}" + echo " Key ID: ${{ steps.import_gpg.outputs.keyid }}" + echo " User ID: ${{ steps.import_gpg.outputs.name }} <${{ steps.import_gpg.outputs.email }}>" else - echo "⚠ No GPG key configured - packages will not be signed" + echo "⚠️ No GPG key configured - packages will not be signed" + echo " To enable signing, add GPG_PRIVATE_KEY to repository secrets" fi + + # Configure DocumentDB version (can be overridden by repository variables) + echo "DOCUMENTDB_VERSION=${{ vars.DOCUMENTDB_VERSION || 'latest' }}" >> $GITHUB_ENV + echo "MULTI_VERSION=${{ vars.MULTI_VERSION || 'true' }}" >> $GITHUB_ENV - name: Detect package manager id: detect-package-manager run: | diff --git a/PACKAGE-INSTALL.md b/PACKAGE-INSTALL.md new file mode 100644 index 0000000..6a5dc6b --- /dev/null +++ b/PACKAGE-INSTALL.md @@ -0,0 +1,292 @@ +# DocumentDB Package Installation + +Fast and simple installation of DocumentDB extension for PostgreSQL. + +**Supported PostgreSQL Versions:** 15, 16, 17 + +## Install Commands + +### Ubuntu & Debian (AMD64 & ARM64) +```bash +curl -fsSL https://documentdb.io/documentdb-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/documentdb-archive-keyring.gpg +echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/documentdb-archive-keyring.gpg] https://documentdb.io/deb stable main" | sudo tee /etc/apt/sources.list.d/documentdb.list +sudo apt update + +# Install latest version for PostgreSQL 16 (recommended) +sudo apt install postgresql-16-documentdb +``` + +### RHEL & CentOS (x86_64 & aarch64) +```bash +# Enable CRB repository (required for PostGIS dependencies) +sudo dnf install -y dnf-plugins-core +sudo dnf config-manager --set-enabled crb + +# Import GPG key +sudo rpm --import https://documentdb.io/documentdb-archive-keyring.gpg + +# Add repository (RHEL/Rocky 9) +cat < 📦 DocumentDB Package Repository -

+

Official APT and YUM repositories for DocumentDB packages

+
+ + 🔐 GPG Signed + + + 🐧 Multi-Distribution + + + 🔄 Auto-Updates + +
{/* Quick Install Cards */} -
+
{/* Debian/Ubuntu Card */}
@@ -28,18 +39,26 @@ export default function PackagesPage() {
- # Add repository + # Add repository with GPG verification
- echo "deb [trusted=yes] https://documentdb.github.io/deb stable main" | sudo tee /etc/apt/sources.list.d/documentdb.list + curl -fsSL https://documentdb.io/documentdb-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/documentdb-archive-keyring.gpg
- sudo apt-get update + echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/documentdb-archive-keyring.gpg] https://documentdb.io/deb stable main" | sudo tee /etc/apt/sources.list.d/documentdb.list

- # Install DocumentDB + # Install packages
- sudo apt-get install documentdb + sudo apt update && sudo apt install postgresql-16-documentdb
+
+ + Supports: Debian 11/12, Ubuntu 22.04/24.04 + + + AMD64 + ARM64 + +
{/* RHEL/CentOS/Fedora Card */} @@ -50,127 +69,156 @@ export default function PackagesPage() {
-

RHEL/CentOS/Fedora

+

RHEL/CentOS

+
- # Add repository + # Enable CRB repo (for dependencies) +
+ sudo dnf install -y dnf-plugins-core +
+ sudo dnf config-manager --set-enabled crb
- sudo tee /etc/yum.repos.d/documentdb.repo <<EOF
- [documentdb] + # Add repository with GPG verification +
+ sudo rpm --import https://documentdb.io/documentdb-archive-keyring.gpg +
+ echo '[documentdb]
name=DocumentDB Repository
- baseurl=https://documentdb.github.io/rpm + baseurl=https://documentdb.io/rpm/rhel9
enabled=1
- gpgcheck=0 + gpgcheck=1
- EOF + gpgkey=https://documentdb.io/documentdb-archive-keyring.gpg' | sudo tee /etc/yum.repos.d/documentdb.repo

- # Install DocumentDB + # Install packages
- sudo yum install documentdb + sudo dnf install postgresql16-documentdb
+
+ + Supports: RHEL 8/9, Rocky, AlmaLinux, CentOS Stream + + + x86_64 + aarch64 + +
- {/* 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`}
-              
+ {/* Installation Guide Link */} +
+
+
+

📖 Complete Installation Guide

+

+ Detailed instructions for all distributions, GPG verification, troubleshooting, etc +

+ + View Guide +
+
- {/* YUM Manual Setup */} -
-

- YUM Repository (RHEL/CentOS/Fedora) + {/* Alternative Installation Methods */} +
+

Alternative Installation Methods

+ + {/* Direct Downloads */} +
+

+ Direct Package Downloads

-
-
-                {`sudo tee /etc/yum.repos.d/documentdb.repo <
+              Browse and download individual packages without setting up repositories.
+            

+
-sudo yum install documentdb`} - + {/* Manual Installation */} +
+

Manual Installation

+

+ For one-time installations, you can download and install packages manually: +

+
+ + # Example: Direct .deb installation
+ wget https://documentdb.io/packages/ubuntu22.04-postgresql-16-documentdb_0.107-0_amd64.deb
+ sudo dpkg -i ubuntu22.04-postgresql-16-documentdb_0.107-0_amd64.deb
+
+ # Example: Direct .rpm installation
+ wget https://documentdb.io/packages/rhel8-postgresql16-documentdb-0.107.0-1.el8.x86_64.rpm
+ sudo rpm -i rhel8-postgresql16-documentdb-0.107.0-1.el8.x86_64.rpm +
- {/* Direct Downloads */} + {/* Package Information */}
-

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 - +

    Available Packages

    + +
    +
    +

    + + + + APT Packages +

    +
    + Debian 11/12, Ubuntu 22.04/24.04
    -
  • -
  • - -
    - YUM Repository:{" "} - - https://documentdb.github.io/rpm - +
      +
    • • postgresql-15-documentdb
    • +
    • • postgresql-16-documentdb
    • +
    • • postgresql-17-documentdb
    • +
    +
    + +
    +

    + + + + RPM Packages +

    +
    + RHEL 8/9, CentOS, Fedora
    -
  • -
  • - +
      +
    • • postgresql16-documentdb
    • +
    • • postgresql17-documentdb
    • +
    +
+
+ +
+
+ + +
- Package Browser:{" "} - - https://documentdb.github.io/packages/ - +

Multi-Architecture Support

+

+ All packages support both AMD64 and ARM64 architectures (including Apple Silicon, AWS Graviton, etc.) +

- - +
+