├── .dockerignore ├── .github └── workflows │ ├── docker-branch.yml │ ├── docker-image.yml │ ├── issues.yml │ └── smoke-test.yml ├── .gitignore ├── .gitpod.yaml ├── .gitpod.yml ├── CHANGELOG.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── bitnami ├── .dockerignore ├── Dockerfile ├── Makefile └── timescaledb-bitnami-entrypoint.sh ├── docker-compose.yml ├── docker-entrypoint-initdb.d ├── 000_install_timescaledb.sh └── 001_timescaledb_tune.sh └── docs └── version-policy.md /.dockerignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .build_* 3 | data 4 | pgdata -------------------------------------------------------------------------------- /.github/workflows/docker-branch.yml: -------------------------------------------------------------------------------- 1 | # Workflow to build docker images for a specific branch 2 | # 3 | # You can use the GitHub CLI to trigger this workflow like so: 4 | # gh workflow run docker-branch.yml -R timescale/timescaledb-docker -f branch=1-step-policy-alpha 5 | # 6 | # The built images will be uploaded to our timescaledev account on dockerhub. 7 | # You can view them here: https://hub.docker.com/r/timescaledev/timescaledb/tags 8 | # 9 | name: Docker Image for specific branch 10 | 11 | on: 12 | workflow_dispatch: 13 | inputs: 14 | branch: 15 | description: 'branch or tag to build' 16 | required: true 17 | 18 | env: 19 | ORG: samagragovernance 20 | TS_VERSION: main 21 | PLATFORM: linux/amd64 22 | 23 | jobs: 24 | 25 | # Build ubuntu TimescaleDB images for both TSL and OSS code. 26 | timescaledb: 27 | 28 | name: Docker ${{ github.event.inputs.branch }} PG${{ matrix.pg }} 29 | runs-on: ubuntu-latest 30 | strategy: 31 | fail-fast: false 32 | matrix: 33 | pg: [15] 34 | 35 | steps: 36 | - uses: actions/checkout@v3 37 | 38 | - name: Set up Docker Buildx 39 | id: buildx 40 | uses: docker/setup-buildx-action@v1 41 | 42 | - name: Linux available buildx platforms 43 | run: echo ${{ steps.buildx.outputs.platforms }} 44 | 45 | - name: Linux available buildx platforms 46 | run: echo ${TS_VERSION} 47 | 48 | - name: Login to DockerHub Registry 49 | run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin 50 | 51 | - name: Build and push nightly Docker image for Postgres 52 | run: make multi ORG=$ORG PG_VER=pg${{ matrix.pg }} TS_VERSION="${TS_VERSION}" PLATFORM=$PLATFORM TAG="-t samagragovernance/postgres:branch-${TS_VERSION}-pg${{ matrix.pg }}" 53 | 54 | -------------------------------------------------------------------------------- /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Tagged Release Docker Image 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | version: 6 | description: 'Version to release' 7 | required: true 8 | ORG: 9 | description: 'the organization for tagging Docker images' 10 | required: true 11 | default: "samagragovernance" 12 | tag_latest: 13 | description: 'Tag the published images as latest' 14 | type: boolean 15 | required: false 16 | default: false 17 | ts_version: 18 | description: 'TS version to be used' 19 | required: false 20 | default: "" 21 | env: 22 | ORG: ${{inputs.ORG}} 23 | TS_VERSION: ${{inputs.ts_version}} 24 | PRE_RELEASE: "true" # prevents the latest tag from being pushed. 25 | jobs: 26 | 27 | # Build multi-arch TimescaleDB images for both TSL and OSS code. 28 | postgres: 29 | 30 | name: PG${{ matrix.pg }}${{ matrix.oss }} 31 | runs-on: ubuntu-latest 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | pg: [14, 15, 16] 36 | oss: [ "", "-oss" ] 37 | steps: 38 | - uses: actions/checkout@v3 39 | with: 40 | ref: ${{inputs.version}} 41 | 42 | - name: Set up QEMU 43 | uses: docker/setup-qemu-action@v1 44 | with: 45 | platforms: all 46 | 47 | - name: Set up Docker Buildx 48 | id: buildx 49 | uses: docker/setup-buildx-action@v1 50 | 51 | - name: Available platforms 52 | run: echo ${{ steps.buildx.outputs.platforms }} 53 | 54 | - name: Login to DockerHub Registry 55 | run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin 56 | 57 | - name: Build and push multi-platform Docker image for postgres 58 | run: | 59 | if [ "${{inputs.tag_latest}}" == "true" ]; then 60 | export PRE_RELEASE='' 61 | fi 62 | make multi${{ matrix.oss }} ORG="$ORG" PG_VER="pg${{ matrix.pg }}" \ 63 | ${TS_VERSION:+TS_VERSION="$TS_VERSION"} PREV_EXTRA="${{ matrix.oss }}" PRE_RELEASE="$PRE_RELEASE" 64 | # Build bitnami images of TimscaleDB. 65 | # The images are built only for amd64, since it is the only supported architecture in the base image bitname/postgresql. 66 | # The images are only built for TSL code. 67 | timescaledb-bitnami: 68 | 69 | name: PG${{ matrix.pg }}-bitnami 70 | runs-on: ubuntu-latest 71 | strategy: 72 | fail-fast: false 73 | matrix: 74 | pg: [13, 14, 15] 75 | 76 | steps: 77 | - uses: actions/checkout@v3 78 | with: 79 | ref: ${{inputs.version}} 80 | 81 | - name: Login to DockerHub Registry 82 | run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin 83 | 84 | - name: Build and push amd64 Docker image for TimescaleDB bitnami 85 | run: | 86 | if [ "${{inputs.tag_latest}}" == "true" ]; then 87 | export PRE_RELEASE='' 88 | fi 89 | make push ORG="$ORG" PG_VER="pg${{ matrix.pg }}" ${TS_VERSION:+TS_VERSION="$TS_VERSION"} PRE_RELEASE="$PRE_RELEASE" 90 | working-directory: bitnami -------------------------------------------------------------------------------- /.github/workflows/issues.yml: -------------------------------------------------------------------------------- 1 | name: Add bugs to bugs project 2 | 3 | on: 4 | issues: 5 | types: [ opened ] 6 | 7 | jobs: 8 | add-to-project: 9 | name: Add issue to project 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/add-to-project@v0.1.0 13 | with: 14 | project-url: https://github.com/orgs/timescale/projects/55 15 | github-token: ${{ secrets.ORG_AUTOMATION_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/smoke-test.yml: -------------------------------------------------------------------------------- 1 | name: Smoke Test Docker Image 2 | on: 3 | pull_request: 4 | push: 5 | branches: 6 | - master 7 | 8 | env: 9 | ORG: timescaledev 10 | TS_VERSION: main 11 | PLATFORM: linux/amd64 12 | 13 | jobs: 14 | smoketest: 15 | name: PG${{ matrix.pg }}-${{ matrix.type }}${{ matrix.oss }} 16 | runs-on: ubuntu-latest 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | pg: [14, 15, 16] 21 | type: ['alpine', 'bitnami'] 22 | oss: [ "", "-oss" ] 23 | steps: 24 | - name: Check out the source 25 | uses: actions/checkout@v3 26 | 27 | - name: Build Docker Alpine Image 28 | if: matrix.type == 'alpine' 29 | run: | 30 | make image${{ matrix.oss }} PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image PRE_RELEASE=1 TAG_OSS='-t smoketest-image' 31 | - name: Build Docker Bitnami Image 32 | if: matrix.type == 'bitnami' 33 | run: | 34 | cd bitnami 35 | make image PG_VER=pg${{ matrix.pg }} TAG_VERSION=smoketest-image PRE_RELEASE=1 36 | 37 | - name: Install psql 38 | run: sudo apt install postgresql-client 39 | 40 | - name: Run the smoke test 41 | run: | 42 | set -eu 43 | export PGHOST=localhost 44 | export PGUSER=postgres 45 | export PGPASSWORD=test1234 46 | docker container stop smoketest-container || true 47 | docker container rm smoketest-container || true 48 | docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=${PGPASSWORD} --name smoketest-container smoketest-image 49 | for _ in {1..120} 50 | do 51 | if [ -z "$(docker container ls -q --filter name=smoketest-container)" ] 52 | then 53 | echo "Smoketest container is not running" 54 | exit 1 55 | fi 56 | if psql -c "select 1" 57 | then 58 | echo "Test pg_cron Extension" 59 | psql -c "CREATE EXTENSION pg_cron"; 60 | psql -c "SELECT cron.schedule('30 3 * * 6',\$\$DELETE FROM events WHERE event_time < now() - interval '1 week'\$\$)"; 61 | 62 | echo "Test PostGIS Extension" 63 | psql -c "CREATE EXTENSION postgis;" || true 64 | psql -c "SELECT PostGIS_Version();" 65 | 66 | echo "Test PostGIS Geometry Function" 67 | psql -c "CREATE TABLE test_geometry_table (id serial primary key, geom geometry(Point, 4326));" 68 | psql -c "INSERT INTO test_geometry_table (geom) VALUES (ST_GeomFromText('POINT(0 0)', 4326));" 69 | psql -c "SELECT * FROM test_geometry_table;" 70 | 71 | echo "Test HyperLogLog Extension" 72 | psql -c "CREATE EXTENSION hll;" 73 | psql -c "select hll_hash_text('hello world');" 74 | 75 | echo "Test Citus Extension" 76 | psql -c "CREATE EXTENSION citus;" 77 | psql -c "SELECT * FROM citus_version();" 78 | 79 | echo "Test Citus Distributed Table" 80 | psql -c "CREATE TABLE test_distributed_table (id serial primary key, data text);" 81 | psql -c "SELECT create_distributed_table('test_distributed_table', 'id');" 82 | psql -c "INSERT INTO test_distributed_table (data) VALUES ('test data');" 83 | psql -c "SELECT * FROM test_distributed_table;" 84 | 85 | echo "Test pg_repack Extension" 86 | psql -c "CREATE EXTENSION pg_repack;" 87 | psql -c "select repack.version(), repack.version_sql();" 88 | 89 | echo "Test pgautofailover Extension" 90 | psql -c "CREATE EXTENSION pgautofailover CASCADE;" 91 | psql -c "SELECT pgautofailover.formation_settings();" 92 | 93 | echo "Test pg_jobmon Extension" 94 | psql -c " CREATE SCHEMA jobmon;" 95 | psql -c "CREATE EXTENSION pg_jobmon SCHEMA jobmon cascade;" 96 | 97 | echo "Test pg_partman Extension" 98 | psql -c "CREATE SCHEMA partman;" 99 | psql -c "CREATE EXTENSION pg_partman SCHEMA partman;" 100 | 101 | echo "Test pg_bestmatch Extension" 102 | psql -c "CREATE EXTENSION pg_bestmatch;" 103 | psql -c "SET search_path TO public, bm_catalog;" 104 | 105 | break 106 | fi 107 | sleep 1 108 | done 109 | if ! psql -c "select 1" 110 | then 111 | echo "Cannot connect to PostgreSQL" 112 | exit 1 113 | fi 114 | 115 | - name: Show the logs 116 | if: always() 117 | run: | 118 | docker logs smoketest-container 119 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | /.build_* 3 | */.build_* 4 | 5 | data 6 | -------------------------------------------------------------------------------- /.gitpod.yaml: -------------------------------------------------------------------------------- 1 | image: 2 | file: Dockerfile 3 | 4 | tasks: 5 | - init: echo "Building the Docker image..." 6 | command: PG_VERSION=15 docker build -t merged_image . 7 | 8 | - init: echo "Running the Docker container..." 9 | command: docker run --name merged_container -d merged_image 10 | 11 | - init: echo "Inspecting the running container..." 12 | command: docker ps 13 | 14 | ports: 15 | - port: 5432 16 | onOpen: ignore -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | # This configuration file was automatically generated by Gitpod. 2 | # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) 3 | # and commit this file to your remote git repository to share the goodness with others. 4 | 5 | # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart 6 | 7 | tasks: 8 | - init: make 9 | 10 | 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). For additional details, refer to our [versioning policy](./docs/version-policy.md). 7 | 8 | 9 | ## [Unreleased] 10 | ### Added 11 | ### Changed 12 | ### Deprecated 13 | ### Removed 14 | ### Fixed 15 | ### Security 16 | 17 | ## [Version] - YYYY-MM-DD -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PG_VERSION 2 | ARG PREV_IMAGE 3 | ARG TS_VERSION 4 | ############################ 5 | # Build tools binaries in separate image 6 | ############################ 7 | ARG GO_VERSION=1.23 8 | FROM golang:${GO_VERSION}-alpine AS tools 9 | 10 | ENV TOOLS_VERSION 0.8.1 11 | 12 | RUN apk update && apk add --no-cache git gcc musl-dev \ 13 | && go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest \ 14 | && go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest 15 | 16 | ############################ 17 | # Grab old versions from previous version 18 | ############################ 19 | ARG PG_VERSION 20 | ARG PREV_IMAGE 21 | FROM ${PREV_IMAGE} AS oldversions 22 | # Remove update files, mock files, and all but the last 5 .so/.sql files 23 | RUN rm -f $(pg_config --sharedir)/extension/timescaledb*mock*.sql \ 24 | && if [ -f $(pg_config --pkglibdir)/timescaledb-tsl-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-tsl-1*.so | head -n -5); fi \ 25 | && if [ -f $(pg_config --pkglibdir)/timescaledb-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-*.so | head -n -5); fi \ 26 | && if [ -f $(pg_config --sharedir)/extension/timescaledb--1*.sql ]; then rm -f $(ls -1 $(pg_config --sharedir)/extension/timescaledb--1*.sql | head -n -5); fi 27 | 28 | ############################ 29 | # Now build image and copy in tools 30 | ############################ 31 | ARG PG_VERSION 32 | FROM postgres:${PG_VERSION}-alpine3.18 33 | ARG OSS_ONLY 34 | 35 | LABEL maintainer="Timescale https://www.timescale.com" 36 | 37 | COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ 38 | COPY --from=tools /go/bin/* /usr/local/bin/ 39 | COPY --from=oldversions /usr/local/lib/postgresql/timescaledb-*.so /usr/local/lib/postgresql/ 40 | COPY --from=oldversions /usr/local/share/postgresql/extension/timescaledb--*.sql /usr/local/share/postgresql/extension/ 41 | 42 | ARG TS_VERSION 43 | RUN set -ex \ 44 | && apk add libssl1.1 \ 45 | && apk add --no-cache --virtual .fetch-deps \ 46 | ca-certificates \ 47 | git \ 48 | openssl \ 49 | openssl-dev \ 50 | tar \ 51 | && mkdir -p /build/ \ 52 | && git clone https://github.com/timescale/timescaledb /build/timescaledb \ 53 | \ 54 | && apk add --no-cache --virtual .build-deps \ 55 | coreutils \ 56 | dpkg-dev dpkg \ 57 | gcc \ 58 | krb5-dev \ 59 | libc-dev \ 60 | make \ 61 | cmake \ 62 | util-linux-dev \ 63 | \ 64 | # Build current version \ 65 | && cd /build/timescaledb && rm -fr build \ 66 | && git checkout ${TS_VERSION} \ 67 | && ./bootstrap -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF -DGENERATE_DOWNGRADE_SCRIPT=ON -DWARNINGS_AS_ERRORS=OFF -DPROJECT_INSTALL_METHOD="docker"${OSS_ONLY} \ 68 | && cd build && make install \ 69 | && cd ~ \ 70 | \ 71 | && if [ "${OSS_ONLY}" != "" ]; then rm -f $(pg_config --pkglibdir)/timescaledb-tsl-*.so; fi \ 72 | && apk del .fetch-deps .build-deps \ 73 | && rm -rf /build \ 74 | && sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample 75 | 76 | 77 | # Update to shared_preload_libraries 78 | RUN echo "shared_preload_libraries = 'citus,timescaledb,pg_cron,pgautofailover'" >> /usr/local/share/postgresql/postgresql.conf.sample 79 | # Adding PG Vector 80 | 81 | RUN cd /tmp 82 | RUN apk add --no-cache --virtual .build-deps \ 83 | coreutils \ 84 | dpkg-dev dpkg \ 85 | gcc \ 86 | git \ 87 | krb5-dev \ 88 | libc-dev \ 89 | llvm15 \ 90 | clang \ 91 | clang15 \ 92 | make \ 93 | cmake \ 94 | util-linux-dev \ 95 | && git clone --branch v0.7.0 https://github.com/pgvector/pgvector.git \ 96 | && cd /pgvector \ 97 | && ls \ 98 | && make \ 99 | && make install 100 | 101 | # Adding pg_cron 102 | ARG PG_CRON_VERSION 103 | 104 | RUN set -ex \ 105 | && cd /tmp\ 106 | && apk add --no-cache --virtual .pg_cron-deps \ 107 | ca-certificates \ 108 | openssl \ 109 | tar \ 110 | && apk add --no-cache --virtual .pg_cron-build-deps \ 111 | autoconf \ 112 | automake \ 113 | g++ \ 114 | clang15 \ 115 | llvm15 \ 116 | libtool \ 117 | libxml2-dev \ 118 | make \ 119 | perl \ 120 | && wget -O pg_cron.tar.gz "https://github.com/citusdata/pg_cron/archive/refs/tags/${PG_CRON_VERSION}.tar.gz" \ 121 | && mkdir -p /tmp/pg_cron \ 122 | && tar \ 123 | --extract \ 124 | --file pg_cron.tar.gz \ 125 | --directory /tmp/pg_cron \ 126 | --strip-components 1 \ 127 | && cd /tmp/pg_cron \ 128 | && make \ 129 | && make install \ 130 | # clean 131 | && cd / \ 132 | && rm /tmp/pg_cron.tar.gz \ 133 | && rm -rf /tmp/pg_cron \ 134 | && apk del .pg_cron-deps .pg_cron-build-deps 135 | 136 | # Add PostGIS Extension 137 | ARG POSTGIS_VERSION 138 | 139 | RUN set -eux \ 140 | && apk add --no-cache --virtual .fetch-deps \ 141 | ca-certificates \ 142 | openssl \ 143 | tar \ 144 | \ 145 | && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ 146 | && mkdir -p /usr/src/postgis \ 147 | && tar \ 148 | --extract \ 149 | --file postgis.tar.gz \ 150 | --directory /usr/src/postgis \ 151 | --strip-components 1 \ 152 | && rm postgis.tar.gz \ 153 | \ 154 | && apk add --no-cache --virtual .build-deps \ 155 | \ 156 | gdal-dev \ 157 | geos-dev \ 158 | proj-dev \ 159 | autoconf \ 160 | automake \ 161 | clang15 \ 162 | cunit-dev \ 163 | file \ 164 | g++ \ 165 | gcc \ 166 | gettext-dev \ 167 | git \ 168 | json-c-dev \ 169 | libtool \ 170 | libxml2-dev \ 171 | llvm15-dev \ 172 | make \ 173 | pcre-dev \ 174 | perl \ 175 | protobuf-c-dev \ 176 | \ 177 | # build PostGIS 178 | \ 179 | && cd /usr/src/postgis \ 180 | && gettextize \ 181 | && ./autogen.sh \ 182 | && ./configure \ 183 | --with-pcredir="$(pcre-config --prefix)" \ 184 | && make -j$(nproc) \ 185 | && make install \ 186 | \ 187 | # add .postgis-rundeps 188 | && apk add --no-cache --virtual .postgis-rundeps \ 189 | \ 190 | gdal \ 191 | geos \ 192 | proj \ 193 | \ 194 | json-c \ 195 | libstdc++ \ 196 | pcre \ 197 | protobuf-c \ 198 | \ 199 | ca-certificates \ 200 | # clean 201 | && cd / \ 202 | && rm -rf /usr/src/postgis \ 203 | && apk del .fetch-deps .build-deps 204 | 205 | ## Adding Citus 206 | 207 | ARG CITUS_VERSION 208 | # Install Citus dependencies 209 | RUN set -ex \ 210 | && apk add --no-cache --virtual .citus-deps \ 211 | curl \ 212 | jq \ 213 | # Install Citus 214 | && apk add --no-cache --virtual .citus-build-deps \ 215 | gcc \ 216 | libc-dev \ 217 | make \ 218 | curl-dev \ 219 | lz4-dev \ 220 | zstd-dev \ 221 | clang15 \ 222 | krb5-dev \ 223 | icu-dev \ 224 | libxslt-dev \ 225 | libxml2-dev \ 226 | llvm15-dev \ 227 | && CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \ 228 | && curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \ 229 | && tar -C /tmp -xvf /tmp/citus.tar.gz \ 230 | && chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \ 231 | && cd /tmp/citus-${CITUS_VERSION} \ 232 | && PATH="/usr/local/pgsql/bin:$PATH" ./configure \ 233 | && make \ 234 | && make install \ 235 | && cd ~ \ 236 | && rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \ 237 | && apk del .citus-deps .citus-build-deps 238 | 239 | 240 | 241 | ## Adding pg_repack 242 | ARG PG_REPACK_VERSION 243 | RUN set -eux \ 244 | && apk add --no-cache --virtual .pg_repack-build-deps \ 245 | openssl-dev \ 246 | zstd-dev \ 247 | lz4-dev \ 248 | zlib-dev \ 249 | make \ 250 | clang15 \ 251 | gawk \ 252 | llvm15 \ 253 | gcc \ 254 | musl-dev \ 255 | # build pg_repack 256 | && wget -O /tmp/pg_repack-${PG_REPACK_VERSION}.zip "https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip" \ 257 | && unzip /tmp/pg_repack-${PG_REPACK_VERSION}.zip -d /tmp \ 258 | && cd /tmp/pg_repack-${PG_REPACK_VERSION} \ 259 | && make \ 260 | && make install \ 261 | # clean 262 | && cd / \ 263 | && rm -rf /tmp/pg_repack-${PG_REPACK_VERSION} /tmp/pg_repack.zip \ 264 | && apk del .pg_repack-build-deps 265 | 266 | # Adding pgautofailover 267 | ARG PG_AUTO_FAILOVER_VERSION 268 | RUN set -eux \ 269 | && apk add --no-cache --virtual .pg_auto_failover-build-deps \ 270 | make \ 271 | gcc \ 272 | musl-dev \ 273 | krb5-dev \ 274 | openssl-dev \ 275 | clang15 \ 276 | ncurses-dev \ 277 | linux-headers \ 278 | zstd-dev \ 279 | lz4-dev \ 280 | zlib-dev \ 281 | libedit-dev \ 282 | libxml2-utils \ 283 | libxslt-dev \ 284 | llvm15 \ 285 | # build pg_auto_failover 286 | && wget -O /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip "https://github.com/hapostgres/pg_auto_failover/archive/refs/tags/v${PG_AUTO_FAILOVER_VERSION}.zip" \ 287 | && unzip /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip -d /tmp \ 288 | && ls -alh /tmp \ 289 | && cd /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION} \ 290 | && make \ 291 | && make install \ 292 | # clean 293 | && cd / \ 294 | && rm -rf /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION} /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION}.zip \ 295 | && apk del .pg_auto_failover-build-deps 296 | 297 | ## Adding postgresql-hll 298 | ARG POSTGRES_HLL_VERSION 299 | RUN set -eux \ 300 | && apk add --no-cache --virtual .postgresql-hll-build-deps \ 301 | openssl-dev \ 302 | zstd-dev \ 303 | lz4-dev \ 304 | zlib-dev \ 305 | make \ 306 | git \ 307 | clang15 \ 308 | gawk \ 309 | llvm15 \ 310 | g++ \ 311 | musl-dev \ 312 | # build postgresql-hll 313 | && wget -O /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip "https://github.com/citusdata/postgresql-hll/archive/refs/tags/v${POSTGRES_HLL_VERSION}.zip" \ 314 | && unzip /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip -d /tmp \ 315 | && cd /tmp/postgresql-hll-${POSTGRES_HLL_VERSION} \ 316 | && make \ 317 | && make install \ 318 | # clean 319 | && cd / \ 320 | && rm -rf /tmp/postgresql-hll-${POSTGRES_HLL_VERSION} /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip \ 321 | && apk del .postgresql-hll-build-deps 322 | 323 | # Install pg_jobmon 324 | ARG PG_JOBMON_VERSION 325 | RUN set -e \ 326 | \ 327 | && apk add --no-cache --virtual .pg_jobmon-deps \ 328 | ca-certificates \ 329 | openssl \ 330 | tar \ 331 | \ 332 | && cd /tmp\ 333 | && wget -O pg_jobmon.tar.gz "https://github.com/omniti-labs/pg_jobmon/archive/v$PG_JOBMON_VERSION.tar.gz" \ 334 | && mkdir -p /tmp/pg_jobmon \ 335 | && tar \ 336 | --extract \ 337 | --file pg_jobmon.tar.gz \ 338 | --directory /tmp/pg_jobmon \ 339 | --strip-components 1 \ 340 | \ 341 | && apk add --no-cache --virtual .pg_jobmon-build-deps \ 342 | autoconf \ 343 | automake \ 344 | g++ \ 345 | clang15 \ 346 | llvm15 \ 347 | libtool \ 348 | libxml2-dev \ 349 | make \ 350 | perl \ 351 | && cd /tmp/pg_jobmon \ 352 | && ls -alh . \ 353 | && make \ 354 | && make install \ 355 | && cd / \ 356 | && apk del .pg_jobmon-deps .pg_jobmon-build-deps \ 357 | && rm -rf /tmp/pg_jobmon \ 358 | && rm /tmp/pg_jobmon.tar.gz 359 | 360 | # Adding pg_partman 361 | ARG PG_PARTMAN_VERSION 362 | 363 | RUN set -e \ 364 | && cd /tmp\ 365 | && apk add --no-cache --virtual .pg_partman-deps \ 366 | ca-certificates \ 367 | openssl \ 368 | tar \ 369 | && apk add --no-cache --virtual .pg_partman-build-deps \ 370 | autoconf \ 371 | automake \ 372 | g++ \ 373 | clang15 \ 374 | llvm15 \ 375 | libtool \ 376 | libxml2-dev \ 377 | make \ 378 | perl \ 379 | && wget -O pg_partman.tar.gz "https://github.com/pgpartman/pg_partman/archive/v$PG_PARTMAN_VERSION.tar.gz" \ 380 | && mkdir -p /tmp/pg_partman \ 381 | && tar \ 382 | --extract \ 383 | --file pg_partman.tar.gz \ 384 | --directory /tmp/pg_partman \ 385 | --strip-components 1 \ 386 | && cd /tmp/pg_partman \ 387 | && make \ 388 | && make install \ 389 | # clean 390 | && cd / \ 391 | && rm /tmp/pg_partman.tar.gz \ 392 | && rm -rf /tmp/pg_partman \ 393 | && apk del .pg_partman-deps .pg_partman-build-deps 394 | 395 | ENV RUSTFLAGS="-C target-feature=-crt-static" 396 | ARG PG_BESTMATCH_RS_SHA 397 | ARG PG_VERSION 398 | RUN set -x && apk add --no-cache --virtual .pg_bestmatch-build-deps \ 399 | git \ 400 | curl \ 401 | build-base \ 402 | clang \ 403 | llvm \ 404 | && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ 405 | && export PATH="$HOME/.cargo/bin:$PATH" \ 406 | && rustup update stable \ 407 | && cd /tmp && git clone --branch main https://github.com/tensorchord/pg_bestmatch.git \ 408 | && ls -alh \ 409 | && cd pg_bestmatch \ 410 | && git checkout ${PG_BESTMATCH_RS_SHA} \ 411 | && export PATH="$HOME/.cargo/bin:$PATH" \ 412 | && cargo install --locked cargo-pgrx --version 0.12.0-alpha.1 \ 413 | && cargo pgrx init --pg${PG_VERSION}=$(which pg_config) \ 414 | && cargo pgrx install --release \ 415 | && cd .. \ 416 | && rm -rf ./pg_bestmatch \ 417 | && apk del .pg_bestmatch-build-deps -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | NAME=postgres 2 | # Default is to timescaledev to avoid unexpected push to the main repo 3 | # Set ORG to timescale in the caller 4 | ORG=samagragovernance 5 | PG_VER=pg15 6 | PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) 7 | TS_VERSION=2.13.0 8 | PG_CRON_VERSION=v1.6.0 9 | POSTGIS_VERSION=3.4.2 10 | CITUS_VERSION=12.1.0 11 | PG_REPACK_VERSION=1.5.0 12 | PG_AUTO_FAILOVER_VERSION=2.1 13 | POSTGRES_HLL_VERSION=2.18 14 | PG_JOBMON_VERSION=1.4.1 15 | PG_PARTMAN_VERSION=5.0.1 16 | PG_BESTMATCH_RS_SHA=312617392c8a32121907496f05c23fce1e3d056c 17 | PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!') 18 | PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)$(PREV_EXTRA)" 19 | PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "postgres:$(PG_VER_NUMBER)-alpine"; fi ) 20 | PLATFORM=linux/amd64,linux/arm64 21 | # Retrieve the latest Git tag for the current commit 22 | RELEASE_TAG = $(shell git describe --tags --abbrev=0 --exact-match HEAD 2>/dev/null) 23 | 24 | WARPSQL_VERSION := $(if $(RELEASE_TAG),$(RELEASE_TAG),dev-$(shell git rev-parse HEAD)) 25 | 26 | # Pre releases should not be tagged as latest, so PRE_RELEASE is used to track. 27 | PRE_RELEASE=$(shell echo "$(WARPSQL_VERSION)" | grep -Eo "alpha|beta|rc") 28 | 29 | # PUSH_MULTI can be set to nothing for dry-run without pushing during multi-arch build 30 | PUSH_MULTI=--push 31 | TAG_VERSION=$(ORG)/$(NAME):$(WARPSQL_VERSION)-pg$(PG_VER_NUMBER) 32 | TAG_LATEST=$(ORG)/$(NAME):latest-pg$(PG_VER_NUMBER) 33 | TAG=-t $(TAG_VERSION) $(if $(PRE_RELEASE),,-t $(TAG_LATEST)) 34 | TAG_OSS=-t $(TAG_VERSION)-oss $(if $(PRE_RELEASE),,-t $(TAG_LATEST)-oss) 35 | 36 | DOCKER_BUILD_ARGS = --build-arg TS_VERSION=$(TS_VERSION) \ 37 | --build-arg PG_VERSION=$(PG_VER_NUMBER) \ 38 | --build-arg PREV_IMAGE=$(PREV_IMAGE) \ 39 | --build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \ 40 | --build-arg PG_REPACK_VERSION=$(PG_REPACK_VERSION)\ 41 | --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \ 42 | --build-arg CITUS_VERSION=$(CITUS_VERSION) \ 43 | --build-arg PG_AUTO_FAILOVER_VERSION=$(PG_AUTO_FAILOVER_VERSION) \ 44 | --build-arg POSTGRES_HLL_VERSION=$(POSTGRES_HLL_VERSION)\ 45 | --build-arg PG_JOBMON_VERSION=$(PG_JOBMON_VERSION) \ 46 | --build-arg PG_PARTMAN_VERSION=$(PG_PARTMAN_VERSION) \ 47 | --build-arg PG_BESTMATCH_RS_SHA=$(PG_BESTMATCH_RS_SHA) 48 | 49 | 50 | 51 | default: image 52 | 53 | .multi_$(WARPSQL_VERSION)_$(PG_VER)_oss: Dockerfile 54 | docker buildx create --platform $(PLATFORM) --name multibuild --use 55 | docker buildx inspect multibuild --bootstrap 56 | docker buildx build --platform $(PLATFORM) \ 57 | --build-arg OSS_ONLY=" -DAPACHE_ONLY=1" \ 58 | $(DOCKER_BUILD_ARGS) \ 59 | $(TAG_OSS) $(PUSH_MULTI) . 60 | touch .multi_$(WARPSQL_VERSION)_$(PG_VER)_oss 61 | docker buildx rm multibuild 62 | 63 | .multi_$(WARPSQL_VERSION)_$(PG_VER): Dockerfile 64 | docker buildx create --platform $(PLATFORM) --name multibuild --use 65 | docker buildx inspect multibuild --bootstrap 66 | docker buildx build --platform $(PLATFORM) \ 67 | $(DOCKER_BUILD_ARGS) \ 68 | $(TAG) $(PUSH_MULTI) . 69 | touch .multi_$(WARPSQL_VERSION)_$(PG_VER) 70 | docker buildx rm multibuild 71 | 72 | .build_$(WARPSQL_VERSION)_$(PG_VER)_oss: Dockerfile 73 | docker build --build-arg OSS_ONLY=" -DAPACHE_ONLY=1" \ 74 | $(DOCKER_BUILD_ARGS) \ 75 | $(TAG_OSS) . 76 | touch .build_$(WARPSQL_VERSION)_$(PG_VER)_oss 77 | 78 | .build_$(WARPSQL_VERSION)_$(PG_VER): Dockerfile 79 | docker build \ 80 | $(DOCKER_BUILD_ARGS) \ 81 | $(TAG) . 82 | touch .build_$(WARPSQL_VERSION)_$(PG_VER) 83 | 84 | image: .build_$(WARPSQL_VERSION)_$(PG_VER) 85 | 86 | image-oss: .build_$(WARPSQL_VERSION)_$(PG_VER)_oss 87 | 88 | push: image 89 | docker push $(TAG_VERSION) 90 | if [ -z "$(PRE_RELEASE)" ]; then \ 91 | docker push $(TAG_LATEST); \ 92 | fi 93 | 94 | push-oss: image-oss 95 | docker push $(TAG_VERSION)-oss 96 | if [ -z "$(PRE_RELEASE)" ]; then \ 97 | docker push $(TAG_LATEST)-oss; \ 98 | fi 99 | 100 | multi: .multi_$(WARPSQL_VERSION)_$(PG_VER) 101 | 102 | multi-oss: .multi_$(WARPSQL_VERSION)_$(PG_VER)_oss 103 | 104 | all: multi multi-oss 105 | 106 | clean: 107 | rm -f *~ .build_* .multi_* 108 | -docker buildx rm multibuild 109 | 110 | .PHONY: default image push push-oss image-oss multi multi-oss clean all 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## WarpSQL 2 | WarpSQL is a powerful solution that provides opinionated extensions to Postgres, conveniently packaged as a single Docker deployment. 3 | 4 | 5 | ## Key features 6 | - **Simple Setup**: With WarpSQL, set up your Postgres database with all necessary extensions at once, saving you time and hassle. 7 | - **Smooth Integration**: WarpSQL seamlessly integrates popular extensions like PgVector, TimescaleDB, Citus, PostGIS, etc making your database management straightforward and efficient. 8 | 9 | ## Test on GitPod 10 | [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/ChakshuGautam/postgres-tsdb-vector-docker) 11 | 12 | ## Supported Extensions 13 | 14 | | Extension | PG14 | PG15 | PG16 | 15 | |------------------------------------------------------------------|--------|--------|--------| 16 | | [PgVector](https://github.com/pgvector/pgvector) | 0.5.1 | 0.5.1 | 0.5.1 | 17 | | [TimescaleDB](https://github.com/timescale/timescaledb) | 2.13.0 | 2.13.0 | 2.13.0 | 18 | | [PgCron](https://github.com/citusdata/pg_cron) | 1.6.0 | 1.6.0 | 1.6.0 | 19 | | [PostGIS](https://postgis.net) | 3.4.2 | 3.4.2 | 3.4.2 | 20 | | [Citus](https://www.citusdata.com/) | 12.1.0 | 12.1.0 | 12.1.0 | 21 | | [Pg Repack](https://github.com/reorg/pg_repack) | 1.5.0 | 1.5.0 | 1.5.0 | 22 | | [PgAutoFailover](https://github.com/hapostgres/pg_auto_failover) | 2.1 | 2.1 | 2.1 | 23 | | [postgresql-hll](https://github.com/citusdata/postgresql-hll) | 2.18 | 2.18 | 2.18 | 24 | | [PgJobmon](https://github.com/omniti-labs/pg_jobmon) | 1.4.1 | 1.4.1 | 1.4.1 | 25 | | [PgPartman](https://github.com/pgpartman/pg_partman) | 5.0.1 | 5.0.1 | 5.0.1 | 26 | | [pg_bestmatch](https://github.com/tensorchord/pg_bestmatch.rs)| [commit 3126173](https://github.com/tensorchord/pg_bestmatch.rs/commit/312617392c8a32121907496f05c23fce1e3d056c) | 27 | 28 | ## Releases 29 | - [Versioning Policy](./docs/version-policy.md) 30 | 31 | 32 | ## Community 33 | [Discord](https://bit.ly/C4GTCommunityChannel) 34 | 35 | ## Contributing 36 | If you're interested in WarpSQL and want to contribute your code and ideas, feel free to open pull requests and raise issues. 37 | 38 | 39 | 40 | 41 | 42 | 43 | Bootstrapped from [TimescaleDB](https://github.com/timescale/timescaledb-docker) 44 | -------------------------------------------------------------------------------- /bitnami/.dockerignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .build_* 3 | -------------------------------------------------------------------------------- /bitnami/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PG_VERSION 2 | ARG PREV_IMAGE 3 | ARG TS_VERSION 4 | ############################ 5 | # Build tools binaries in separate image 6 | ############################ 7 | ARG GO_VERSION=1.23 8 | FROM golang:${GO_VERSION}-alpine AS tools 9 | 10 | ENV TOOLS_VERSION 0.8.1 11 | 12 | RUN apk update && apk add --no-cache git gcc musl-dev \ 13 | && go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest \ 14 | && go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest 15 | 16 | ############################ 17 | # Grab old versions from previous version 18 | ############################ 19 | ARG PG_VERSION 20 | ARG PREV_IMAGE 21 | FROM ${PREV_IMAGE} AS oldversions 22 | # Remove update files, mock files, and all but the last 5 .so/.sql files. 23 | # There are three types of SQL files, initialization, upgrade, and downgrade, 24 | # which we have to count separately, but it's hard to match with globs, and 25 | # there are also many upgrade/downgrade files per version, so just keep more of 26 | # them. 27 | USER 0 28 | 29 | # Docker COPY needs at least one file to copy. If no source is specified, the 30 | # command fails. Create two '.emptyfile' files here to prevent the 31 | # 'COPY --from=oldversions' command below from failing. The files are removed 32 | # after the copy operation is performed. 33 | # 34 | # When the first image for a PG version is created, PREV_IMAGE is set to the 35 | # bitnami upstream image. Therefore, no TimescaleDB files exist and the 36 | # copy commands would fail. 37 | RUN set +o pipefail \ 38 | && rm -vf $(pg_config --sharedir)/extension/timescaledb*mock*.sql \ 39 | && rm -vf $(ls -1tr $(pg_config --pkglibdir)/timescaledb-tsl-*.so | head -n -5) \ 40 | && rm -vf $(ls -1tr $(pg_config --pkglibdir)/timescaledb-[0-9]*.so | head -n -5) \ 41 | && rm -vf $(ls -1tr $(pg_config --sharedir)/extension/timescaledb--*.sql | head -n -20) \ 42 | && { ls $(pg_config --sharedir)/extension/timescaledb--*.sql \ 43 | ; ls $(pg_config --pkglibdir)/timescaledb-*.so \ 44 | ; : ; } \ 45 | && touch $(pg_config --sharedir)/extension/.emptyfile \ 46 | && touch $(pg_config --pkglibdir)/.emptyfile 47 | 48 | ############################ 49 | # Now build image and copy in tools 50 | ############################ 51 | ARG PG_VERSION 52 | FROM bitnami/postgresql:${PG_VERSION} 53 | ARG PG_VERSION 54 | 55 | LABEL maintainer="Timescale https://www.timescale.com" 56 | 57 | COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ 58 | COPY --from=tools /go/bin/* /usr/local/bin/ 59 | COPY --from=oldversions /opt/bitnami/postgresql/lib/.emptyfile /opt/bitnami/postgresql/lib/timescaledb-*.so /opt/bitnami/postgresql/lib/ 60 | COPY --from=oldversions /opt/bitnami/postgresql/share/extension/.emptyfile /opt/bitnami/postgresql/share/extension/timescaledb--*.sql /opt/bitnami/postgresql/share/extension/ 61 | COPY bitnami/timescaledb-bitnami-entrypoint.sh /opt/bitnami/scripts/postgresql/ 62 | 63 | USER 0 64 | ARG TS_VERSION 65 | RUN set -ex \ 66 | && rm -v /opt/bitnami/postgresql/lib/.emptyfile \ 67 | && rm -v /opt/bitnami/postgresql/share/extension/.emptyfile \ 68 | && mkdir -p /var/lib/apt/lists/partial \ 69 | && apt-get update \ 70 | && apt-get -y install \ 71 | \ 72 | build-essential \ 73 | libssl-dev \ 74 | git \ 75 | \ 76 | dpkg-dev \ 77 | gcc \ 78 | libc-dev \ 79 | make \ 80 | cmake \ 81 | wget \ 82 | && mkdir -p /build/ \ 83 | && git clone https://github.com/timescale/timescaledb /build/timescaledb \ 84 | \ 85 | # Build current version \ 86 | && cd /build/timescaledb && rm -fr build \ 87 | && git checkout ${TS_VERSION} \ 88 | && ./bootstrap -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF -DGENERATE_DOWNGRADE_SCRIPT=ON -DWARNINGS_AS_ERRORS=OFF -DPROJECT_INSTALL_METHOD="docker-bitnami" \ 89 | && cd build && make install \ 90 | && cd ~ \ 91 | \ 92 | && apt-get autoremove --purge -y \ 93 | \ 94 | build-essential \ 95 | libssl-dev \ 96 | \ 97 | dpkg-dev \ 98 | gcc \ 99 | libc-dev \ 100 | make \ 101 | cmake \ 102 | && apt-get clean -y \ 103 | && rm -rf \ 104 | /build \ 105 | "${HOME}/.cache" \ 106 | /var/lib/apt/lists/* \ 107 | /tmp/* \ 108 | /var/tmp/* 109 | 110 | # Adding pg_cron 111 | ARG PG_CRON_VERSION 112 | 113 | RUN set -e \ 114 | && cd /tmp\ 115 | && apt-get update \ 116 | && apt-get install -y \ 117 | ca-certificates \ 118 | openssl \ 119 | tar \ 120 | autoconf \ 121 | automake \ 122 | g++ \ 123 | clang \ 124 | llvm \ 125 | libtool \ 126 | libxml2-dev \ 127 | make \ 128 | perl \ 129 | wget \ 130 | && wget -O pg_cron.tar.gz "https://github.com/citusdata/pg_cron/archive/refs/tags/$PG_CRON_VERSION.tar.gz" \ 131 | && mkdir -p /tmp/pg_cron \ 132 | && tar \ 133 | --extract \ 134 | --file pg_cron.tar.gz \ 135 | --directory /tmp/pg_cron \ 136 | --strip-components 1 \ 137 | && cd /tmp/pg_cron \ 138 | && make \ 139 | && make install \ 140 | # clean 141 | && cd / \ 142 | && rm /tmp/pg_cron.tar.gz \ 143 | && rm -rf /tmp/pg_cron \ 144 | && apt-get autoremove --purge -y \ 145 | autoconf \ 146 | automake \ 147 | g++ \ 148 | clang \ 149 | llvm \ 150 | make \ 151 | perl \ 152 | wget \ 153 | && apt-get clean -y \ 154 | && rm -rf \ 155 | /var/lib/apt/lists/* \ 156 | /tmp/* \ 157 | /var/tmp/* 158 | 159 | # Add PostGIS Extension 160 | ARG POSTGIS_VERSION 161 | 162 | RUN set -eux \ 163 | && apt update \ 164 | && apt install -y \ 165 | ca-certificates \ 166 | openssl \ 167 | tar \ 168 | wget \ 169 | gettext \ 170 | automake \ 171 | libltdl-dev \ 172 | libxml2-dev \ 173 | libgeos-dev \ 174 | libproj-dev \ 175 | libprotobuf-c-dev \ 176 | protobuf-c-compiler \ 177 | g++\ 178 | gcc \ 179 | make \ 180 | libpcre3-dev \ 181 | && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ 182 | && mkdir -p /usr/src/postgis \ 183 | && tar \ 184 | --extract \ 185 | --file postgis.tar.gz \ 186 | --directory /usr/src/postgis \ 187 | --strip-components 1 \ 188 | && rm postgis.tar.gz \ 189 | \ 190 | # build PostGIS 191 | \ 192 | && cd /usr/src/postgis \ 193 | && ./autogen.sh \ 194 | && ./configure \ 195 | --with-pcredir="$(pcre-config --prefix)" \ 196 | --with-geosconfig="/usr/bin/geos-config" \ 197 | CFLAGS="-idirafter'/opt/bitnami/postgresql/include'" # # Prefer latest system headers over Bitnami outdated libraries \ 198 | && make -j$(nproc) \ 199 | && make install \ 200 | && cd / \ 201 | # clean 202 | && apt-get autoremove --purge -y \ 203 | wget \ 204 | g++\ 205 | gcc \ 206 | make \ 207 | && apt-get clean -y \ 208 | && rm -rf \ 209 | /var/lib/apt/lists/* \ 210 | /tmp/* \ 211 | /var/tmp/* 212 | 213 | # add Citus 214 | ARG CITUS_VERSION 215 | RUN set -eux \ 216 | && apt-get update \ 217 | && apt-get install -y libc-dev make libssl-dev curl gcc liblz4-dev libzstd-dev clang libkrb5-dev libicu-dev libxslt1-dev libxml2-dev llvm-dev libcurl4-openssl-dev \ 218 | && CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \ 219 | && curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \ 220 | && tar -C /tmp -xvf /tmp/citus.tar.gz \ 221 | && addgroup --system postgres \ 222 | && adduser --system --ingroup postgres --home /opt/bitnami/postgresql --no-create-home postgres \ 223 | && chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \ 224 | && cd /tmp/citus-${CITUS_VERSION} \ 225 | && PATH="/opt/bitnami/postgresql/bin:$PATH" ./configure \ 226 | && make \ 227 | && make install \ 228 | && cd ~ \ 229 | && rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \ 230 | \ 231 | && apt-get autoremove --purge -y \ 232 | \ 233 | build-essential \ 234 | libssl-dev \ 235 | gcc \ 236 | libc-dev \ 237 | make \ 238 | && apt-get clean -y \ 239 | && rm -rf \ 240 | /build \ 241 | "${HOME}/.cache" \ 242 | /var/lib/apt/lists/* \ 243 | /tmp/* \ 244 | /var/tmp/* 245 | 246 | # Add pg_repack Extention 247 | ARG PG_REPACK_VERSION 248 | 249 | RUN apt-get update \ 250 | && apt-get install -y unzip \ 251 | build-essential \ 252 | liblz4-dev \ 253 | zlib1g-dev \ 254 | libssl-dev \ 255 | wget \ 256 | # build pg_repack 257 | && wget -O /tmp/pg_repack-${PG_REPACK_VERSION}.zip "https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip" \ 258 | && unzip /tmp/pg_repack-${PG_REPACK_VERSION}.zip -d /tmp \ 259 | && cd /tmp/pg_repack-${PG_REPACK_VERSION} \ 260 | && make \ 261 | && make install \ 262 | #clean 263 | && apt-get autoremove --purge -y \ 264 | unzip \ 265 | build-essential \ 266 | liblz4-dev \ 267 | libssl-dev \ 268 | zlib1g-dev \ 269 | wget \ 270 | && apt-get clean -y \ 271 | && rm -rf \ 272 | /var/lib/apt/lists/* \ 273 | /tmp/* \ 274 | /var/tmp/* 275 | 276 | # Adding pgautofailover 277 | ARG PG_AUTO_FAILOVER_VERSION 278 | RUN apt-get update \ 279 | && apt-get install -y unzip \ 280 | build-essential \ 281 | liblz4-dev \ 282 | zlib1g-dev \ 283 | libedit-dev \ 284 | libssl-dev \ 285 | libxslt1-dev \ 286 | wget \ 287 | # build pg_auto_failover 288 | && wget -O /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip "https://github.com/hapostgres/pg_auto_failover/archive/refs/tags/v${PG_AUTO_FAILOVER_VERSION}.zip" \ 289 | && unzip /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION}.zip -d /tmp \ 290 | && ls -alh /tmp \ 291 | && cd /tmp/pg_auto_failover-${PG_AUTO_FAILOVER_VERSION} \ 292 | && make \ 293 | && make install \ 294 | # clean 295 | && cd / \ 296 | && rm -rf /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION} /tmp/pg_auto_failove-${PG_AUTO_FAILOVER_VERSION}.zip \ 297 | && apt-get autoremove --purge -y \ 298 | unzip \ 299 | build-essential \ 300 | liblz4-dev \ 301 | libedit-dev \ 302 | libssl-dev \ 303 | wget \ 304 | && apt-get clean -y \ 305 | && rm -rf \ 306 | /var/lib/apt/lists/* \ 307 | /tmp/* \ 308 | /var/tmp/* 309 | 310 | ## Adding postgresql-hll 311 | ARG POSTGRES_HLL_VERSION 312 | RUN apt-get update \ 313 | && apt-get install -y unzip \ 314 | build-essential \ 315 | liblz4-dev \ 316 | zlib1g-dev \ 317 | libedit-dev \ 318 | libssl-dev \ 319 | wget \ 320 | # build postgresql-hll 321 | && wget -O /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip "https://github.com/citusdata/postgresql-hll/archive/refs/tags/v${POSTGRES_HLL_VERSION}.zip" \ 322 | && unzip /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip -d /tmp \ 323 | && cd /tmp/postgresql-hll-${POSTGRES_HLL_VERSION} \ 324 | && make \ 325 | && make install \ 326 | # clean 327 | && cd / \ 328 | && rm -rf /tmp/postgresql-hll-${POSTGRES_HLL_VERSION} /tmp/postgresql-hll-${POSTGRES_HLL_VERSION}.zip \ 329 | && apt-get autoremove --purge -y \ 330 | unzip \ 331 | build-essential \ 332 | liblz4-dev \ 333 | libedit-dev \ 334 | libssl-dev \ 335 | wget \ 336 | && apt-get clean -y \ 337 | && rm -rf \ 338 | /var/lib/apt/lists/* \ 339 | /tmp/* \ 340 | /var/tmp/* 341 | 342 | # Install pg_jobmon 343 | ARG PG_JOBMON_VERSION 344 | RUN set -ex \ 345 | && apt-get update \ 346 | && apt-get install -y \ 347 | ca-certificates \ 348 | openssl \ 349 | tar \ 350 | wget \ 351 | autoconf \ 352 | automake \ 353 | g++ \ 354 | clang \ 355 | llvm \ 356 | libtool \ 357 | libxml2-dev \ 358 | make \ 359 | perl \ 360 | \ 361 | && cd /tmp\ 362 | && wget -O pg_jobmon.tar.gz "https://github.com/omniti-labs/pg_jobmon/archive/v$PG_JOBMON_VERSION.tar.gz" \ 363 | && mkdir -p /tmp/pg_jobmon \ 364 | && tar \ 365 | --extract \ 366 | --file pg_jobmon.tar.gz \ 367 | --directory /tmp/pg_jobmon \ 368 | --strip-components 1 \ 369 | \ 370 | && cd /tmp/pg_jobmon \ 371 | && make \ 372 | && make install \ 373 | && cd / \ 374 | && apt-get autoremove --purge -y \ 375 | wget \ 376 | autoconf \ 377 | automake \ 378 | clang \ 379 | llvm \ 380 | make \ 381 | perl \ 382 | && apt-get clean -y \ 383 | && rm -rf /tmp/pg_jobmon \ 384 | && rm /tmp/pg_jobmon.tar.gz 385 | 386 | # Adding pg_partman 387 | ARG PG_PARTMAN_VERSION 388 | 389 | RUN set -ex \ 390 | && cd /tmp\ 391 | && apt-get update \ 392 | && apt-get install -y \ 393 | ca-certificates \ 394 | openssl \ 395 | tar \ 396 | autoconf \ 397 | automake \ 398 | g++ \ 399 | wget \ 400 | clang \ 401 | llvm \ 402 | libtool \ 403 | libxml2-dev \ 404 | make \ 405 | perl \ 406 | && wget -O pg_partman.tar.gz "https://github.com/pgpartman/pg_partman/archive/v$PG_PARTMAN_VERSION.tar.gz" \ 407 | && mkdir -p /tmp/pg_partman \ 408 | && tar \ 409 | --extract \ 410 | --file pg_partman.tar.gz \ 411 | --directory /tmp/pg_partman \ 412 | --strip-components 1 \ 413 | && cd /tmp/pg_partman \ 414 | && make \ 415 | && make install \ 416 | # clean 417 | && cd / \ 418 | && apt-get autoremove --purge -y \ 419 | wget \ 420 | autoconf \ 421 | automake \ 422 | clang \ 423 | llvm \ 424 | make \ 425 | perl \ 426 | && apt-get clean -y \ 427 | && rm /tmp/pg_partman.tar.gz \ 428 | && rm -rf /tmp/pg_partman 429 | 430 | ENV RUSTFLAGS="-C target-feature=-crt-static" 431 | ARG PG_BESTMATCH_RS_SHA 432 | ARG PG_VERSION 433 | RUN apt-get update -y -qq \ 434 | && apt-get install -y curl gnupg openssl pkg-config libssl-dev git \ 435 | && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ 436 | && export PATH="/.cargo/bin:$PATH" \ 437 | && export PGRX_HOME="/.pgrx/" \ 438 | && mkdir -p $PGRX_HOME \ 439 | && cargo install cargo-pgrx --version 0.9.3 \ 440 | && rustup update stable \ 441 | && cd /tmp && git clone --branch main https://github.com/tensorchord/pg_bestmatch.git \ 442 | && cd pg_bestmatch \ 443 | && git checkout ${PG_BESTMATCH_RS_SHA} \ 444 | && export PATH="$HOME/.cargo/bin:$PATH" \ 445 | && cargo install --locked cargo-pgrx --version 0.12.0-alpha.1 \ 446 | && cargo pgrx init --pg${PG_VERSION}=$(which pg_config) \ 447 | && cargo pgrx install --release \ 448 | && cd .. \ 449 | && rm -rf ./pg_bestmatch \ 450 | && apt-get clean -y 451 | 452 | USER 1001 453 | 454 | ENTRYPOINT [ "/opt/bitnami/scripts/postgresql/timescaledb-bitnami-entrypoint.sh" ] 455 | CMD [ "/opt/bitnami/scripts/postgresql/run.sh" ] 456 | -------------------------------------------------------------------------------- /bitnami/Makefile: -------------------------------------------------------------------------------- 1 | NAME=timescaledb 2 | # Default is to timescaledev to avoid unexpected push to the main repo 3 | # Set ORG to timescale in the caller 4 | ORG=timescaledev 5 | PG_VER=pg15 6 | PG_VER_NUMBER=$(shell echo $(PG_VER) | cut -c3-) 7 | PG_CRON_VERSION=v1.6.0 8 | PG_AUTO_FAILOVER_VERSION=2.1 9 | TS_VERSION=2.13.0 10 | POSTGIS_VERSION=3.4.2 11 | CITUS_VERSION=12.1.0 12 | PG_REPACK_VERSION=1.5.0 13 | POSTGRES_HLL_VERSION=2.18 14 | PG_JOBMON_VERSION=1.4.1 15 | PG_PARTMAN_VERSION=5.0.1 16 | PG_BESTMATCH_RS_SHA=312617392c8a32121907496f05c23fce1e3d056c 17 | PREV_TS_VERSION=$(shell wget --quiet -O - https://raw.githubusercontent.com/timescale/timescaledb/${TS_VERSION}/version.config | grep update_from_version | sed -e 's!update_from_version = !!') 18 | PREV_TS_IMAGE="timescale/timescaledb:$(PREV_TS_VERSION)-pg$(PG_VER_NUMBER)-bitnami" 19 | PREV_IMAGE=$(shell if docker pull $(PREV_TS_IMAGE) >/dev/null; then echo "$(PREV_TS_IMAGE)"; else echo "bitnami/postgresql:$(PG_VER_NUMBER)"; fi ) 20 | 21 | # Retrieve the latest Git tag for the current commit 22 | RELEASE_TAG = $(shell git describe --tags --abbrev=0 --exact-match HEAD 2>/dev/null) 23 | 24 | WARPSQL_VERSION := $(if $(RELEASE_TAG),$(RELEASE_TAG),dev-$(shell git rev-parse HEAD)) 25 | 26 | # Pre releases should not be tagged as latest, so PRE_RELEASE is used to track. 27 | PRE_RELEASE=$(shell echo "$(WARPSQL_VERSION)" | grep -Eo "alpha|beta|rc") 28 | 29 | TAG_VERSION=$(ORG)/$(NAME):$(WARPSQL_VERSION)-$(PG_VER)-bitnami 30 | TAG_LATEST=$(ORG)/$(NAME):latest-$(PG_VER)-bitnami 31 | TAG=-t $(TAG_VERSION) $(if $(PRE_RELEASE),,-t $(TAG_LATEST)) 32 | 33 | DOCKER_BUILD_ARGS = --build-arg PG_VERSION=$(PG_VER_NUMBER) \ 34 | --build-arg TS_VERSION=$(TS_VERSION) \ 35 | --build-arg PREV_IMAGE=$(PREV_IMAGE) \ 36 | --build-arg PG_CRON_VERSION=$(PG_CRON_VERSION) \ 37 | --build-arg POSTGIS_VERSION=$(POSTGIS_VERSION) \ 38 | --build-arg PG_REPACK_VERSION=$(PG_REPACK_VERSION) \ 39 | --build-arg CITUS_VERSION=$(CITUS_VERSION) \ 40 | --build-arg PG_AUTO_FAILOVER_VERSION=$(PG_AUTO_FAILOVER_VERSION) \ 41 | --build-arg POSTGRES_HLL_VERSION=$(POSTGRES_HLL_VERSION)\ 42 | --build-arg PG_JOBMON_VERSION=$(PG_JOBMON_VERSION) \ 43 | --build-arg PG_PARTMAN_VERSION=$(PG_PARTMAN_VERSION) \ 44 | --build-arg PG_BESTMATCH_RS_SHA=$(PG_BESTMATCH_RS_SHA) 45 | 46 | 47 | default: image 48 | 49 | .build_$(WARPSQL_VERSION)_$(PG_VER): Dockerfile 50 | docker build -f ./Dockerfile \ 51 | $(DOCKER_BUILD_ARGS) \ 52 | $(TAG) .. 53 | touch .build_$(WARPSQL_VERSION)_$(PG_VER)-bitnami 54 | 55 | image: .build_$(WARPSQL_VERSION)_$(PG_VER) 56 | 57 | push: image 58 | docker push $(TAG_VERSION) 59 | if [ -z "$(PRE_RELEASE)" ]; then \ 60 | docker push $(TAG_LATEST); \ 61 | fi 62 | 63 | clean: 64 | rm -f *~ .build_* 65 | 66 | .PHONY: default image push clean 67 | -------------------------------------------------------------------------------- /bitnami/timescaledb-bitnami-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # We have to use the bitnami configuration variable to add timescaledb to 4 | # shared preload list, or else it gets overwritten. 5 | if [ -z "$POSTGRESQL_SHARED_PRELOAD_LIBRARIES" ] 6 | then 7 | POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron,pgautofailover,hll" 8 | else 9 | POSTGRESQL_SHARED_PRELOAD_LIBRARIES="citus,timescaledb,pg_cron,pgautofailover,hll,$POSTGRESQL_SHARED_PRELOAD_LIBRARIES" 10 | fi 11 | export POSTGRESQL_SHARED_PRELOAD_LIBRARIES 12 | 13 | # Fall through to the original entrypoint. Note that we use exec here because 14 | # this wrapper script shouldn't change PID 1 of the container. 15 | exec /opt/bitnami/scripts/postgresql/entrypoint.sh "$@" 16 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.6' 2 | services: 3 | timescaledb: 4 | container_name: timescaledb 5 | image: timescaledev/timescaledb:main-pg15 6 | restart: always 7 | ports: 8 | - "5432:5432" 9 | volumes: 10 | - ./pgdata:/var/lib/postgresql/data 11 | environment: 12 | POSTGRES_USER: timescaledb 13 | POSTGRES_PASSWORD: postgrespassword 14 | 15 | graphql-engine: 16 | image: hasura/graphql-engine:latest 17 | ports: 18 | - "8080:8080" 19 | volumes: 20 | - ./data/migrations:/hasura-migrations 21 | - ./data/metadata:/hasura-metadata 22 | depends_on: 23 | - "timescaledb" 24 | restart: always 25 | environment: 26 | HASURA_GRAPHQL_DATABASE_URL: postgres://timescaledb:postgrespassword@timescaledb:5432/postgres?sslmode=disable 27 | ## enable the console served by server 28 | HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console 29 | ## enable debugging mode. It is recommended to disable this in production 30 | HASURA_GRAPHQL_DEV_MODE: "true" 31 | HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup,http-log,webhook-log,websocket-log,query-log 32 | ## uncomment next line to set an admin secret 33 | # HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey 34 | HASURA_GRAPHQL_MIGRATIONS_DISABLE_TRANSACTION: "true" 35 | HASURA_GRAPHQL_CONSOLE_ASSETS_DIR: /srv/console-assets -------------------------------------------------------------------------------- /docker-entrypoint-initdb.d/000_install_timescaledb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | create_sql=`mktemp` 4 | 5 | # Checks to support bitnami image with same scripts so they stay in sync 6 | if [ ! -z "${BITNAMI_APP_NAME:-}" ]; then 7 | if [ -z "${POSTGRES_USER:-}" ]; then 8 | POSTGRES_USER=${POSTGRESQL_USERNAME} 9 | fi 10 | 11 | if [ -z "${POSTGRES_DB:-}" ]; then 12 | POSTGRES_DB=${POSTGRESQL_DATABASE} 13 | fi 14 | 15 | if [ -z "${PGDATA:-}" ]; then 16 | PGDATA=${POSTGRESQL_DATA_DIR} 17 | fi 18 | fi 19 | 20 | if [ -z "${POSTGRESQL_CONF_DIR:-}" ]; then 21 | POSTGRESQL_CONF_DIR=${PGDATA} 22 | fi 23 | 24 | cat <${create_sql} 25 | CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE; 26 | EOF 27 | 28 | TS_TELEMETRY='basic' 29 | if [ "${TIMESCALEDB_TELEMETRY:-}" == "off" ]; then 30 | TS_TELEMETRY='off' 31 | 32 | # We delete the job as well to ensure that we do not spam the 33 | # log with other messages related to the Telemetry job. 34 | cat <>${create_sql} 35 | SELECT alter_job(1,scheduled:=false); 36 | EOF 37 | fi 38 | 39 | echo "timescaledb.telemetry_level=${TS_TELEMETRY}" >> ${POSTGRESQL_CONF_DIR}/postgresql.conf 40 | 41 | export PGPASSWORD="$POSTGRESQL_PASSWORD" 42 | 43 | # create extension timescaledb in initial databases 44 | psql -U "${POSTGRES_USER}" postgres -f ${create_sql} 45 | psql -U "${POSTGRES_USER}" template1 -f ${create_sql} 46 | 47 | if [ "${POSTGRES_DB:-postgres}" != 'postgres' ]; then 48 | psql -U "${POSTGRES_USER}" "${POSTGRES_DB}" -f ${create_sql} 49 | fi 50 | -------------------------------------------------------------------------------- /docker-entrypoint-initdb.d/001_timescaledb_tune.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NO_TS_TUNE=${NO_TS_TUNE:-""} 4 | TS_TUNE_MEMORY=${TS_TUNE_MEMORY:-""} 5 | TS_TUNE_NUM_CPUS=${TS_TUNE_NUM_CPUS:-""} 6 | TS_TUNE_MAX_CONNS=${TS_TUNE_MAX_CONNS:-""} 7 | TS_TUNE_MAX_BG_WORKERS=${TS_TUNE_MAX_BG_WORKERS:-""} 8 | 9 | if [ ! -z "${NO_TS_TUNE:-}" ]; then 10 | # The user has explicitly requested not to run timescaledb-tune; exit this script 11 | exit 0 12 | fi 13 | 14 | 15 | if [ -z "${POSTGRESQL_CONF_DIR:-}" ]; then 16 | POSTGRESQL_CONF_DIR=${PGDATA} 17 | fi 18 | 19 | if [ -z "${TS_TUNE_MEMORY:-}" ]; then 20 | # See if we can get the container's total allocated memory from the cgroups metadata 21 | if [ -f /sys/fs/cgroup/memory/memory.limit_in_bytes ]; then 22 | TS_TUNE_MEMORY=$(cat /sys/fs/cgroup/memory/memory.limit_in_bytes) 23 | 24 | if [ "${TS_TUNE_MEMORY}" = "18446744073709551615" ]; then 25 | # Bash seems to error out for numbers greater than signed 64-bit, 26 | # so if the value of limit_in_bytes is the 64-bit UNSIGNED max value 27 | # we should just bail out and hope timescaledb-tune can figure this 28 | # out. If we don't, the next comparison is likely going to fail 29 | # or it might store a negative value which will crash later. 30 | TS_TUNE_MEMORY="" 31 | fi 32 | 33 | FREE_KB=$(grep MemTotal: /proc/meminfo | awk '{print $2}') 34 | FREE_BYTES=$(( ${FREE_KB} * 1024 )) 35 | if [ ${TS_TUNE_MEMORY} -gt ${FREE_BYTES} ]; then 36 | # Something weird is going on if the cgroups memory limit exceeds the total available 37 | # amount of system memory reported by "free", which is the total amount of memory available on the host. 38 | # Most likely, it is this issue: https://github.com/moby/moby/issues/18087 (if no limit is 39 | # set, the max limit is set to the max 64 bit integer). In this case, we just leave 40 | # TS_TUNE_MEMORY blank and let timescaledb-tune derive the memory itself using syscalls. 41 | TS_TUNE_MEMORY="" 42 | else 43 | # Convert the bytes to MB so it plays nicely with timescaledb-tune 44 | TS_TUNE_MEMORY="$(echo ${TS_TUNE_MEMORY} | awk '{print int($1 / 1024 / 1024)}')MB" 45 | fi 46 | fi 47 | fi 48 | 49 | if [ -z "${TS_TUNE_NUM_CPUS:-}" ]; then 50 | # See if we can get the container's available CPUs from the cgroups metadata 51 | if [ -f /sys/fs/cgroup/cpuset/cpuset.cpus ]; then 52 | TS_TUNE_NUM_CPUS=$(cat /sys/fs/cgroup/cpuset/cpuset.cpus) 53 | if [[ ${TS_TUNE_NUM_CPUS} == *-* ]]; then 54 | # The CPU limits have been defined as a range (e.g., 0-3 for 4 CPUs). Subtract them and add 1 55 | # to convert the range to the number of CPUs. 56 | TS_TUNE_NUM_CPUS=$(echo ${TS_TUNE_NUM_CPUS} | tr "-" " " | awk '{print ($2 - $1) + 1}') 57 | elif [[ ${TS_TUNE_NUM_CPUS} == *,* ]]; then 58 | # The CPU limits have been defined as a comma separated list (e.g., 0,1,2,3 for 4 CPUs). Count each CPU 59 | TS_TUNE_NUM_CPUS=$(echo ${TS_TUNE_NUM_CPUS} | tr "," "\n" | wc -l) 60 | elif [ $(echo -n ${TS_TUNE_NUM_CPUS} | wc -c) -eq 1 ]; then 61 | # The CPU limit has been defined as a single numbered CPU. In this case the CPU limit is 1 62 | # regardless of what that number is 63 | TS_TUNE_NUM_CPUS=1 64 | fi 65 | fi 66 | fi 67 | 68 | if [ ! -z "${TS_TUNE_MEMORY:-}" ]; then 69 | TS_TUNE_MEMORY_FLAGS=--memory="${TS_TUNE_MEMORY}" 70 | fi 71 | 72 | if [ ! -z "${TS_TUNE_NUM_CPUS:-}" ]; then 73 | TS_TUNE_NUM_CPUS_FLAGS=--cpus=${TS_TUNE_NUM_CPUS} 74 | fi 75 | 76 | if [ ! -z "${TS_TUNE_MAX_CONNS:-}" ]; then 77 | TS_TUNE_MAX_CONNS_FLAGS=--max-conns=${TS_TUNE_MAX_CONNS} 78 | fi 79 | 80 | if [ ! -z "${TS_TUNE_MAX_BG_WORKERS:-}" ]; then 81 | TS_TUNE_MAX_BG_WORKERS_FLAGS=--max-bg-workers=${TS_TUNE_MAX_BG_WORKERS} 82 | fi 83 | 84 | if [ ! -z "${PG_MAJOR}" ]; then 85 | TS_TUNE_PG_VERSION=--pg-version=${PG_MAJOR} 86 | fi 87 | 88 | /usr/local/bin/timescaledb-tune --quiet --yes --conf-path="${POSTGRESQL_CONF_DIR}/postgresql.conf" ${TS_TUNE_MEMORY_FLAGS} ${TS_TUNE_NUM_CPUS_FLAGS} ${TS_TUNE_MAX_CONNS_FLAGS} ${TS_TUNE_MAX_BG_WORKERS_FLAGS} ${TS_TUNE_PG_VERSION} 89 | -------------------------------------------------------------------------------- /docs/version-policy.md: -------------------------------------------------------------------------------- 1 | # Version Policy 2 | 3 | WarpSQL adopts [Semantic Versioning(SemVer)](https://semver.org/) using the `MAJOR.MINOR.PATCH` format. 4 | For a summary of changes in the WarpSQL refer to the [CHANGELOG](../CHANGELOG.md). 5 | 6 | ## WarpSQL versions 7 | 8 | ### MAJOR Version (v1.x.x): 9 | 10 | when backward incompatible changes are introduced. 11 | Examples: 12 | 13 | - Increment an extension to `MAJOR` versions 14 | - Features causing backward incompatibility 15 | 16 | ### MINOR Version (vx.1.x): 17 | 18 | when new features and extensions are added, but are backward compatible. 19 | Examples: 20 | 21 | - Increment an extension to `MINOR`/`PATCH` versions 22 | - Addition of an extension 23 | - Upgrades maintaining backward compatibility 24 | 25 | ### PATCH Version (vx.x.1): 26 | 27 | when backward compatible bug fixes are added. 28 | 29 | ### PRE-RELEASE (vx.x.x-alpha.2) 30 | This releases might introduce breaking changes on any update. This release carries no stability guarantees. 31 | 32 | The pre-release progression follows the sequence: 33 | 34 | - Alpha: `-alpha` 35 | - Beta: `-beta` 36 | - Release Candidate: `-rc` 37 | 38 | ## WarpSQL Docker images 39 | 40 | The WarpSQL images tags follow a consistent naming convention, 41 | deliberately excluding the use of a `latest` tag. This omission is intentional to prevent accidental upgrades in dependencies and PostgreSQL versions. 42 | 43 | ### Alpine Images 44 | The default base distribution for WarpSQL is Alpine. The tags follow this format: 45 | ```html 46 | -pg 47 | -pg-alpine 48 | ``` 49 | ### Bitnami Images 50 | 51 | ```html 52 | -pg-bitnami 53 | ``` 54 | 55 | ### Examples 56 | - An Alpine image with `warpsql_version=1.2.1-alpha` and PostgreSQL 15 is represented by the tag `1.2.1-alpha-pg15-alpine`. 57 | --------------------------------------------------------------------------------