Skip to content

Commit d2bab80

Browse files
authored
Merge pull request #50 from mfa777/copilot/add-pg-search-extension-support
Add ParadeDB `pg_search` extension support to PostgreSQL image
2 parents 2effa15 + a4fa256 commit d2bab80

3 files changed

Lines changed: 42 additions & 1 deletion

File tree

Dockerfile.postgres-walg

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,34 @@ RUN set -eux; \
114114
rm -f "/tmp/${vchord_pkg}"; \
115115
rm -rf /var/lib/apt/lists/*
116116

117+
# Install ParadeDB pg_search extension
118+
ARG PG_SEARCH_VERSION=0.21.13
119+
ARG PG_SEARCH_RELEASE=1
120+
RUN set -eux; \
121+
arch="$(dpkg --print-architecture)"; \
122+
PG_MAJOR="$(echo ${POSTGRES_VERSION} | cut -d. -f1)"; \
123+
. /etc/os-release; \
124+
pg_search_url=""; \
125+
# Fallback distro tags for ParadeDB package naming:
126+
# bookworm=Debian 12, trixie=Debian 13, noble=Ubuntu 24.04, jammy=Ubuntu 22.04
127+
for distro in "${VERSION_CODENAME:-}" bookworm trixie noble jammy; do \
128+
[ -n "${distro}" ] || continue; \
129+
candidate="https://github.com/paradedb/paradedb/releases/download/v${PG_SEARCH_VERSION}/postgresql-${PG_MAJOR}-pg-search_${PG_SEARCH_VERSION}-${PG_SEARCH_RELEASE}PARADEDB-${distro}_${arch}.deb"; \
130+
if wget -q --spider "${candidate}"; then \
131+
pg_search_url="${candidate}"; \
132+
break; \
133+
fi; \
134+
done; \
135+
if [ -z "${pg_search_url}" ]; then \
136+
echo "Could not find pg_search package for postgresql-${PG_MAJOR} (${arch}) in v${PG_SEARCH_VERSION}" >&2; \
137+
exit 1; \
138+
fi; \
139+
wget --tries=3 -O /tmp/pg_search.deb "${pg_search_url}"; \
140+
apt-get update; \
141+
apt-get install -y --no-install-recommends /tmp/pg_search.deb; \
142+
rm -f /tmp/pg_search.deb; \
143+
rm -rf /var/lib/apt/lists/*
144+
117145
# Use our custom entrypoint
118146
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-walg.sh"]
119147
CMD ["postgres"]

README.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Production-ready PostgreSQL setup with automated, encrypted backups to remote st
1111
- Two backup modes: SQL (full dumps) or WAL-G (incremental with PITR)
1212
- Automated backup scheduling and retention policies
1313
- Optional PgBouncer connection pooling
14+
- Built-in ParadeDB =pg_search= extension support in PostgreSQL image
1415
- Telegram notifications on backup failures
1516
- Optional pgAdmin web interface
1617

test/test-offline-e2e.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,18 @@ test_postgresql_integration() {
205205
else
206206
skip "wal-g-runner.sh script not found"
207207
fi
208+
209+
# Test pg_search installation in postgres image
210+
local postgres_dockerfile="$SCRIPT_DIR/Dockerfile.postgres-walg"
211+
if [[ -f "$postgres_dockerfile" ]]; then
212+
if grep -Fq "postgresql-\${PG_MAJOR}-pg-search" "$postgres_dockerfile"; then
213+
pass "Dockerfile.postgres-walg contains pg_search package installation"
214+
else
215+
warn "Dockerfile.postgres-walg missing pg_search package installation"
216+
fi
217+
else
218+
skip "Dockerfile.postgres-walg not found"
219+
fi
208220
}
209221

210222
# Test 5: SSH setup validation
@@ -288,4 +300,4 @@ main() {
288300
}
289301

290302
# Run main function
291-
main "$@"
303+
main "$@"

0 commit comments

Comments
 (0)