Timescale build argument (#361)

* disable timescale build
pull/367/head
mazano 2022-02-11 12:03:44 +02:00 zatwierdzone przez GitHub
rodzic a79b312185
commit fcec79d052
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
7 zmienionych plików z 62 dodań i 9 usunięć

Wyświetl plik

@ -16,3 +16,4 @@ LANGS="en_US.UTF-8,id_ID.UTF-8"
POSTGRES_MAJOR_VERSION=14
POSTGIS_MAJOR_VERSION=3
POSTGIS_MINOR_RELEASE=2
BUILD_TIMESCALE=true

Wyświetl plik

@ -12,6 +12,7 @@ LABEL maintainer="Tim Sutton<tim@kartoza.com>"
LABEL cache.invalidation.number="1"
ARG CACHE_INVALIDATION_NUMBER=1
# Reset ARG for version
ARG IMAGE_VERSION
@ -70,7 +71,8 @@ ARG IMAGE_VERSION
ARG POSTGRES_MAJOR_VERSION=14
ARG POSTGIS_MAJOR_VERSION=3
ARG POSTGIS_MINOR_RELEASE=2
ARG TIMESCALE_VERSION=2
ARG TIMESCALE_VERSION=2-2.5.0
ARG BUILD_TIMESCALE=false
@ -79,8 +81,6 @@ RUN set -eux \
&& apt-get update \
&& sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main\" > /etc/apt/sources.list.d/pgdg.list" \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add - \
&& sh -c "echo \"deb [signed-by=/usr/share/keyrings/timescale.keyring] https://packagecloud.io/timescale/timescaledb/debian/ ${IMAGE_VERSION} main\" > /etc/apt/sources.list.d/timescaledb.list" \
&& wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /usr/share/keyrings/timescale.keyring \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
@ -101,10 +101,17 @@ RUN set -eux \
netcat postgresql-${POSTGRES_MAJOR_VERSION}-ogr-fdw \
postgresql-${POSTGRES_MAJOR_VERSION}-postgis-${POSTGIS_MAJOR_VERSION}-scripts \
postgresql-plpython3-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-pgrouting \
postgresql-server-dev-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-cron \
timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools
postgresql-server-dev-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-cron
RUN if [ "${BUILD_TIMESCALE}" =~ [Tt][Rr][Uu][Ee] ]; then \
export DEBIAN_FRONTEND=noninteractive && \
sh -c "echo \"deb [signed-by=/usr/share/keyrings/timescale.keyring] https://packagecloud.io/timescale/timescaledb/debian/ ${IMAGE_VERSION} main\" > /etc/apt/sources.list.d/timescaledb.list" && \
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /usr/share/keyrings/timescale.keyring && \
apt-get update && \
apt-get -y --no-install-recommends install timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools;\
fi;
RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt
RUN echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt
RUN echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt

Wyświetl plik

@ -270,7 +270,8 @@ Some PostgreSQL extensions require shared_preload_libraries to be specified in t
Using the environment variable `SHARED_PRELOAD_LIBRARIES` you can pass comma separated values that correspond to the extensions defined
using the environment variable `POSTGRES_MULTIPLE_EXTENSIONS`.
The default libraries that are loaded are `pg_cron,timescaledb`
The default libraries that are loaded are `pg_cron,timescaledb` if the image is bulilt
with timescale support otherwise only `pg_cron` is loaded.
You can pass the env variable
```bash
-e SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'

Wyświetl plik

@ -6,3 +6,5 @@ if [[ ! -f .env ]]; then
fi
docker-compose -f docker-compose.build.yml build postgis-prod
#docker-compose -f docker-compose.build-timescale.yml build postgis-prod

Wyświetl plik

@ -0,0 +1,34 @@
# Used solely for docker-compose build
version: '3.9'
services:
postgis-base:
image: kartoza/postgis:base-${DISTRO}-${IMAGE_VERSION}-${IMAGE_VARIANT}
build:
context: .
# Use yaml anchor for reusability
args: &build-args-anchor
DISTRO: ${DISTRO}
IMAGE_VERSION: ${IMAGE_VERSION}
IMAGE_VARIANT: ${IMAGE_VARIANT}
GENERATE_ALL_LOCALE: ${GENERATE_ALL_LOCALE}
POSTGRES_MAJOR_VERSION: ${POSTGRES_MAJOR_VERSION}
POSTGIS_MAJOR_VERSION: ${POSTGIS_MAJOR_VERSION}
POSTGIS_MINOR_RELEASE: ${POSTGIS_MINOR_RELEASE}
BUILD_TIMESCALE: ${BUILD_TIMESCALE}
target: postgis-base
postgis-prod:
image: kartoza/postgis:${POSTGRES_MAJOR_VERSION}-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_RELEASE}-timescale
build:
context: .
args:
<<: *build-args-anchor
target: postgis-prod
postgis-test:
image: kartoza/postgis:manual-build
build:
context: .
args:
<<: *build-args-anchor
target: postgis-test

Wyświetl plik

@ -217,7 +217,11 @@ if [ -z "${SSL_KEY_FILE}" ]; then
fi
if [ -z "${POSTGRES_MULTIPLE_EXTENSIONS}" ]; then
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting'
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]];then
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting,timescaledb'
else
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting'
fi
fi
@ -261,7 +265,11 @@ if [ -z "$EXTRA_CONF" ]; then
fi
if [ -z "${SHARED_PRELOAD_LIBRARIES}" ]; then
SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]];then
SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
else
SHARED_PRELOAD_LIBRARIES='pg_cron'
fi
fi
if [ -z "$PASSWORD_AUTHENTICATION" ]; then

Wyświetl plik

@ -93,7 +93,7 @@ fi
# Timescale default tuning
# TODO If timescale DB accepts reading from include directory then refactor code to remove line 97 - 112 (https://github.com/timescale/timescaledb-tune/issues/80)
if [[ ${ACCEPT_TIMESCALE_TUNING} =~ [Tt][Rr][Uu][Ee] ]];then
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]] && [[ ${ACCEPT_TIMESCALE_TUNING} =~ [Tt][Rr][Uu][Ee] ]] ;then
if [[ -f ${ROOT_CONF}/postgis.conf ]];then
sed -i '/postgis.conf/d' "${ROOT_CONF}"/postgresql.conf
cat "${ROOT_CONF}"/postgis.conf >> "${ROOT_CONF}"/postgresql.conf