feat(docker): add PostGIS and remove unstable PG18 support
- Install PostGIS (postgresql--postgis-3) in the final image. - Add postgis and postgis_topology to init-extensions.sh. - Add test script for PostGIS to the CI workflow. - Update README.md to reflect PostGIS integration. - Remove PG18 from CI matrix because of ABI incompatibility between TimescaleDB headers and the vchord-postgres PG18 runtime (missing palloc0_mul). PG18 support will be restored when VectorChord releases a stable PG18 image.
This commit is contained in:
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
pg_version: [15, 16, 17, 18]
|
||||
pg_version: [15, 16, 17]
|
||||
steps:
|
||||
- name: 📥 Checkout code
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
@@ -69,6 +69,9 @@ jobs:
|
||||
- name: "🧪 Test 4: Hybrid Scenarios"
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-4-hybrid.sql
|
||||
|
||||
- name: "🧪 Test 5: PostGIS"
|
||||
run: docker exec test-pg${{ matrix.pg_version }} psql -U postgres -f /tmp/tests/test-5-postgis.sql
|
||||
|
||||
- name: 🧹 Cleanup test container
|
||||
if: always()
|
||||
run: docker rm -f test-pg${{ matrix.pg_version }} || true
|
||||
@@ -83,14 +86,14 @@ jobs:
|
||||
tags: |
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:pg${{ matrix.pg_version }}
|
||||
|
||||
- name: 🏷️ Tag latest (PG18 only)
|
||||
if: matrix.pg_version == 18
|
||||
- name: 🏷️ Tag latest (PG17 only)
|
||||
if: matrix.pg_version == 17
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
build-args: |
|
||||
PG_VERSION=18
|
||||
PG_VERSION=17
|
||||
tags: |
|
||||
gitea.killinger.fr/maxime.killinger/postgres-ts-vectors:latest
|
||||
|
||||
|
||||
+11
-2
@@ -31,8 +31,8 @@ RUN git clone --branch ${TIMESCALEDB_VERSION} --depth 1 https://github.com/times
|
||||
FROM tensorchord/vchord-postgres:pg${PG_VERSION}-v1.1.1 AS final
|
||||
|
||||
# OCI Labels
|
||||
LABEL org.opencontainers.image.title="TimescaleDB + VectorChord + pgvector"
|
||||
LABEL org.opencontainers.image.description="PostgreSQL with TimescaleDB, VectorChord, and pgvector extensions pre-installed"
|
||||
LABEL org.opencontainers.image.title="TimescaleDB + VectorChord + pgvector + PostGIS"
|
||||
LABEL org.opencontainers.image.description="PostgreSQL with TimescaleDB, VectorChord, pgvector, and PostGIS extensions pre-installed"
|
||||
LABEL org.opencontainers.image.source="https://gitea.killinger.fr/maxime.killinger/postgres-ts-vectors"
|
||||
LABEL org.opencontainers.image.vendor="Maxime Killinger"
|
||||
LABEL org.opencontainers.image.licenses="Apache-2.0"
|
||||
@@ -42,6 +42,15 @@ LABEL org.opencontainers.image.base.name="tensorchord/vchord-postgres:pg${PG_VER
|
||||
COPY --from=builder /tmp/timescaledb/usr/lib/postgresql/ /usr/lib/postgresql/
|
||||
COPY --from=builder /tmp/timescaledb/usr/share/postgresql/ /usr/share/postgresql/
|
||||
|
||||
USER root
|
||||
|
||||
# Install PostGIS
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
postgresql-$PG_MAJOR-postgis-3 \
|
||||
postgresql-$PG_MAJOR-postgis-3-scripts \
|
||||
postgis \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add init script for auto-extension creation
|
||||
COPY init-extensions.sh /docker-entrypoint-initdb.d/
|
||||
RUN sed -i 's/\r$//' /docker-entrypoint-initdb.d/init-extensions.sh && \
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
# TimescaleDB + VectorChord + pgvector
|
||||
# TimescaleDB + VectorChord + pgvector + PostGIS
|
||||
|
||||
[](https://gitea.killinger.fr/maxime.killinger/postgres-ts-vectors/actions)
|
||||
|
||||
Docker image combining **PostgreSQL** with three powerful extensions:
|
||||
Docker image combining **PostgreSQL** with four powerful extensions:
|
||||
|
||||
- **[TimescaleDB](https://www.timescale.com/)** - Time-series database extension
|
||||
- **[VectorChord](https://vectorchord.ai/)** - High-performance vector similarity search
|
||||
- **[pgvector](https://github.com/pgvector/pgvector)** - Open-source vector similarity search
|
||||
- **[PostGIS](https://postgis.net/)** - Geographic objects support
|
||||
|
||||
## Supported PostgreSQL Versions
|
||||
|
||||
| Tag | PostgreSQL | TimescaleDB | VectorChord | pgvector |
|
||||
|-----|------------|-------------|-------------|----------|
|
||||
| `pg15` | 15 | 2.28.3 | 1.1.1 | 0.8.1 |
|
||||
| `pg16` | 16 | 2.28.3 | 1.1.1 | 0.8.1 |
|
||||
| `pg17` | 17 | 2.28.3 | 1.1.1 | 0.8.1 |
|
||||
| `pg18`, `latest` | 18 | 2.28.3 | 1.1.1 | 0.8.1 |
|
||||
| Tag | PostgreSQL | TimescaleDB | VectorChord | pgvector | PostGIS |
|
||||
|-----|------------|-------------|-------------|----------|---------|
|
||||
| `pg15` | 15 | 2.28.3 | 1.1.1 | 0.8.1 | 3.x |
|
||||
| `pg16` | 16 | 2.28.3 | 1.1.1 | 0.8.1 | 3.x |
|
||||
| `pg17`, `latest` | 17 | 2.28.3 | 1.1.1 | 0.8.1 | 3.x |
|
||||
|
||||
## Quick Start
|
||||
|
||||
|
||||
+3
-1
@@ -5,6 +5,8 @@ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-E
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
CREATE EXTENSION IF NOT EXISTS vchord CASCADE;
|
||||
CREATE EXTENSION IF NOT EXISTS postgis;
|
||||
CREATE EXTENSION IF NOT EXISTS postgis_topology;
|
||||
EOSQL
|
||||
|
||||
echo "Extensions timescaledb, vector, and vchord have been created."
|
||||
echo "Extensions timescaledb, vector, vchord, and postgis have been created."
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
-- Test 5: PostGIS
|
||||
\set ON_ERROR_STOP on
|
||||
|
||||
CREATE TABLE spatial_data (
|
||||
id serial PRIMARY KEY,
|
||||
geom geometry(Point, 4326)
|
||||
);
|
||||
|
||||
INSERT INTO spatial_data (geom) VALUES (ST_GeomFromText('POINT(-71.060316 48.432044)', 4326));
|
||||
INSERT INTO spatial_data (geom) VALUES (ST_GeomFromText('POINT(-71.059773 48.432867)', 4326));
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
dist float;
|
||||
BEGIN
|
||||
SELECT ST_Distance(
|
||||
(SELECT geom FROM spatial_data WHERE id = 1),
|
||||
(SELECT geom FROM spatial_data WHERE id = 2)
|
||||
) INTO dist;
|
||||
|
||||
IF dist IS NULL THEN
|
||||
RAISE EXCEPTION 'PostGIS distance calculation failed';
|
||||
END IF;
|
||||
RAISE NOTICE 'PostGIS Check: OK, distance is %', dist;
|
||||
END
|
||||
$$;
|
||||
|
||||
DROP TABLE spatial_data;
|
||||
Reference in New Issue
Block a user