From 21708c33c2f631bebd8b5a48d2b3007c0b6aafd2 Mon Sep 17 00:00:00 2001 From: Husn E Rabbi Date: Sun, 30 Nov 2025 17:04:13 +0500 Subject: [PATCH 1/5] feat: add Dockerfile, README, and metadata for TimescaleDB extension Signed-off-by: Husn E Rabbi --- timescaledb/Dockerfile | 36 +++++++++++++++++++++ timescaledb/README.md | 68 ++++++++++++++++++++++++++++++++++++++++ timescaledb/metadata.hcl | 19 +++++++++++ 3 files changed, 123 insertions(+) create mode 100644 timescaledb/Dockerfile create mode 100644 timescaledb/README.md create mode 100644 timescaledb/metadata.hcl diff --git a/timescaledb/Dockerfile b/timescaledb/Dockerfile new file mode 100644 index 0000000..9206a69 --- /dev/null +++ b/timescaledb/Dockerfile @@ -0,0 +1,36 @@ + +ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie +FROM $BASE AS builder + +ARG PG_MAJOR +ARG EXT_VERSION + +USER 0 +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg postgresql-common apt-transport-https lsb-release wget ca-certificates; \ + # Add TimescaleDB package repository + echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list; \ + wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + timescaledb-2-postgresql-${PG_MAJOR}=${EXT_VERSION}* \ + timescaledb-2-loader-postgresql-${PG_MAJOR}=${EXT_VERSION}* + +###################################################################### +# Final SCRATCH image +###################################################################### +FROM scratch +ARG PG_MAJOR + +# Licenses +COPY --from=builder /usr/share/doc/timescaledb-2-postgresql-${PG_MAJOR}/copyright /licenses/timescaledb/ + +# Libraries — .so and bitcode for TimescaleDB +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb* /lib/ +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb-2* /lib/ + +# Extension SQL + control files +COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/timescaledb* /share/extension/ + +USER 65532:65532 \ No newline at end of file diff --git a/timescaledb/README.md b/timescaledb/README.md new file mode 100644 index 0000000..edaa75c --- /dev/null +++ b/timescaledb/README.md @@ -0,0 +1,68 @@ +# TimescaleDB with CloudNativePG + +[TimescaleDB](https://github.com/timescale/timescaledb) is the leading open-source time-series database, built on PostgreSQL. It enables fast analytics, efficient storage, and powerful querying for time-series workloads. + +This image provides a convenient way to deploy and manage `TimescaleDB` with +[CloudNativePG](https://cloudnative-pg.io/). + +## Usage + +### 1. Add the timescaledb extension image to your Cluster + +Define the `timescaledb` extension under the `postgresql.extensions` section of +your `Cluster` resource. For example: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: cluster-timescaledb +spec: + imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie + instances: 1 + + storage: + size: 1Gi + + postgresql: + shared_preload_libraries: + - "timescaledb" + parameters: + timescaledb.telemetry_level: 'off' + max_locks_per_transaction: '128' + + postgresql: + extensions: + - name: timescaledb + image: + reference: ghcr.io/cloudnative-pg/timescaledb:2.23.1-18-trixie +``` + +### 2. Enable the extension in a database + +You can install `timescaledb` in a specific database by creating or updating a +`Database` resource. For example, to enable it in the `app` database: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: cluster-timescaledb-app +spec: + name: app + owner: app + cluster: + name: cluster-timescaledb + extensions: + - name: timescaledb +``` + +### 3. Verify installation + +Once the database is ready, connect to it with `psql` and run: + +```sql +\dx +``` + +You should see `timescaledb` listed among the installed extensions. diff --git a/timescaledb/metadata.hcl b/timescaledb/metadata.hcl new file mode 100644 index 0000000..1ea21d4 --- /dev/null +++ b/timescaledb/metadata.hcl @@ -0,0 +1,19 @@ +metadata = { + name = "timescaledb" + sql_name = "timescaledb" + image_name = "timescaledb" + shared_preload_libraries = ["timescaledb"] + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = [] + versions = { + bookworm = { + // renovate: datasource=postgresql depName=timescaledb-2-postgresql-18 versioning=deb + "18" = "2.23.1~debian12-1800" + } + trixie = { + // renovate: datasource=postgresql depName=timescaledb-2-postgresql-18 versioning=deb + "18" = "2.23.1~debian13-1800" + } + } +} \ No newline at end of file From d3a65bef1463165aee19e01975bda12e11a7639a Mon Sep 17 00:00:00 2001 From: Husn E Rabbi Date: Sun, 30 Nov 2025 17:04:13 +0500 Subject: [PATCH 2/5] feat: add TimescaleDB to workflow options and update filters Signed-off-by: Husn E Rabbi --- timescaledb/Dockerfile | 36 +++++++++++++++++++++ timescaledb/README.md | 68 ++++++++++++++++++++++++++++++++++++++++ timescaledb/metadata.hcl | 19 +++++++++++ 3 files changed, 123 insertions(+) create mode 100644 timescaledb/Dockerfile create mode 100644 timescaledb/README.md create mode 100644 timescaledb/metadata.hcl diff --git a/timescaledb/Dockerfile b/timescaledb/Dockerfile new file mode 100644 index 0000000..9206a69 --- /dev/null +++ b/timescaledb/Dockerfile @@ -0,0 +1,36 @@ + +ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie +FROM $BASE AS builder + +ARG PG_MAJOR +ARG EXT_VERSION + +USER 0 +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends gnupg postgresql-common apt-transport-https lsb-release wget ca-certificates; \ + # Add TimescaleDB package repository + echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list; \ + wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + timescaledb-2-postgresql-${PG_MAJOR}=${EXT_VERSION}* \ + timescaledb-2-loader-postgresql-${PG_MAJOR}=${EXT_VERSION}* + +###################################################################### +# Final SCRATCH image +###################################################################### +FROM scratch +ARG PG_MAJOR + +# Licenses +COPY --from=builder /usr/share/doc/timescaledb-2-postgresql-${PG_MAJOR}/copyright /licenses/timescaledb/ + +# Libraries — .so and bitcode for TimescaleDB +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb* /lib/ +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/timescaledb-2* /lib/ + +# Extension SQL + control files +COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/timescaledb* /share/extension/ + +USER 65532:65532 \ No newline at end of file diff --git a/timescaledb/README.md b/timescaledb/README.md new file mode 100644 index 0000000..edaa75c --- /dev/null +++ b/timescaledb/README.md @@ -0,0 +1,68 @@ +# TimescaleDB with CloudNativePG + +[TimescaleDB](https://github.com/timescale/timescaledb) is the leading open-source time-series database, built on PostgreSQL. It enables fast analytics, efficient storage, and powerful querying for time-series workloads. + +This image provides a convenient way to deploy and manage `TimescaleDB` with +[CloudNativePG](https://cloudnative-pg.io/). + +## Usage + +### 1. Add the timescaledb extension image to your Cluster + +Define the `timescaledb` extension under the `postgresql.extensions` section of +your `Cluster` resource. For example: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: cluster-timescaledb +spec: + imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie + instances: 1 + + storage: + size: 1Gi + + postgresql: + shared_preload_libraries: + - "timescaledb" + parameters: + timescaledb.telemetry_level: 'off' + max_locks_per_transaction: '128' + + postgresql: + extensions: + - name: timescaledb + image: + reference: ghcr.io/cloudnative-pg/timescaledb:2.23.1-18-trixie +``` + +### 2. Enable the extension in a database + +You can install `timescaledb` in a specific database by creating or updating a +`Database` resource. For example, to enable it in the `app` database: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: cluster-timescaledb-app +spec: + name: app + owner: app + cluster: + name: cluster-timescaledb + extensions: + - name: timescaledb +``` + +### 3. Verify installation + +Once the database is ready, connect to it with `psql` and run: + +```sql +\dx +``` + +You should see `timescaledb` listed among the installed extensions. diff --git a/timescaledb/metadata.hcl b/timescaledb/metadata.hcl new file mode 100644 index 0000000..1ea21d4 --- /dev/null +++ b/timescaledb/metadata.hcl @@ -0,0 +1,19 @@ +metadata = { + name = "timescaledb" + sql_name = "timescaledb" + image_name = "timescaledb" + shared_preload_libraries = ["timescaledb"] + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = [] + versions = { + bookworm = { + // renovate: datasource=postgresql depName=timescaledb-2-postgresql-18 versioning=deb + "18" = "2.23.1~debian12-1800" + } + trixie = { + // renovate: datasource=postgresql depName=timescaledb-2-postgresql-18 versioning=deb + "18" = "2.23.1~debian13-1800" + } + } +} \ No newline at end of file From fbb54916e408b35f41338eebcc789d07f40c4c73 Mon Sep 17 00:00:00 2001 From: Husn E Rabbi Date: Sun, 30 Nov 2025 20:20:20 +0500 Subject: [PATCH 3/5] fix: remove redundant postgresql section in README.md Signed-off-by: Husn E Rabbi --- timescaledb/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/timescaledb/README.md b/timescaledb/README.md index edaa75c..7a9c215 100644 --- a/timescaledb/README.md +++ b/timescaledb/README.md @@ -31,7 +31,6 @@ spec: timescaledb.telemetry_level: 'off' max_locks_per_transaction: '128' - postgresql: extensions: - name: timescaledb image: From bcd3d8379364acc06a94d86123a0edbeb3325570 Mon Sep 17 00:00:00 2001 From: Husn E Rabbi Date: Thu, 11 Dec 2025 18:10:39 +0500 Subject: [PATCH 4/5] add timescaledb in README Signed-off-by: Husn E Rabbi --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index faf8582..bd35c58 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ they are maintained by their respective authors, and PostgreSQL Debian Group | **[pgAudit](pgaudit)** | PostgreSQL audit extension | [https://github.com/pgaudit/pgaudit](https://github.com/pgaudit/pgaudit) | | **[pgvector](pgvector)** | Vector similarity search for PostgreSQL | [https://github.com/pgvector/pgvector](https://github.com/pgvector/pgvector) | | **[PostGIS](postgis)** | Geospatial database extension for PostgreSQL | [https://postgis.net/](https://postgis.net/) | +| **[Timescaledb](timescaledb)** | Time-series database for PostgreSQL | [https://github.com/timescale/timescaledb/](https://github.com/timescale/timescaledb/) | Extensions are provided only for the OS versions already built by the From 52edf013e2a9acc0f364eed4d635007af245a389 Mon Sep 17 00:00:00 2001 From: Husn E Rabbi Date: Tue, 16 Dec 2025 08:25:49 +0500 Subject: [PATCH 5/5] fix: restore *shared to postgis Signed-off-by: Husn E Rabbi --- .github/workflows/bake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 6090ecd..f42fc08 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -49,6 +49,7 @@ jobs: - *shared postgis: - 'postgis/**' + - *shared timescaledb: - 'timescaledb/**' - *shared @@ -91,4 +92,4 @@ jobs: with: extension_name: ${{ matrix.extension }} secrets: - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} \ No newline at end of file