generated from cloudnative-pg/cnpg-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Add TimescaleDB PostgreSQL extension #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shusaan
wants to merge
11
commits into
cloudnative-pg:main
Choose a base branch
from
shusaan:timescaledb
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
21708c3
feat: add Dockerfile, README, and metadata for TimescaleDB extension
shusaan d3a65be
feat: add TimescaleDB to workflow options and update filters
shusaan 5a32aee
feat: add TimescaleDB to workflow options and update filters
shusaan 36b4934
feat: add TimescaleDB to workflow options and update filters
shusaan 33e38bd
Merge branch 'timescaledb' of github.com:shusaan/postgres-extensions-…
shusaan fbb5491
fix: remove redundant postgresql section in README.md
shusaan d6303c4
Merge branch 'main' into timescaledb
shusaan 52732d4
Merge branch 'main' into timescaledb
shusaan bcd3d83
add timescaledb in README
shusaan 88cfa66
Merge branch 'main' into timescaledb
shusaan 52edf01
fix: restore *shared to postgis
shusaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # 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' | ||
|
|
||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
| } | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.