Git Product home page Git Product logo

cloudnative-pg-timescaledb-postgis-containers's Introduction

cloudnative-pg-timescaledb-postgis-containers

Operand images for CloudNativePG containing PostgreSQL with TimescaleDB and PostGIS

Immutable Application Containers for all available PostgreSQL versions (12 to 16) + TimescaleDB + PostGIS to be used as operands with the CloudNativePG operator for Kubernetes.

These images are built on top of the PostGIS image (Debian version), by adding the following software:

  • TimescaleDB
  • Barman Cloud
  • PGAudit

Barman Cloud is distributed by EnterpriseDB under the GNU GPL 3 License.

PGAudit is distributed under the PostgreSQL License.

Images are available via the GitHub Container Registry.

How to use them

The following example shows how you can easily create a new PostgreSQL 14 cluster with TimescaleDB 2.10 and PostGIS 3.3 in it. All you have to do is set the imageName accordingly. Please look at the registry for a list of available images and select the one you need.

Create a YAML manifest. For example, you can put the YAML below into a file named timescaledb-postgis.yaml (any name is fine). (Please refer to CloudNativePG for details on the API):

apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
  name: cluster-example
spec:
  instances: 1
  imageName: ghcr.io/imusmanmalik/timescaledb-postgis:14-3.3
  bootstrap:
    initdb:
      postInitTemplateSQL:
        - CREATE EXTENSION timescaledb;
        - CREATE EXTENSION postgis;
        - CREATE EXTENSION postgis_topology;
        - CREATE EXTENSION fuzzystrmatch;
        - CREATE EXTENSION postgis_tiger_geocoder;
  postgresql:
    shared_preload_libraries:
      - timescaledb
  storage:
    size: 1Gi

Then run kubectl apply -f timescaledb-postgis.yaml.

When the cluster is up, run the following command to verify the version of PostGIS that is available in the system, by connecting to the app database:

kubectl exec -ti cluster-example-1 -- psql app
Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
psql (14.7 (Debian 14.7-1.pgdg110+1))
Type "help" for help.

app=# SELECT * FROM pg_available_extensions WHERE name ~ '^postgis' ORDER BY 1;
           name           | default_version | installed_version |                          comment

--------------------------+-----------------+-------------------+----------------------------------------------------
--------
 postgis                  | 3.3.2           | 3.3.2             | PostGIS geometry and geography spatial types and fu
nctions
 postgis-3                | 3.3.2           |                   | PostGIS geometry and geography spatial types and fu
nctions
 postgis_raster           | 3.3.2           |                   | PostGIS raster types and functions
 postgis_raster-3         | 3.3.2           |                   | PostGIS raster types and functions
 postgis_sfcgal           | 3.3.2           |                   | PostGIS SFCGAL functions
 postgis_sfcgal-3         | 3.3.2           |                   | PostGIS SFCGAL functions
 postgis_tiger_geocoder   | 3.3.2           | 3.3.2             | PostGIS tiger geocoder and reverse geocoder
 postgis_tiger_geocoder-3 | 3.3.2           |                   | PostGIS tiger geocoder and reverse geocoder
 postgis_topology         | 3.3.2           | 3.3.2             | PostGIS topology spatial types and functions
 postgis_topology-3       | 3.3.2           |                   | PostGIS topology spatial types and functions
(10 rows)

app=# SELECT * FROM pg_available_extensions WHERE name ~ '^timescaledb' ORDER BY 1;
        name         | default_version | installed_version |                                        comment

---------------------+-----------------+-------------------+---------------------------------------------------------
------------------------------
 timescaledb         | 2.10.0          | 2.10.0            | Enables scalable inserts and complex queries for time-se
ries data
 timescaledb_toolkit | 1.14.0          |                   | Library of analytical hyperfunctions, time-series pipeli
ning, and other SQL utilities
(2 rows)

The following command shows the extensions installed in the app database, thanks to the postInitTemplateSQL section in the bootstrap which runs the selected CREATE EXTENSION commands in the template1 database, which is inherited by the application database - called app and created by default by CloudNativePG.

app=# \dx
                                           List of installed extensions
          Name          | Version |   Schema   |                            Description
------------------------+---------+------------+-------------------------------------------------------------------
 fuzzystrmatch          | 1.1     | public     | determine similarities and distance between strings
 plpgsql                | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis                | 3.3.2   | public     | PostGIS geometry and geography spatial types and functions
 postgis_tiger_geocoder | 3.3.2   | tiger      | PostGIS tiger geocoder and reverse geocoder
 postgis_topology       | 3.3.2   | topology   | PostGIS topology spatial types and functions
 timescaledb            | 2.10.0  | public     | Enables scalable inserts and complex queries for time-series data
(6 rows)

You can now enjoy TimescaleDB and PostGIS!

License and copyright

This software is available under Apache License 2.0.

cloudnative-pg-timescaledb-postgis-containers's People

Contributors

bkief avatar dependabot[bot] avatar imusmanmalik avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cloudnative-pg-timescaledb-postgis-containers's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

dockerfile
TimescaleDB-PostGIS/12/Dockerfile
  • postgis/postgis 12-3.3
TimescaleDB-PostGIS/13/Dockerfile
  • postgis/postgis 13-3.3
TimescaleDB-PostGIS/14/Dockerfile
  • postgis/postgis 14-3.3
TimescaleDB-PostGIS/15/Dockerfile
  • postgis/postgis 15-3.3
TimescaleDB-PostGIS/Dockerfile.template
github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • actions/checkout v3
  • docker/setup-qemu-action v2
  • docker/setup-buildx-action v2
  • docker/login-action v2
  • docker/build-push-action v4
  • erzz/dockle-action v1
  • docker/build-push-action v4
.github/workflows/update.yml
  • actions/checkout v3
  • nick-fields/retry v2
  • benjefferies/branch-protection-bot 1.0.7
  • EndBug/add-and-commit v9
  • benjefferies/branch-protection-bot 1.0.7
pip_requirements
TimescaleDB-PostGIS/12/requirements.txt
  • argcomplete ==2.0.0
  • azure-core ==1.26.3
  • azure-identity ==1.12.0
  • azure-storage-blob ==12.15.0
  • barman ==3.4.0
  • boto3 ==1.26.83
  • botocore ==1.29.83
  • cachetools ==5.3.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==3.0.1
  • cryptography ==39.0.2
  • google-api-core ==2.11.0
  • google-auth ==2.16.2
  • google-cloud-core ==2.3.2
  • google-cloud-storage ==2.7.0
  • google-crc32c ==1.5.0
  • google-resumable-media ==2.4.1
  • googleapis-common-protos ==1.58.0
  • idna ==3.4
  • isodate ==0.6.1
  • jmespath ==1.0.1
  • msal ==1.21.0
  • msal-extensions ==1.0.0
  • portalocker ==2.7.0
  • protobuf ==4.22.0
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pyjwt ==2.6.0
  • python-dateutil ==2.8.2
  • python-snappy ==0.6.1
  • requests ==2.28.2
  • rsa ==4.9
  • s3transfer ==0.6.0
  • six ==1.16.0
  • typing-extensions ==4.5.0
  • urllib3 ==1.26.14
TimescaleDB-PostGIS/13/requirements.txt
  • argcomplete ==2.0.0
  • azure-core ==1.26.3
  • azure-identity ==1.12.0
  • azure-storage-blob ==12.15.0
  • barman ==3.4.0
  • boto3 ==1.26.83
  • botocore ==1.29.83
  • cachetools ==5.3.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==3.0.1
  • cryptography ==39.0.2
  • google-api-core ==2.11.0
  • google-auth ==2.16.2
  • google-cloud-core ==2.3.2
  • google-cloud-storage ==2.7.0
  • google-crc32c ==1.5.0
  • google-resumable-media ==2.4.1
  • googleapis-common-protos ==1.58.0
  • idna ==3.4
  • isodate ==0.6.1
  • jmespath ==1.0.1
  • msal ==1.21.0
  • msal-extensions ==1.0.0
  • portalocker ==2.7.0
  • protobuf ==4.22.0
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pyjwt ==2.6.0
  • python-dateutil ==2.8.2
  • python-snappy ==0.6.1
  • requests ==2.28.2
  • rsa ==4.9
  • s3transfer ==0.6.0
  • six ==1.16.0
  • typing-extensions ==4.5.0
  • urllib3 ==1.26.14
TimescaleDB-PostGIS/14/requirements.txt
  • argcomplete ==2.0.0
  • azure-core ==1.26.3
  • azure-identity ==1.12.0
  • azure-storage-blob ==12.15.0
  • barman ==3.4.0
  • boto3 ==1.26.83
  • botocore ==1.29.83
  • cachetools ==5.3.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==3.0.1
  • cryptography ==39.0.2
  • google-api-core ==2.11.0
  • google-auth ==2.16.2
  • google-cloud-core ==2.3.2
  • google-cloud-storage ==2.7.0
  • google-crc32c ==1.5.0
  • google-resumable-media ==2.4.1
  • googleapis-common-protos ==1.58.0
  • idna ==3.4
  • isodate ==0.6.1
  • jmespath ==1.0.1
  • msal ==1.21.0
  • msal-extensions ==1.0.0
  • portalocker ==2.7.0
  • protobuf ==4.22.0
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pyjwt ==2.6.0
  • python-dateutil ==2.8.2
  • python-snappy ==0.6.1
  • requests ==2.28.2
  • rsa ==4.9
  • s3transfer ==0.6.0
  • six ==1.16.0
  • typing-extensions ==4.5.0
  • urllib3 ==1.26.14
TimescaleDB-PostGIS/15/requirements.txt
  • argcomplete ==2.0.0
  • azure-core ==1.26.3
  • azure-identity ==1.12.0
  • azure-storage-blob ==12.15.0
  • barman ==3.4.0
  • boto3 ==1.26.83
  • botocore ==1.29.83
  • cachetools ==5.3.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==3.0.1
  • cryptography ==39.0.2
  • google-api-core ==2.11.0
  • google-auth ==2.16.2
  • google-cloud-core ==2.3.2
  • google-cloud-storage ==2.7.0
  • google-crc32c ==1.5.0
  • google-resumable-media ==2.4.1
  • googleapis-common-protos ==1.58.0
  • idna ==3.4
  • isodate ==0.6.1
  • jmespath ==1.0.1
  • msal ==1.21.0
  • msal-extensions ==1.0.0
  • portalocker ==2.7.0
  • protobuf ==4.22.0
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pyjwt ==2.6.0
  • python-dateutil ==2.8.2
  • python-snappy ==0.6.1
  • requests ==2.28.2
  • rsa ==4.9
  • s3transfer ==0.6.0
  • six ==1.16.0
  • typing-extensions ==4.5.0
  • urllib3 ==1.26.14
TimescaleDB-PostGIS/src/requirements.txt
  • argcomplete ==2.0.0
  • azure-core ==1.26.3
  • azure-identity ==1.12.0
  • azure-storage-blob ==12.15.0
  • barman ==3.4.0
  • boto3 ==1.26.83
  • botocore ==1.29.83
  • cachetools ==5.3.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==3.0.1
  • cryptography ==39.0.2
  • google-api-core ==2.11.0
  • google-auth ==2.16.2
  • google-cloud-core ==2.3.2
  • google-cloud-storage ==2.7.0
  • google-crc32c ==1.5.0
  • google-resumable-media ==2.4.1
  • googleapis-common-protos ==1.58.0
  • idna ==3.4
  • isodate ==0.6.1
  • jmespath ==1.0.1
  • msal ==1.21.0
  • msal-extensions ==1.0.0
  • portalocker ==2.7.0
  • protobuf ==4.22.0
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pyjwt ==2.6.0
  • python-dateutil ==2.8.2
  • python-snappy ==0.6.1
  • requests ==2.28.2
  • rsa ==4.9
  • s3transfer ==0.6.0
  • six ==1.16.0
  • typing-extensions ==4.5.0
  • urllib3 ==1.26.14

  • Check this box to trigger a request for Renovate to run again on this repository

Add Timescale Tagging

Consider adding the Timescale version to the image tag name. I am finding out (the hard way) that restoring a backup from running an image with and older version of Timescale is a challenge. Ideally the backup should restore to a server with the same Timescale version.

Add PG16

At first glance, it looks like it just requires the addition of a 16 folder. Is that correct?

timescaledb-postgis:16 for ARM64 not working

Docker manifest inspect provides an image availability for ARM64 arch.
However when run on "amzn2.aarch64" / m6g, the initdb returns exec format error, so it is probably built for AMD not ARM.

initdb Error: error while creating the PostgreSQL instance: fork/exec /usr/lib/postgresql/16/bin/initdb: exec format error 
โžœ  ~ docker manifest inspect ghcr.io/imusmanmalik/timescaledb-postgis:16  
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 4666,
         "digest": "sha256:8da5df8587c1612e016efc47e2c21f16cb238f3b4d1f6a726272575fd74bda2c",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 4666,
         "digest": "sha256:df5eda79879c7a84373388ae0a3ef2bdfb0f4de7f6230c7d55acc3614035f68f",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 567,
         "digest": "sha256:be01511e6509f95cbdcd199c3fd15945b56461a497f80b3dc110e1be30d4744f",
         "platform": {
            "architecture": "unknown",
            "os": "unknown"
         }
      },
      {
         "mediaType": "application/vnd.oci.image.manifest.v1+json",
         "size": 567,
         "digest": "sha256:9b70bfd272398703c8c74de819a9efc245d4f32adcb861ff3b2444824017599c",
         "platform": {
            "architecture": "unknown",
            "os": "unknown"
         }
      }
   ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.