Skip to content

Commit

Permalink
update pg-ext (#16)
Browse files Browse the repository at this point in the history
* update pg-ext
* update jdk naming
* fix gpdb py3 bug
* debug pgext
  • Loading branch information
haobibo authored Mar 15, 2024
1 parent e937761 commit 29dc39c
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ jobs:
source ./tool.sh
build_image greenplum latest docker_greenplum/Dockerfile && push_image
qpod_postgres:
name: "postgres"
name: "postgres-ext"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
source ./tool.sh
build_image postgres latest docker_postgres/postgres-ext.Dockerfile && push_image
build_image postgres-ext latest docker_postgres/postgres-ext.Dockerfile && push_image
## Sync all images in this build (listed by "names") to mirror registry.
sync_images:
Expand All @@ -84,4 +84,4 @@ jobs:
--env-file /tmp/docker.env \
-v $(pwd):/tmp \
-w /tmp \
qpod/docker-kit python /opt/utils/image-syncer/run_jobs.py
qpod/docker-kit /opt/conda/bin/python /opt/utils/image-syncer/run_jobs.py
2 changes: 1 addition & 1 deletion docker_bigdata/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Distributed under the terms of the Modified BSD License.

ARG BASE_NAMESPACE
ARG BASE_IMG="jdk11"
ARG BASE_IMG="jdk-11"
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}

LABEL maintainer="[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion docker_greenplum/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN set -x && source /opt/utils/script-utils.sh \
&& chown -R ${GPUSER}:${GPUSER} ${GPHOME} ${GPDATA} /home/${GPUSER} \
&& install_apt /opt/utils/install_list_greenplum.apt \
&& export PATH="${PATH}:${GPHOME}/bin" && cd ${GPHOME}/bin && ls -alh \
&& PYTHON_SITE=$(python3 -c 'import sys;print(list(filter(lambda s: "site" in s, sys.path))[0])') \
&& PYTHON_SITE=$(/opt/conda/bin/python3 -c 'import sys;print(list(filter(lambda s: "site" in s, sys.path))[0])') \
&& sudo ln -s ${GPHOME}/lib/python/* ${PYTHON_SITE}/ \
&& pip install -U psutil pygresql pyyaml \
&& cp ${GPHOME}/docs/cli_help/gpconfigs/gpinitsystem_config ${GPHOME}/conf/gpinitsystem_config \
Expand Down
2 changes: 1 addition & 1 deletion docker_kafka_confluent/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Distributed under the terms of the Modified BSD License.
ARG BASE_NAMESPACE
ARG BASE_IMG="jdk11"
ARG BASE_IMG="jdk-11"
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}

ARG KAFKA_VERSION="7.3.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ docker run -it \
-p=9092:9092 \
-v /data/kafka-confluent/broker/:/var/lib/kafka-broker/ \
-v $(pwd):/root/dev \
qpod/jdk11 bash
qpod/jdk-11 bash

export KAFKA_BROKER_ID=1
export KAFKA_LISTENER_SECURITY_PROTOCOL_MAP='CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
Expand Down
23 changes: 23 additions & 0 deletions docker_postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# PostgreSQL with extensions

## Debug

```shell
BUILDKIT_PROGRESS=plain docker build -t postgres-ext -f ./postgres-ext.Dockerfile --build-arg BASE_NAMESPACE=qpod0dev .

IMG="qpod/postgres-ext"

docker run -d \
--name db-postgres \
-p 5432:5432 \
-e POSTGRES_PASSWORD=pg-password \
$IMG

ls -alh /usr/share/postgresql/15/extension/*.control
```

```sql
SELECT * FROM pg_extension;
SELECT * FROM pg_available_extensions ORDER BY name;
CREATE EXTENSION "vector";
```
32 changes: 21 additions & 11 deletions docker_postgres/postgres-ext.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
# Distributed under the terms of the Modified BSD License.

ARG BASE_NAMESPACE
ARG BASE_IMG="base"
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} as builder

ARG PG_MAJOR=15
FROM library/postgres:${PG_MAJOR:-latest}
ARG BASE_IMG="postgres"
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}

LABEL maintainer="[email protected]"

COPY work /opt/utils/
COPY --from=builder /opt /opt

RUN set -x \
RUN set -x && . /opt/utils/script-utils.sh \
&& apt-get update && apt-get install -y gettext \
apt-utils apt-transport-https ca-certificates gnupg2 dirmngr locales sudo lsb-release curl \
&& envsubst < /opt/utils/install_list_pgext.apt > /opt/utils/install_list_pgext.apt \
&& . /opt/utils/script-utils.sh \
&& install_apt /opt/utils/install_list_base.apt \
&& DISTRO_NAME=$(awk '{ print tolower($0) }' <<< $(lsb_release -is)) \
&& DISTRO_CODE_NAME=$(lsb_release -cs) \
# apt source for: https://packagecloud.io/citusdata/community
&& curl -fsSL "https://packagecloud.io/citusdata/community/gpgkey" | gpg --dearmor > /etc/apt/trusted.gpg.d/citusdata_community.gpg \
&& echo "deb https://packagecloud.io/citusdata/community/${DISTRO_NAME}/ ${DISTRO_CODE_NAME} main" | sudo tee /etc/apt/sources.list.d/citusdata_community.list \
# apt source for: https://packagecloud.io/timescale/timescaledb
&& curl -fsSL "https://packagecloud.io/timescale/timescaledb/gpgkey" | gpg --dearmor > /etc/apt/trusted.gpg.d/timescale_timescaledb.gpg \
&& echo "deb https://packagecloud.io/timescale/timescaledb/${DISTRO_NAME}/ ${DISTRO_CODE_NAME} main" | sudo tee /etc/apt/sources.list.d/timescale_timescaledb.list \
# apt source for: https://packagecloud.io/pigsty/pgsql
&& curl -fsSL "https://packagecloud.io/pigsty/pgsql/gpgkey" | gpg --dearmor > /etc/apt/trusted.gpg.d/pigsty_pgsql.gpg \
&& echo "deb https://packagecloud.io/pigsty/pgsql/${DISTRO_NAME}/ ${DISTRO_CODE_NAME} main" | sudo tee /etc/apt/sources.list.d/pigsty_pgsql.list \
&& envsubst < /opt/utils/install_list_pgext.tpl.apt > /opt/utils/install_list_pgext.apt \
&& rm -rf /opt/utils/install_list_pgext.tpl.apt \
&& echo "To install PG extensions: $(cat /opt/utils/install_list_pgext.apt)" \
&& install_apt /opt/utils/install_list_pgext.apt \
&& ls -alh /usr/share/postgresql/*/extension/*.control | sort \
&& echo "Clean up" && list_installed_packages && install__clean

USER postgres
WORKDIR /var/lib/postgresql
11 changes: 0 additions & 11 deletions docker_postgres/work/install_list_pgext.apt

This file was deleted.

12 changes: 12 additions & 0 deletions docker_postgres/work/install_list_pgext.tpl.apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
postgresql-contrib
postgresql-${PG_MAJOR}-postgis*
postgresql-${PG_MAJOR}-pgvector
postgresql-${PG_MAJOR}-cron
postgresql-${PG_MAJOR}-wal2json
timescaledb-2-postgresql-${PG_MAJOR}
postgresql-${PG_MAJOR}-citus-12.1
pg-graphql % https://github.com/supabase/pg_graphql
pg-net % https://github.com/supabase/pg_net
% postgresql-*-pgdg-pgroonga % TODO: postgresql-15-pgdg-pgroonga : Depends: libgroonga0 (>= 13.0.8) but 13.0.0+dfsg-3~deb12u1 is to be installed
% postgresql-pgml-* % TODO: many python packages
% echo "deb https://apt.postgresml.org ${DISTRO_CODE_NAME} maintainer" | sudo tee /etc/apt/sources.list.d/postgresml.list

0 comments on commit 29dc39c

Please sign in to comment.