Skip to content

Commit

Permalink
Merge pull request #18 from MetrodataTeam/deo
Browse files Browse the repository at this point in the history
sync v*.18.8
  • Loading branch information
DeoLeung authored May 28, 2024
2 parents 251d4d3 + 0d150b9 commit 6df4ec1
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 14 deletions.
38 changes: 24 additions & 14 deletions postgres/public/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ COPY ./update-postgis.sh /usr/local/bin
COPY ./multiple_db.sh /docker-entrypoint-initdb.d/11_multiple_db.sh
COPY ./set_version.sh /docker-entrypoint-initdb.d/80_set_version.sh

COPY ./custom_entrypoint.sh /usr/local/bin/custom_entrypoint.sh

ENV OSSUTIL_CONFIG_FILE='/var/lib/postgresql/data/.ossutilconfig'
ENV INSTALL='apt-get install -y --no-install-recommends --no-upgrade'
ARG NEXUS
Expand All @@ -37,7 +39,7 @@ ARG ROARINGBITMAP_VERSION='0.5.4'
ARG REPMGR_VERSION='5.4.1*'

# https://github.com/eulerto/wal2json/releases
ARG WAL2JSON_VERSION='2.5*'
ARG WAL2JSON_VERSION='2.6*'

# TODO(Deo): re-enable this once it's more easy to build
# https://github.com/pgspider/parquet_s3_fdw/releases
Expand All @@ -49,17 +51,14 @@ ARG MYSQL_FDW_VERSION='2.9.1*'
# https://github.com/pramsey/pgsql-http/releases
ARG PGSQL_HTTP_VERSION='1.6.0'

# https://github.com/timescale/promscale_extension/releases
# ARG PROMSCALE_VERSION='0.7.0'

# https://github.com/citusdata/citus#install-citus-locally
# https://github.com/citusdata/citus/blob/main/CHANGELOG.md
# TODO(Deo): disable citus as we may not be using it shortly, for experimentation, use older versions
# ARG CITUS_VERSION='11.1'
# ADD https://repos.citusdata.com/community/gpgkey /tmp/citus.gpg

# https://github.com/pgvector/pgvector/blob/master/CHANGELOG.md
ARG PGVECTOR_VERSION='0.6.0'
ARG PGVECTOR_VERSION='0.7.0'

# https://github.com/bytesandbrains/h3-pg/releases
ARG H3PG_VERSION='4.1.3*'
Expand Down Expand Up @@ -87,31 +86,34 @@ ARG PG_CRON_VERSION='1.6.2*'

# https://github.com/pgRouting/pgrouting/releases
# NOTICE: repo keeps deleting old artifacts, we may change this
ARG PGROUTING_VERSION='3.6.1*'
ARG PGROUTING_VERSION='3.6.2*'

# https://gitlab.com/dalibo/postgresql_anonymizer/-/tags
ARG ANONYMIZER_VERSION='1.2.0'
ARG ANONYMIZER_VERSION='1.3.2'

# https://github.com/citusdata/postgresql-hll/releases
ARG POSTGRESQL_HLL_VERSION='2.18'

# https://github.com/paradedb/paradedb/releases
# pg_sparse/pg_bm25/pg_analytics share the version number
ARG PARADEDB_VERSION='0.5.6'
# pg_search/pg_lakehouse share the version number
ARG PARADEDB_VERSION='0.7.2'

# pg_analytics is kind of deprecated
ARG PG_ANALYTICS_VERSION='0.6.1'

# https://github.com/tensorchord/pgvecto.rs/releases
ARG PG_VECTORS_VERSION='0.2.0'

# https://github.com/supabase/pg_jsonschema/releases
ARG PG_JSONSCHEMA_VERSION='0.2.0'
ARG PG_JSONSCHEMA_VERSION='0.3.1'

RUN export VERSION_CODENAME=`grep VERSION_CODENAME /etc/os-release | sed 's/VERSION_CODENAME=//'` && \
export WGET='wget -nv --directory-prefix=/tmp/ '${NEXUS}'/repository/raw-dev' && \
echo "deb "${NEXUS}"/repository/apt-debian/ "${VERSION_CODENAME}" main contrib" > /etc/apt/sources.list && \
echo "deb "${NEXUS}"/repository/apt-postgresql/ "${VERSION_CODENAME}"-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8 && \
echo "deb "${NEXUS}"/repository/arrow/ "${VERSION_CODENAME}" main" > /etc/apt/sources.list.d/arrow.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 91D18FCF079F8007 && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9CBA4EF977CA20B8 && \
# echo "deb "${NEXUS}"/repository/apt-timescaledb/ "${VERSION_CODENAME}" main" > /etc/apt/sources.list.d/timescaledb.list && \
# cat /tmp/timescaledb_gpgkey | apt-key add - && \
apt-get update && \
Expand Down Expand Up @@ -142,18 +144,24 @@ RUN export VERSION_CODENAME=`grep VERSION_CODENAME /etc/os-release | sed 's/VERS
cd /tmp/ && \
apt install /tmp/vectors-pg${PG_MAJOR}_${PG_VECTORS_VERSION}_${archi}.deb ; \
fi && \
# paradedb only supports pg15/16 at the moment
if [ ${PG_MAJOR} -ge 15 ]; then \
# paradedb only supports pg14/15/16 at the moment
if [ ${PG_MAJOR} -ge 14 ]; then \
# install libicu manually to ubuntu latest version, since paradedb pre-build on ubuntu
${WGET}/backend/libicu/libicu70_70.1-2_${archi}.deb && \
apt install /tmp/libicu70_70.1-2_${archi}.deb && \
for ext in 'pg_bm25' 'pg_sparse' 'pg_analytics'; \
for ext in 'pg_search' 'pg_lakehouse'; \
do \
echo "installing "${archi}" "${ext} && \
${WGET}/backend/paradedb/${ext}-v${PARADEDB_VERSION}-pg${PG_MAJOR}-${archi}-ubuntu2204.deb && \
apt install /tmp/${ext}-v${PARADEDB_VERSION}-pg${PG_MAJOR}-${archi}-ubuntu2204.deb ; \
done ; \
fi && \
# pg_analytics only supports pg15/16 at the moment
if [ ${PG_MAJOR} -ge 15 ]; then \
echo "installing "${archi}" pg_analytics" && \
${WGET}/backend/paradedb/pg_analytics-v${PG_ANALYTICS_VERSION}-pg${PG_MAJOR}-${archi}-ubuntu2204.deb && \
apt install /tmp/pg_analytics-v${PG_ANALYTICS_VERSION}-pg${PG_MAJOR}-${archi}-ubuntu2204.deb ; \
fi && \
# postgresql-hll
${WGET}/backend/postgresql-hll/postgresql-hll-${POSTGRESQL_HLL_VERSION}.tar.gz && \
cd /tmp/ && \
Expand Down Expand Up @@ -239,3 +247,5 @@ RUN export VERSION_CODENAME=`grep VERSION_CODENAME /etc/os-release | sed 's/VERS
rm -rf /tmp/* && \
apt-get autoremove -y --purge libcurl4-openssl-dev postgresql-server-dev-${PG_MAJOR} build-essential wget libkrb5-dev cmake && \
rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["custom_entrypoint.sh"]
25 changes: 25 additions & 0 deletions postgres/public/custom_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -Eeo pipefail

source docker-entrypoint.sh
if [ "$#" -eq 0 ] || [ "$1" != 'postgres' ]; then
set -- postgres "$@"
fi

docker_setup_env
docker_create_db_directories

if [ "$(id -u)" = '0' ]; then
# then restart script as postgres user
if type gosu > /dev/null 2>&1; then
exec gosu postgres "$BASH_SOURCE" "$@"
else
exec su-exec postgres "$BASH_SOURCE" "$@"
fi
fi

if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
_main "$@" -c mdt.mdtdb_version=$PG_MAJOR.$MDTDB_VERSION
else
exec "$@" -c mdt.mdtdb_version=$PG_MAJOR.$MDTDB_VERSION
fi

0 comments on commit 6df4ec1

Please sign in to comment.