Skip to content

Commit d3e5ffa

Browse files
authored
Merge branch 'develop' into multi-version-ext/pg-partman
2 parents a6cc4d5 + 69b35ff commit d3e5ffa

35 files changed

+1838
-748
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
@@ -216,4 +231,7 @@ ENV LOCALE_ARCHIVE /usr/lib/locale/locale-archive
216231
RUN mkdir -p /usr/share/postgresql/extension/ && \
217232
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
218233
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
234+
235+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
236+
219237
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
@@ -229,4 +244,7 @@ ENV LOCALE_ARCHIVE /usr/lib/locale/locale-archive
229244
RUN mkdir -p /usr/share/postgresql/extension/ && \
230245
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
231246
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
247+
248+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
249+
232250
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
@@ -235,4 +250,6 @@ RUN mkdir -p /usr/share/postgresql/extension/ && \
235250
ln -s /usr/lib/postgresql/bin/pgsodium_getkey.sh /usr/share/postgresql/extension/pgsodium_getkey && \
236251
chmod +x /usr/lib/postgresql/bin/pgsodium_getkey.sh
237252

253+
ENV GRN_PLUGINS_DIR=/usr/lib/groonga/plugins
254+
238255
CMD ["postgres", "-D", "/etc/postgresql"]

ansible/tasks/setup-postgrest.yml

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,117 @@
11
- name: PostgREST - system user
2-
user: name=postgrest
2+
ansible.builtin.user:
3+
name: 'postgrest'
4+
state: 'present'
35

46
- name: PostgREST - add Postgres PPA gpg key
5-
apt_key:
6-
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
7-
state: present
7+
ansible.builtin.apt_key:
8+
url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
9+
state: 'present'
810

911
- name: PostgREST - add Postgres PPA main
10-
apt_repository:
12+
ansible.builtin.apt_repository:
13+
filename: 'postgresql-pgdg'
1114
repo: "deb http://apt.postgresql.org/pub/repos/apt/ noble-pgdg {{ postgresql_major }}"
12-
state: present
13-
filename: postgresql-pgdg
15+
state: 'present'
1416

1517
- name: PostgREST - install system dependencies
16-
apt:
18+
ansible.builtin.apt:
1719
package:
18-
- libpq5
1920
- libnuma-dev
20-
update_cache: yes
21-
state: present
21+
- libpq5
22+
update_cache: true
23+
state: 'present'
2224

23-
- name: PostgREST - verify libpq5 version
24-
shell: dpkg -l libpq5 | grep '^ii' | awk '{print $3}'
25-
register: libpq5_version
26-
changed_when: false
25+
- name: PostgREST - grab the list of installed packages
26+
ansible.builtin.package_facts:
2727

2828
- name: Show installed libpq5 version
29-
debug:
30-
msg: "Installed libpq5 version: {{ libpq5_version.stdout }}"
29+
ansible.builtin.debug:
30+
msg: "Installed libpq5 version: {{ ansible_facts['packages']['libpq5'][0]['version'] }}"
3131

3232
- name: PostgREST - remove Postgres PPA gpg key
33-
apt_key:
34-
url: https://www.postgresql.org/media/keys/ACCC4CF8.asc
35-
state: absent
33+
ansible.builtin.apt_key:
34+
state: 'absent'
35+
url: 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
3636

3737
- name: PostgREST - remove Postgres PPA
38-
apt_repository:
38+
ansible.builtin.apt_repository:
3939
repo: "deb http://apt.postgresql.org/pub/repos/apt/ noble-pgdg {{ postgresql_major }}"
40-
state: absent
40+
state: 'absent'
4141

4242
- name: postgis - ensure dependencies do not get autoremoved
43-
shell: |
44-
set -e
45-
apt-mark manual libpq5*
46-
apt-mark manual libnuma*
47-
apt-mark auto libnuma*-dev
43+
ansible.builtin.command:
44+
cmd: apt-mark manual libpq5* libnuma*
45+
46+
- name: postgis - allow libnuma-dev to be autoremoved
47+
ansible.builtin.command:
48+
cmd: apt-mark auto libnuma*-dev
4849

4950
- name: PostgREST - download ubuntu binary archive (arm)
50-
get_url:
51-
url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-ubuntu-aarch64.tar.xz"
52-
dest: /tmp/postgrest.tar.xz
51+
ansible.builtin.get_url:
5352
checksum: "{{ postgrest_arm_release_checksum }}"
53+
dest: '/tmp/postgrest.tar.xz'
5454
timeout: 60
55-
when: platform == "arm64"
56-
57-
- name: PostgREST - download ubuntu binary archive (x86)
58-
get_url:
59-
url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-linux-static-x86-64.tar.xz"
60-
dest: /tmp/postgrest.tar.xz
61-
checksum: "{{ postgrest_x86_release_checksum }}"
62-
timeout: 60
63-
when: platform == "amd64"
55+
url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-{{ download_binary }}.tar.xz"
56+
vars:
57+
download_binary: >-
58+
{%- if platform == "arm64" -%}
59+
ubuntu-aarch64
60+
{%- elif platform == "amd64" -%}
61+
inux-static-x86-64
62+
{%- endif -%}
6463
6564
- name: PostgREST - unpack archive in /opt
66-
unarchive:
67-
remote_src: yes
68-
src: /tmp/postgrest.tar.xz
69-
dest: /opt
70-
owner: postgrest
65+
ansible.builtin.unarchive:
66+
dest: '/opt'
7167
mode: '0755'
68+
owner: 'postgrest'
69+
remote_src: true
70+
src: '/tmp/postgrest.tar.xz'
7271

7372
- name: create directories
74-
file:
75-
state: directory
76-
owner: postgrest
77-
group: postgrest
73+
ansible.builtin.file:
74+
group: 'postgrest'
7875
mode: '0775'
79-
path: /etc/postgrest
76+
owner: 'postgrest'
77+
path: '/etc/postgrest'
78+
state: 'directory'
8079

8180
- name: empty files
82-
file:
83-
state: touch
84-
owner: postgrest
85-
group: postgrest
86-
path: /etc/postgrest/{{ item }}
87-
with_items:
81+
ansible.builtin.file:
82+
group: 'postgrest'
83+
owner: 'postgrest'
84+
path: "/etc/postgrest/{{ empty_item }}"
85+
state: 'touch'
86+
loop:
8887
- base.conf
8988
- generated.conf
89+
loop_control:
90+
loop_var: 'empty_item'
9091

9192
- name: create conf merging script
92-
copy:
93+
ansible.builtin.copy:
9394
content: |
9495
#! /usr/bin/env bash
9596
set -euo pipefail
9697
set -x
9798
cd "$(dirname "$0")"
9899
cat $@ > merged.conf
99-
dest: /etc/postgrest/merge.sh
100-
mode: 0750
101-
owner: postgrest
102-
group: postgrest
100+
dest: '/etc/postgrest/merge.sh'
101+
group: 'postgrest'
102+
mode: '0750'
103+
owner: 'postgrest'
103104

104105
- name: PostgREST - create service files
105-
template:
106-
src: files/{{ item }}.j2
107-
dest: /etc/systemd/system/{{ item }}
108-
with_items:
106+
ansible.builtin.template:
107+
dest: "/etc/systemd/system/{{ svc_item }}"
108+
src: "files/{{ svc_item }}.j2"
109+
loop:
109110
- postgrest.service
110111
- postgrest-optimizations.service
112+
loop_control:
113+
loop_var: 'svc_item'
111114

112115
- name: PostgREST - reload systemd
113-
systemd:
114-
daemon_reload: yes
116+
ansible.builtin.systemd_service:
117+
daemon_reload: true

0 commit comments

Comments
 (0)