Skip to content

Commit ae317f4

Browse files
committed
Merge remote-tracking branch 'origin/develop' into INDATA-152
* origin/develop: chore: add our substituter config to flake.nix (#1839) refactor: improve test harness logging and error handling (#1834) feat: support multiple versions of the pgroonga extension (#1677) refactor(ansible): bring our ansible up to modern ansible-lint standards (#1862) fix: bump version for new release (#1860)
2 parents 2d4df8f + 377291a commit ae317f4

26 files changed

+809
-337
lines changed

Dockerfile-15

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,20 @@ RUN nix profile install .#wal-g-3 && \
122122

123123
RUN nix store gc
124124

125+
WORKDIR /
126+
####################
127+
# setup-groonga
128+
####################
129+
FROM base as groonga
130+
131+
WORKDIR /nixpg
132+
133+
RUN nix profile install .#supabase-groonga && \
134+
mkdir -p /tmp/groonga-plugins && \
135+
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
136+
137+
RUN nix store gc
138+
125139
WORKDIR /
126140
# ####################
127141
# # Download gosu for easy step-down from root
@@ -153,6 +167,7 @@ FROM gosu as production
153167
RUN id postgres || (echo "postgres user does not exist" && exit 1)
154168
# # Setup extensions
155169
COPY --from=walg /tmp/wal-g /usr/local/bin/
170+
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
156171

157172
# # Initialise configs
158173
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
@@ -210,4 +225,7 @@ ENV LOCALE_ARCHIVE /usr/lib/locale/locale-archive
210225
RUN mkdir -p /usr/share/postgresql/extension/ && \
211226
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
212227
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
228+
229+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
230+
213231
CMD ["postgres", "-D", "/etc/postgresql"]

Dockerfile-17

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ RUN nix profile install .#wal-g-3 && \
126126

127127
RUN nix store gc
128128

129+
WORKDIR /
130+
####################
131+
# setup-groonga
132+
####################
133+
FROM base as groonga
134+
135+
WORKDIR /nixpg
136+
137+
RUN nix profile install .#supabase-groonga && \
138+
mkdir -p /tmp/groonga-plugins && \
139+
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
140+
141+
RUN nix store gc
142+
129143
WORKDIR /
130144
# ####################
131145
# # Download gosu for easy step-down from root
@@ -157,6 +171,7 @@ FROM gosu as production
157171
RUN id postgres || (echo "postgres user does not exist" && exit 1)
158172
# # Setup extensions
159173
COPY --from=walg /tmp/wal-g /usr/local/bin/
174+
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
160175

161176
# # Initialise configs
162177
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
@@ -223,4 +238,7 @@ ENV LOCALE_ARCHIVE /usr/lib/locale/locale-archive
223238
RUN mkdir -p /usr/share/postgresql/extension/ && \
224239
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
225240
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
241+
242+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
243+
226244
CMD ["postgres", "-D", "/etc/postgresql"]

Dockerfile-orioledb-17

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ RUN nix profile install .#wal-g-3 && \
126126

127127
RUN nix store gc
128128

129+
WORKDIR /
130+
####################
131+
# setup-groonga
132+
####################
133+
FROM base as groonga
134+
135+
WORKDIR /nixpg
136+
137+
RUN nix profile install .#supabase-groonga && \
138+
mkdir -p /tmp/groonga-plugins && \
139+
cp -r /nix/var/nix/profiles/default/lib/groonga/plugins /tmp/groonga-plugins/
140+
141+
RUN nix store gc
142+
129143
WORKDIR /
130144
# ####################
131145
# # Download gosu for easy step-down from root
@@ -157,6 +171,7 @@ FROM gosu as production
157171
RUN id postgres || (echo "postgres user does not exist" && exit 1)
158172
# # Setup extensions
159173
COPY --from=walg /tmp/wal-g /usr/local/bin/
174+
COPY --from=groonga /tmp/groonga-plugins/plugins /usr/lib/groonga/plugins
160175

161176
# # Initialise configs
162177
COPY --chown=postgres:postgres ansible/files/postgresql_config/postgresql.conf.j2 /etc/postgresql/postgresql.conf
@@ -229,4 +244,6 @@ RUN mkdir -p /usr/share/postgresql/extension/ && \
229244
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
230245
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
231246

247+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
248+
232249
CMD ["postgres", "-D", "/etc/postgresql"]

ansible/tasks/setup-wal-g.yml

Lines changed: 85 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,94 @@
1-
- name: Create wal-g group
2-
group:
3-
name: wal-g
4-
state: present
5-
when: nixpkg_mode
1+
- name: Execute wal-g things when nixpkg_mode
2+
when:
3+
- nixpkg_mode
4+
block:
5+
- name: Create wal-g group
6+
ansible.builtin.group:
7+
name: 'wal-g'
8+
state: 'present'
69

7-
- name: Create wal-g user
8-
user:
9-
name: wal-g
10-
shell: /bin/false
11-
comment: WAL-G user
12-
group: wal-g
13-
groups: wal-g, postgres
14-
when: nixpkg_mode
15-
- name: Create a config directory owned by wal-g
16-
file:
17-
path: /etc/wal-g
18-
state: directory
19-
owner: wal-g
20-
group: wal-g
21-
mode: '0770'
22-
when: nixpkg_mode
10+
- name: Create wal-g user
11+
ansible.builtin.user:
12+
comment: 'WAL-G user'
13+
group: 'wal-g'
14+
groups: 'wal-g, postgres'
15+
name: 'wal-g'
16+
shell: '/usr/bin/nologin'
17+
system: true
2318

24-
- name: Install wal-g 2 from nix binary cache
25-
become: yes
26-
shell: |
27-
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-2"
28-
when: stage2_nix
19+
- name: Create a config directory owned by wal-g
20+
ansible.builtin.file:
21+
group: 'wal-g'
22+
mode: '0770'
23+
owner: 'wal-g'
24+
path: '/etc/wal-g'
25+
state: 'directory'
2926

30-
- name: Install wal-g 3 from nix binary cache
31-
become: yes
32-
shell: |
33-
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"
34-
when: stage2_nix
27+
- name: Execute wal-g things when stage2_nix
28+
when:
29+
- stage2_nix
30+
block:
31+
- name: Install wal-g 2 from nix binary cache
32+
ansible.builtin.shell:
33+
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-2"
34+
become: true
3535

36-
- name: Create symlink for wal-g-3 from Nix profile to /usr/local/bin
37-
ansible.builtin.file:
38-
src: /home/wal-g/.nix-profile/bin/wal-g-3
39-
dest: /usr/local/bin/wal-g-v3
40-
state: link
41-
force: yes # This will replace existing file/symlink if it exists
42-
become: yes # Need sudo to write to /usr/local/bin
43-
when: stage2_nix
36+
- name: Install wal-g 3 from nix binary cache
37+
ansible.builtin.shell:
38+
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"
39+
become: true
4440

45-
- name: Create symlink to make wal-g-v2 the default wal-g
46-
ansible.builtin.file:
47-
src: /home/wal-g/.nix-profile/bin/wal-g-2
48-
dest: /usr/local/bin/wal-g
49-
state: link
50-
force: yes
51-
become: yes
52-
when: stage2_nix
41+
- name: Create symlink for wal-g-3 from Nix profile to /usr/local/bin
42+
ansible.builtin.file:
43+
dest: '/usr/local/bin/wal-g-v3'
44+
force: true
45+
src: '/home/wal-g/.nix-profile/bin/wal-g-3'
46+
state: 'link'
47+
become: true
5348

54-
- name: Create /etc/wal-g/config.json
55-
file:
56-
path: /etc/wal-g/config.json
57-
state: touch
58-
owner: wal-g
59-
group: wal-g
60-
mode: '0664'
61-
when: stage2_nix
49+
- name: Create symlink to make wal-g-v2 the default wal-g
50+
ansible.builtin.file:
51+
dest: '/usr/local/bin/wal-g'
52+
force: true
53+
src: '/home/wal-g/.nix-profile/bin/wal-g-2'
54+
state: 'link'
55+
become: true
6256

63-
- name: Move custom wal-g.conf file to /etc/postgresql-custom/conf.d/wal-g.conf
64-
copy:
65-
src: "files/postgresql_config/conf.d/wal-g.conf"
66-
dest: /etc/postgresql-custom/conf.d/wal-g.conf
67-
mode: 0664
68-
owner: postgres
69-
group: postgres
70-
when: stage2_nix
57+
- name: Create /etc/wal-g/config.json
58+
ansible.builtin.file:
59+
group: 'wal-g'
60+
mode: '0664'
61+
owner: 'wal-g'
62+
path: '/etc/wal-g/config.json'
63+
state: 'touch'
7164

72-
- name: Add script to be run for restore_command
73-
template:
74-
src: "files/walg_helper_scripts/wal_fetch.sh"
75-
dest: /home/postgres/wal_fetch.sh
76-
mode: 0500
77-
owner: postgres
78-
group: postgres
79-
when: stage2_nix
65+
- name: Move custom wal-g.conf file to /etc/postgresql-custom/wal-g.conf
66+
ansible.builtin.template:
67+
dest: '/etc/postgresql-custom/wal-g.conf'
68+
group: 'postgres'
69+
mode: '0664'
70+
owner: 'postgres'
71+
src: 'files/postgresql_config/custom_walg.conf.j2'
8072

81-
- name: Add helper script for wal_fetch.sh
82-
template:
83-
src: "files/walg_helper_scripts/wal_change_ownership.sh"
84-
dest: /root/wal_change_ownership.sh
85-
mode: 0700
86-
owner: root
87-
when: stage2_nix
73+
- name: Add script to be run for restore_command
74+
ansible.builtin.template:
75+
dest: '/home/postgres/wal_fetch.sh'
76+
group: 'postgres'
77+
mode: '0500'
78+
owner: 'postgres'
79+
src: 'files/walg_helper_scripts/wal_fetch.sh'
80+
81+
- name: Add helper script for wal_fetch.sh
82+
ansible.builtin.template:
83+
dest: '/root/wal_change_ownership.sh'
84+
mode: '0700'
85+
owner: 'root'
86+
src: 'files/walg_helper_scripts/wal_change_ownership.sh'
87+
88+
- name: Move custom wal-g.conf file to /etc/postgresql-custom/conf.d/wal-g.conf
89+
ansible.builtin.copy:
90+
dest: '/etc/postgresql-custom/conf.d/wal-g.conf'
91+
group: 'postgresq'
92+
mode: '0664'
93+
owner: 'postgres'
94+
src: 'files/postgresql_config/conf.d/wal-g.conf'

ansible/vars.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ postgres_major:
1010

1111
# Full version strings for each major version
1212
postgres_release:
13-
postgresorioledb-17: "17.5.1.048-orioledb"
14-
postgres17: "17.6.1.027"
15-
postgres15: "15.14.1.027"
13+
postgresorioledb-17: "17.5.1.050-orioledb"
14+
postgres17: "17.6.1.029"
15+
postgres15: "15.14.1.029"
1616

1717
# Non Postgres Extensions
1818
pgbouncer_release: 1.19.0

flake.nix

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
description = "Prototype tooling for deploying PostgreSQL";
3-
3+
nixConfig = {
4+
extra-substituters = [ "https://nix-postgres-artifacts.s3.amazonaws.com" ];
5+
extra-trusted-public-keys = [
6+
"nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI="
7+
];
8+
};
49
inputs = {
510
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
611
flake-utils.url = "github:numtide/flake-utils";
@@ -30,7 +35,6 @@
3035
nix/checks.nix
3136
nix/config.nix
3237
nix/devShells.nix
33-
nix/ext
3438
nix/fmt.nix
3539
nix/hooks.nix
3640
nix/nixpkgs.nix

0 commit comments

Comments
 (0)