Skip to content

Commit f04789b

Browse files
authored
Provide Docker images (#159)
Closes #158
1 parent 640dcf4 commit f04789b

File tree

10 files changed

+190
-2
lines changed

10 files changed

+190
-2
lines changed

.dockerignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
*
19+
!package/docker/

.github/workflows/package.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,26 @@ jobs:
124124
ARCHITECTURE=${PACKAGE_TARGET##*-}
125125
echo "ARCHITECTURE=${ARCHITECTURE}" >> $GITHUB_ENV
126126
127+
case ${PACKAGE_TARGET} in
128+
debian-bookworm-*)
129+
DOCKER_IMAGE_BUILD=yes
130+
DOCKER_TAG_PREFIX="ghcr.io/${GITHUB_REPOSITORY}:"
131+
DOCKER_TAG_SUFFIX="-bookworm-${POSTGRESQL_VERSION}"
132+
DOCKER_TAGS="${DOCKER_VERSION}"
133+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
134+
DOCKER_TAGS="${DOCKER_TAG_PREFIX}${GITHUB_REF_NAME}${DOCKER_TAG_SUFFIX}"
135+
DOCKER_TAGS+=",${DOCKER_TAG_PREFIX}latest${DOCKER_TAG_SUFFIX}"
136+
else
137+
DOCKER_TAGS="${DOCKER_TAG_PREFIX}main${DOCKER_TAG_SUFFIX}"
138+
fi
139+
echo "DOCKER_TAGS=${DOCKER_TAGS}" >> $GITHUB_ENV
140+
;;
141+
*)
142+
DOCKER_IMAGE_BUILD=no
143+
;;
144+
esac
145+
echo "DOCKER_IMAGE_BUILD=${DOCKER_IMAGE_BUILD}" >> $GITHUB_ENV
146+
127147
source_archive=$(echo ${BASE_NAME}-*.tar.gz)
128148
VERSION=${source_archive#${BASE_NAME}-}
129149
VERSION=${VERSION%.tar.gz}
@@ -172,10 +192,13 @@ jobs:
172192
${{ matrix.target }}.tar.gz
173193
env:
174194
GH_TOKEN: ${{ github.token }}
175-
- name: Push Docker image
195+
- name: Push Docker image for building packages
176196
run: |
177197
pushd ${BASE_NAME}/package/${PACKAGE}
178198
rake docker:push || :
199+
cp \
200+
${TASK_NAMESPACE}/repositories/*/pool/*/*/*/*/*.deb \
201+
../docker/
179202
popd
180203
- name: Test
181204
run: |
@@ -190,3 +213,17 @@ jobs:
190213
local \
191214
package/${PACKAGE}/${TASK_NAMESPACE}/repositories
192215
popd
216+
- uses: docker/setup-qemu-action@v3
217+
if: env.DOCKER_IMAGE_BUILD == 'yes'
218+
- uses: docker/setup-buildx-action@v3
219+
if: env.DOCKER_IMAGE_BUILD == 'yes'
220+
id: buildx
221+
- uses: docker/build-push-action@v5
222+
if: env.DOCKER_IMAGE_BUILD == 'yes'
223+
id: build-push
224+
with:
225+
context: ${{ env.BASE_NAME }}
226+
file: ${{ env.BASE_NAME }}/package/${{ env.PACKAGE }}/Dockerfile
227+
platforms: linux/${{ env.ARCHITECTURE }}
228+
push: ${{ github.event_name == 'push' }}
229+
tags: ${{ env.DOCKER_TAGS }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@
3030
/package/*/apt/env.sh
3131
/package/*/apt/repositories/
3232
/package/*/apt/tmp/
33+
/package/docker/*.deb
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
set -eux
21+
22+
psql=(psql \
23+
--no-align \
24+
--no-psqlrc \
25+
--tuples-only)
26+
select_shared_preload_libraries=<<SQL
27+
SELECT setting
28+
FROM pg_file_settings
29+
WHERE
30+
name ='shared_preload_libraries' AND
31+
applied
32+
SQL
33+
shared_preload_libraries=$("${psql[@]}" --command "${select_shared_preload_libraries}")
34+
if [ -n "${shared_preload_libraries}" ]; then
35+
shared_preload_libraries+=","
36+
fi
37+
shared_preload_libraries+="arrow_flight_sql"
38+
echo "shared_preload_libraries = '${shared_preload_libraries}'" | \
39+
tee -a "${PGDATA}/postgresql.conf"
40+
41+
ssl=$(psql \
42+
--no-psqlrc \
43+
--tuples-only \
44+
--no-align \
45+
--command "SELECT setting FROM pg_settings WHERE name ='ssl'")
46+
if [ "${ssl}" = "on" ]; then
47+
uri="grpc+tls://0.0.0.0:15432"
48+
else
49+
uri="grpc://0.0.0.0:15432"
50+
fi
51+
echo "arrow_flight_sql.uri = '${url}'" | \
52+
tee -a "${PGDATA}/postgresql.conf"

package/postgresql-15-pgdg/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
FROM postgres:15-bookworm
19+
20+
COPY package/docker/postgresql-15-pgdg-apache-arrow-flight-sql_*_amd64.deb ./
21+
RUN \
22+
apt update && \
23+
apt install -y -V lsb-release wget && \
24+
wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
25+
apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
26+
rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
27+
apt update && \
28+
apt install -y -V \
29+
./postgresql-15-pgdg-apache-arrow-flight-sql_*.deb && \
30+
rm -f postgresql-15-pgdg-apache-arrow-flight-sql_*.deb && \
31+
apt clean && \
32+
rm -rf /var/lib/apt/lists/*
33+
34+
COPY package/docker/apache-arrow-flight-sql-enable.sh /docker-entrypoint-initdb.d/
35+
36+
EXPOSE 15432

package/postgresql-15-pgdg/apt/ubuntu-jammy-amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@ RUN \
6060
libkrb5-dev \
6161
meson \
6262
ninja-build \
63+
pkg-config \
6364
postgresql-server-dev-15 && \
6465
apt clean

package/postgresql-16-pgdg/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
FROM postgres:16-bookworm
19+
20+
COPY package/docker/postgresql-16-pgdg-apache-arrow-flight-sql_*_amd64.deb ./
21+
RUN \
22+
apt update && \
23+
apt install -y -V lsb-release wget && \
24+
wget https://apache.jfrog.io/artifactory/arrow/debian/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
25+
apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
26+
rm apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb && \
27+
apt update && \
28+
apt install -y -V \
29+
./postgresql-16-pgdg-apache-arrow-flight-sql_*.deb && \
30+
rm -f postgresql-16-pgdg-apache-arrow-flight-sql_*.deb && \
31+
apt clean && \
32+
rm -rf /var/lib/apt/lists/*
33+
34+
COPY package/docker/apache-arrow-flight-sql-enable.sh /docker-entrypoint-initdb.d/
35+
36+
EXPOSE 15432

package/postgresql-16-pgdg/apt/ubuntu-jammy-amd64/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@ RUN \
6060
libkrb5-dev \
6161
meson \
6262
ninja-build \
63+
pkg-config \
6364
postgresql-server-dev-16 && \
6465
apt clean

src/afs.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extern "C"
7777
# define AFS_FUNC __func__
7878
#endif
7979

80+
// #define AFS_DEBUG
8081
#ifdef AFS_DEBUG
8182
# define P(...) ereport(DEBUG5, errmsg_internal(__VA_ARGS__))
8283
#else

test/helper/sandbox.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def initdb(shared_preload_libraries: [],
161161
end
162162
conf.puts("logging_collector = on")
163163
conf.puts("log_filename = '#{@log_base_name}'")
164+
conf.puts("log_min_messages = debug5") if ENV["AFS_DEBUG"] == "yes"
164165
conf.puts("shared_preload_libraries = " +
165166
"'#{shared_preload_libraries.join(",")}'")
166167
conf.puts("arrow_flight_sql.uri = '#{@flight_sql_uri}'")
@@ -375,7 +376,10 @@ def setup_postgres
375376
begin
376377
yield
377378
ensure
378-
stop_postgres if @postgresql
379+
if @postgresql
380+
stop_postgres
381+
puts(@postgresql.read_log) unless passed?
382+
end
379383
end
380384
end
381385

0 commit comments

Comments
 (0)