Skip to content

Commit 7b7d5c7

Browse files
committed
Merge remote-tracking branch 'origin/develop' into INDATA-152
* origin/develop: refactor: Remove wal-g v3 and simplify build (#1937) refactor: Refactor PostgreSQL cron config and deprecations (#1951)
2 parents f6fc401 + 2f6b03c commit 7b7d5c7

File tree

9 files changed

+14
-85
lines changed

9 files changed

+14
-85
lines changed

Dockerfile-15

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,6 @@ RUN bash -c 'source /usr/local/bin/apt-update-fallback.sh && apt_update_with_fal
159159

160160
ENV PGDATA=/var/lib/postgresql/data
161161

162-
####################
163-
# setup-wal-g.yml
164-
####################
165-
FROM base as walg
166-
ARG wal_g_release
167-
WORKDIR /nixpg
168-
169-
RUN nix profile install .#wal-g-3 && \
170-
ln -s /nix/var/nix/profiles/default/bin/wal-g-3 /tmp/wal-g
171-
172-
RUN nix store gc
173-
174162
WORKDIR /
175163
####################
176164
# setup-groonga
@@ -215,7 +203,6 @@ RUN gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $GOSU_GPG_KEY &&
215203
FROM gosu as production
216204
RUN id postgres || (echo "postgres user does not exist" && exit 1)
217205
# # Setup extensions
218-
COPY --from=walg /tmp/wal-g /usr/local/bin/
219206
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
220207

221208
# # Initialise configs
@@ -232,8 +219,11 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
232219

233220
RUN \
234221
echo "unix_socket_directories = '/var/run/postgresql'" >> /etc/postgresql/postgresql.conf && \
235-
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
236222
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
223+
sed -i \
224+
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
225+
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
226+
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
237227
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
238228
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
239229
usermod -aG postgres wal-g && \

Dockerfile-17

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,6 @@ RUN bash -c 'source /usr/local/bin/apt-update-fallback.sh && apt_update_with_fal
163163

164164
ENV PGDATA=/var/lib/postgresql/data
165165

166-
####################
167-
# setup-wal-g.yml
168-
####################
169-
FROM base as walg
170-
ARG wal_g_release
171-
172-
WORKDIR /nixpg
173-
174-
RUN nix profile install .#wal-g-3 && \
175-
ln -s /nix/var/nix/profiles/default/bin/wal-g-3 /tmp/wal-g
176-
177-
RUN nix store gc
178-
179166
WORKDIR /
180167
####################
181168
# setup-groonga
@@ -220,7 +207,6 @@ RUN gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $GOSU_GPG_KEY &&
220207
FROM gosu as production
221208
RUN id postgres || (echo "postgres user does not exist" && exit 1)
222209
# # Setup extensions
223-
COPY --from=walg /tmp/wal-g /usr/local/bin/
224210
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
225211

226212
# # Initialise configs
@@ -237,8 +223,11 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
237223

238224
RUN \
239225
echo "unix_socket_directories = '/var/run/postgresql'" >> /etc/postgresql/postgresql.conf && \
240-
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
241226
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
227+
sed -i \
228+
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
229+
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
230+
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
242231
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
243232
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
244233
usermod -aG postgres wal-g && \

Dockerfile-orioledb-17

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,6 @@ RUN bash -c 'source /usr/local/bin/apt-update-fallback.sh && apt_update_with_fal
163163

164164
ENV PGDATA=/var/lib/postgresql/data
165165

166-
####################
167-
# setup-wal-g.yml
168-
####################
169-
FROM base as walg
170-
ARG wal_g_release
171-
172-
WORKDIR /nixpg
173-
174-
RUN nix profile install .#wal-g-3 && \
175-
ln -s /nix/var/nix/profiles/default/bin/wal-g-3 /tmp/wal-g
176-
177-
RUN nix store gc
178-
179166
WORKDIR /
180167
####################
181168
# setup-groonga
@@ -220,7 +207,6 @@ RUN gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys $GOSU_GPG_KEY &&
220207
FROM gosu as production
221208
RUN id postgres || (echo "postgres user does not exist" && exit 1)
222209
# # Setup extensions
223-
COPY --from=walg /tmp/wal-g /usr/local/bin/
224210
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
225211

226212
# # Initialise configs
@@ -237,8 +223,11 @@ COPY ansible/files/walg_helper_scripts/wal_change_ownership.sh /root/wal_change_
237223

238224
RUN \
239225
echo "unix_socket_directories = '/var/run/postgresql'" >> /etc/postgresql/postgresql.conf && \
240-
echo "cron.database_name = 'postgres'" >> /etc/postgresql/postgresql.conf && \
241226
#echo "pljava.libjvm_location = '/usr/lib/jvm/java-11-openjdk-${TARGETARCH}/lib/server/libjvm.so'" >> /etc/postgresql/postgresql.conf && \
227+
sed -i \
228+
-e "s|#session_preload_libraries = ''|session_preload_libraries = 'supautils'|g" \
229+
-e "s|#include = '/etc/postgresql-custom/supautils.conf'|include = '/etc/postgresql-custom/supautils.conf'|g" \
230+
-e "s|#include = '/etc/postgresql-custom/wal-g.conf'|include = '/etc/postgresql-custom/wal-g.conf'|g" /etc/postgresql/postgresql.conf && \
242231
echo "pgsodium.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
243232
echo "vault.getkey_script= '/usr/lib/postgresql/bin/pgsodium_getkey.sh'" >> /etc/postgresql/postgresql.conf && \
244233
usermod -aG postgres wal-g && \
@@ -248,21 +237,9 @@ RUN \
248237
# Remove items from postgresql.conf
249238
RUN sed -i 's/ timescaledb,//g;' "/etc/postgresql/postgresql.conf"
250239
#as of pg 16.4 + this db_user_namespace totally deprecated and will break the server if setting is present
251-
<<<<<<< HEAD
252-
RUN sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf"
253-
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/conf.d/supautils.conf"
254-
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
255-
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
256-
||||||| 1e598fb38
257-
RUN sed -i 's/db_user_namespace = off/#db_user_namespace = off/g;' "/etc/postgresql/postgresql.conf"
258-
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
259-
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
260-
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
261-
=======
262240
RUN sed -i 's/ timescaledb,//g; s/ plv8,//g; s/ postgis,//g; s/ pgrouting,//g' "/etc/postgresql-custom/supautils.conf"
263241
RUN sed -i 's/\(shared_preload_libraries.*\)'\''\(.*\)$/\1, orioledb'\''\2/' "/etc/postgresql/postgresql.conf"
264242
RUN echo "default_table_access_method = 'orioledb'" >> "/etc/postgresql/postgresql.conf"
265-
>>>>>>> origin/develop
266243

267244
# OrioleDB rewind configuration
268245
# Enables time-based rewind capability for up to 20 minutes (1200 seconds)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cron.database_name = 'postgres'

ansible/tasks/setup-pgbouncer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- libsystemd-dev
99
- pkg-config
1010
update_cache: true
11-
cache_valid_time: 3600
1211

1312
- name: PgBouncer - download latest release
1413
ansible.builtin.get_url:

ansible/tasks/setup-wal-g.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,6 @@
3838
cmd: sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"
3939
become: true
4040

41-
- name: Install wal-g 3 from nix binary cache
42-
ansible.builtin.shell:
43-
cmd: sudo -u wal-g bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#wal-g-3"
44-
become: true
45-
46-
- name: nix collect garbage
47-
ansible.builtin.shell:
48-
cmd: sudo -u ubuntu bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix-collect-garbage -d"
49-
become: true
50-
51-
- name: Create symlink for wal-g-3 from Nix profile to /usr/local/bin
52-
ansible.builtin.file:
53-
dest: '/usr/local/bin/wal-g-v3'
54-
force: true
55-
src: '/home/wal-g/.nix-profile/bin/wal-g-3'
56-
state: 'link'
57-
become: true
58-
5941
- name: Create symlink to make wal-g-v2 the default wal-g
6042
ansible.builtin.file:
6143
dest: '/usr/local/bin/wal-g'

nix/checks.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@
390390
);
391391
inherit (self'.packages)
392392
wal-g-2
393-
wal-g-3
394393
dbmate-tool
395394
packer
396395
pg_regress

nix/packages/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
sync-exts-versions = pkgs.callPackage ./sync-exts-versions.nix { inherit (inputs') nix-editor; };
6969
trigger-nix-build = pkgs.callPackage ./trigger-nix-build.nix { };
7070
update-readme = pkgs.callPackage ./update-readme.nix { };
71-
inherit (pkgs.callPackage ./wal-g.nix { }) wal-g-2 wal-g-3;
71+
inherit (pkgs.callPackage ./wal-g.nix { }) wal-g-2;
7272
inherit (pkgs.cargo-pgrx)
7373
cargo-pgrx_0_11_3
7474
cargo-pgrx_0_12_6

nix/packages/wal-g.nix

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,4 @@ in
7777
vendorHash = "sha256-BbQuY6r30AkxlCZjY8JizaOrqEBdv7rIQet9KQwYB/g=";
7878
majorVersion = "2";
7979
};
80-
81-
# wal-g v3.0.5
82-
wal-g-3 = walGCommon {
83-
version = "3.0.5";
84-
sha256 = "sha256-wVr0L2ZXMuEo6tc2ajNzPinVQ8ZVzNOSoaHZ4oFsA+U=";
85-
vendorHash = "sha256-YDLAmRfDl9TgbabXj/1rxVQ052NZDg3IagXVTe5i9dw=";
86-
majorVersion = "3";
87-
};
8880
}

0 commit comments

Comments
 (0)