Skip to content

Commit e2c04d5

Browse files
committed
Patch the build to add pg_stat_monitor extension to image
1 parent aee9fd3 commit e2c04d5

File tree

2 files changed

+45
-4
lines changed

2 files changed

+45
-4
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ jobs:
2727
RUNNERIMG_IDENTITY: "[email protected]"
2828
RUNNERIMG_ISSUER: "https://accounts.google.com"
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
31+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # ratchet:actions/checkout@v4
3132
with:
3233
repository: zalando/spilo
3334
fetch-depth: '0'
3435
fetch-tags: 'true'
35-
- name: Find latest tag
36+
path: spilo
37+
- name: Checkout latest tag
3638
shell: bash
3739
run: |
40+
cd spilo || exit 1
3841
wanted_tag=$(git tag --list --sort=committerdate | tail -n 1)
3942
echo "Selected tag ${wanted_tag}"
4043
if [[ -z "$wanted_tag" ]]; then
@@ -46,6 +49,11 @@ jobs:
4649
exit 2
4750
fi
4851
git checkout "$wanted_tag"
52+
- name: Apply pg_stat_monitor patch
53+
shell: bash
54+
run: |
55+
cd spilo || exit 1
56+
patch -p1 < ../pg_stat_monitor.patch
4957
- name: Install cosign
5058
uses: sigstore/cosign-installer@398d4b0eeef1380460a10c8013a76f728fb906ac # ratchet:sigstore/[email protected]
5159
with:
@@ -56,8 +64,8 @@ jobs:
5664
id: build-push-sign
5765
with:
5866
name: postgres-image
59-
context: postgres-appliance
60-
dockerfile: postgres-appliance/Dockerfile
67+
context: spilo/postgres-appliance
68+
dockerfile: spilo/postgres-appliance/Dockerfile
6169
build_args: |
6270
ADDITIONAL_LOCALES=nb_NO
6371
TIMESCALEDB_APACHE_ONLY=false

pg_stat_monitor.patch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/postgres-appliance/build_scripts/base.sh b/postgres-appliance/build_scripts/base.sh
2+
index ff885c5..5059351 100644
3+
--- a/postgres-appliance/build_scripts/base.sh
4+
+++ b/postgres-appliance/build_scripts/base.sh
5+
@@ -64,6 +64,7 @@ apt-get install -y \
6+
brotli \
7+
libbrotli1 \
8+
python3.10 \
9+
+ python3-pip \
10+
python3-psycopg2
11+
12+
# forbid creation of a main cluster when package is installed
13+
@@ -180,6 +181,12 @@ if [ "$DEMO" != "true" ]; then
14+
done
15+
fi
16+
17+
+pip3 install pgxnclient
18+
+for version in $DEB_PG_SUPPORTED_VERSIONS; do
19+
+ USE_PGXS=1 pgxn install --pg_config="/usr/lib/postgresql/${version}/bin/pg_config" pg_stat_monitor
20+
+done
21+
+pip3 uninstall --yes pgxnclient
22+
+
23+
# make it possible for cron to work without root
24+
gcc -s -shared -fPIC -o /usr/local/lib/cron_unprivileged.so cron_unprivileged.c
25+
26+
@@ -198,6 +205,7 @@ apt-get purge -y \
27+
postgresql \
28+
postgresql-all \
29+
postgresql-server-dev-* \
30+
+ python3-pip \
31+
libpq-dev=* \
32+
libmagic1 \
33+
bsdmainutils

0 commit comments

Comments
 (0)