Skip to content

Commit 7f9a1fd

Browse files
committed
Merge remote-tracking branch 'origin' into chrisg/add-subscription-schema
2 parents 5e30187 + 1b91692 commit 7f9a1fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+13693
-525
lines changed

Dockerfile-15

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/lib/postgresql/s
9090
RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/share/postgresql/
9191
RUN chown -R postgres:postgres /usr/lib/postgresql/share/postgresql/
9292
RUN chown -R postgres:postgres /usr/share/postgresql/
93-
# Create symbolic links for contrib directory
94-
RUN mkdir -p /usr/lib/postgresql/share/postgresql/contrib \
95-
&& find /nix/var/nix/profiles/default/share/postgresql/contrib/ -mindepth 1 -type d -exec sh -c 'for dir do ln -s "$dir" "/usr/lib/postgresql/share/postgresql/contrib/$(basename "$dir")"; done' sh {} + \
96-
&& chown -R postgres:postgres /usr/lib/postgresql/share/postgresql/contrib/
9793

9894
RUN chown -R postgres:postgres /usr/lib/postgresql
9995

Dockerfile-17

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/lib/postgresql/s
9191
RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/share/postgresql/
9292
RUN chown -R postgres:postgres /usr/lib/postgresql/share/postgresql/
9393
RUN chown -R postgres:postgres /usr/share/postgresql/
94-
# Create symbolic links for contrib directory
94+
9595
RUN tree /nix > /tmp/tree.txt && cat /tmp/tree.txt && cat /tmp/tree.txt >&2
9696

9797
RUN chown -R postgres:postgres /usr/lib/postgresql

Dockerfile-orioledb-17

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/lib/postgresql/s
9191
RUN ln -s /nix/var/nix/profiles/default/share/postgresql/* /usr/share/postgresql/
9292
RUN chown -R postgres:postgres /usr/lib/postgresql/share/postgresql/
9393
RUN chown -R postgres:postgres /usr/share/postgresql/
94-
# Create symbolic links for contrib directory
94+
9595
RUN tree /nix > /tmp/tree.txt && cat /tmp/tree.txt && cat /tmp/tree.txt >&2
9696

9797
RUN chown -R postgres:postgres /usr/lib/postgresql

ansible/files/envoy_config/lds.supabase.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ resources:
259259
cluster: gotrue
260260
prefix_rewrite: /
261261
timeout: 35s
262+
retry_policy:
263+
retry_on: "connect-failure,refused-stream,gateway-error"
264+
num_retries: 3
265+
retry_back_off:
266+
base_interval: 1s
267+
max_interval: 3s
262268
- match:
263269
prefix: /rest/v1/
264270
query_parameters:

ansible/files/envoy_config/lds.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ resources:
285285
cluster: gotrue
286286
prefix_rewrite: /
287287
timeout: 35s
288+
retry_policy:
289+
retry_on: "connect-failure,refused-stream,gateway-error"
290+
num_retries: 3
291+
retry_back_off:
292+
base_interval: 1s
293+
max_interval: 3s
288294
- match:
289295
prefix: /rest/v1/
290296
query_parameters:

ansible/files/postgresql_config/supautils.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
supautils.extensions_parameter_overrides = '{"pg_cron":{"schema":"pg_catalog"}}'
2-
supautils.policy_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.mfa_factors","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
3-
supautils.drop_trigger_grants = '{"postgres":["auth.audit_log_entries","auth.identities","auth.mfa_factors","auth.refresh_tokens","auth.sessions","auth.users","realtime.messages","storage.buckets","storage.migrations","storage.objects","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
2+
supautils.policy_grants = '{"postgres":["auth.audit_log_entries","auth.flow_state","auth.identities","auth.instances","auth.mfa_amr_claims","auth.mfa_challenges","auth.mfa_factors","auth.oauth_clients","auth.one_time_tokens","auth.refresh_tokens","auth.saml_providers","auth.saml_relay_states","auth.sessions","auth.sso_domains","auth.sso_providers","auth.users","realtime.messages","realtime.subscription","storage.buckets","storage.buckets_analytics","storage.objects","storage.prefixes","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
3+
supautils.drop_trigger_grants = '{"postgres":["auth.audit_log_entries","auth.flow_state","auth.identities","auth.instances","auth.mfa_amr_claims","auth.mfa_challenges","auth.mfa_factors","auth.oauth_clients","auth.one_time_tokens","auth.refresh_tokens","auth.saml_providers","auth.saml_relay_states","auth.sessions","auth.sso_domains","auth.sso_providers","auth.users","realtime.messages","realtime.subscription","storage.buckets","storage.buckets_analytics","storage.objects","storage.prefixes","storage.s3_multipart_uploads","storage.s3_multipart_uploads_parts"]}'
44
# full list: address_standardizer, address_standardizer_data_us, adminpack, amcheck, autoinc, bloom, btree_gin, btree_gist, citext, cube, dblink, dict_int, dict_xsyn, earthdistance, file_fdw, fuzzystrmatch, hstore, http, hypopg, index_advisor, insert_username, intagg, intarray, isn, lo, ltree, moddatetime, old_snapshot, orioledb, pageinspect, pg_buffercache, pg_cron, pg_freespacemap, pg_graphql, pg_hashids, pg_jsonschema, pg_net, pg_prewarm, pg_repack, pg_stat_monitor, pg_stat_statements, pg_surgery, pg_tle, pg_trgm, pg_visibility, pg_walinspect, pgaudit, pgcrypto, pgjwt, pgmq, pgroonga, pgroonga_database, pgrouting, pgrowlocks, pgsodium, pgstattuple, pgtap, plcoffee, pljava, plls, plpgsql, plpgsql_check, plv8, postgis, postgis_raster, postgis_sfcgal, postgis_tiger_geocoder, postgis_topology, postgres_fdw, refint, rum, seg, sslinfo, supabase_vault, supautils, tablefunc, tcn, timescaledb, tsm_system_rows, tsm_system_time, unaccent, uuid-ossp, vector, wrappers, xml2
55
# omitted because may be unsafe: adminpack, amcheck, file_fdw, lo, old_snapshot, pageinspect, pg_freespacemap, pg_surgery, pg_visibility
66
# omitted because deprecated: intagg, xml2

ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ begin
1818
physical backups everywhere
1919
*/
2020
-- Detach and delete the official function
21-
alter extension pgmq drop function pgmq.drop_queue;
22-
drop function pgmq.drop_queue;
21+
alter extension pgmq drop function pgmq.drop_queue(TEXT);
22+
drop function pgmq.drop_queue(TEXT);
2323

2424
-- Create and reattach the patched function
2525
CREATE FUNCTION pgmq.drop_queue(queue_name TEXT)
@@ -134,7 +134,7 @@ BEGIN
134134
END;
135135
$func$ LANGUAGE plpgsql;
136136

137-
alter extension pgmq add function pgmq.drop_queue;
137+
alter extension pgmq add function pgmq.drop_queue(TEXT);
138138

139139

140140
update pg_extension set extowner = 'postgres'::regrole where extname = 'pgmq';

ansible/files/supabase_admin_agent_config/supabase-admin-agent_salt.service.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ StandardOutput=journal
1919
StandardError=journal
2020
StateDirectory=supabase-admin-agent
2121
CacheDirectory=supabase-admin-agent
22+
# set tempdir on permanent disk
23+
Environment="TMPDIR=/var/tmp"
2224

2325
[Install]
2426
WantedBy=multi-user.target

ansible/tasks/setup-docker.yml

Lines changed: 77 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,87 @@
1-
- name: Copy extension packages
2-
copy:
3-
src: files/extensions/
4-
dest: /tmp/extensions/
5-
when: debpkg_mode
1+
- name: debpkg_mode actions
2+
when:
3+
- debpkg_mode
4+
block:
5+
- name: Copy extension packages
6+
ansible.builtin.copy:
7+
dest: '/tmp/extensions/'
8+
src: 'files/extensions/'
69

7-
# Builtin apt module does not support wildcard for deb paths
8-
- name: Install extensions
9-
shell: |
10-
set -e
11-
apt-get update
12-
apt-get install -y --no-install-recommends /tmp/extensions/*.deb
13-
when: debpkg_mode
10+
- name: Install extensions
11+
ansible.builtin.apt:
12+
deb: "{{ deb_item }}"
13+
force_apt_get: true
14+
install_recommends: false
15+
state: 'present'
16+
update_cache: true
17+
loop_control:
18+
loop_var: 'deb_item'
19+
with_fileglob:
20+
- '/tmp/extensions/*.deb'
1421

15-
- name: pgsodium - determine postgres bin directory
16-
shell: pg_config --bindir
17-
register: pg_bindir_output
18-
when: debpkg_mode
19-
20-
- set_fact:
21-
pg_bindir: "{{ pg_bindir_output.stdout }}"
22-
when: debpkg_mode
22+
- name: pgsodium - determine PostgreSQL bin directory
23+
ansible.builtin.command:
24+
cmd: pg_config --bindir
25+
changed_when: false
26+
register: 'pg_bindir_output'
27+
28+
- name: store the PostgreSQL bin dir as a fact
29+
ansible.builtin.set_fact:
30+
pg_bindir: "{{ pg_bindir_output['stdout'] }}"
2331

24-
- name: pgsodium - set pgsodium.getkey_script
25-
become: yes
26-
lineinfile:
27-
path: /etc/postgresql/postgresql.conf
28-
state: present
29-
# script is expected to be placed by finalization tasks for different target platforms
30-
line: pgsodium.getkey_script= '{{ pg_bindir }}/pgsodium_getkey.sh'
31-
when: debpkg_mode
32+
- name: pgsodium - set pgsodium.getkey_script
33+
ansible.builtin.lineinfile:
34+
path: '/etc/postgresql/postgresql.conf'
35+
# script is expected to be placed by finalization tasks for different target platforms
36+
line: pgsodium.getkey_script= '{{ pg_bindir }}/pgsodium_getkey.sh'
37+
state: 'present'
38+
become: true
3239

33-
# supautils
34-
- name: supautils - add supautils to session_preload_libraries
35-
become: yes
36-
replace:
37-
path: /etc/postgresql/postgresql.conf
38-
regexp: "#session_preload_libraries = ''"
39-
replace: session_preload_libraries = 'supautils'
40-
when: debpkg_mode or stage2_nix
40+
- name: debpkg_mode or stage2_nix actions
41+
when:
42+
- (debpkg_mode or stage2_nix)
43+
block:
44+
# supautils
45+
- name: supautils - add supautils to session_preload_libraries
46+
ansible.builtin.replace:
47+
path: '/etc/postgresql/postgresql.conf'
48+
regexp: "#session_preload_libraries = ''"
49+
replace: "session_preload_libraries = 'supautils'"
50+
become: true
4151

42-
- name: supautils - write custom supautils.conf
43-
template:
44-
src: "files/postgresql_config/supautils.conf.j2"
45-
dest: /etc/postgresql-custom/supautils.conf
46-
mode: 0664
47-
owner: postgres
48-
group: postgres
49-
when: debpkg_mode or stage2_nix
52+
- name: supautils - write custom supautils.conf
53+
ansible.builtin.template:
54+
dest: '/etc/postgresql-custom/supautils.conf'
55+
mode: '0664'
56+
group: 'postgres'
57+
owner: 'postgres'
58+
src: 'files/postgresql_config/supautils.conf.j2'
5059

51-
- name: supautils - copy extension custom scripts
52-
copy:
53-
src: files/postgresql_extension_custom_scripts/
54-
dest: /etc/postgresql-custom/extension-custom-scripts
55-
become: yes
56-
when: debpkg_mode or stage2_nix
60+
- name: supautils - copy extension custom scripts
61+
ansible.builtin.copy:
62+
dest: '/etc/postgresql-custom/extension-custom-scripts'
63+
src: 'files/postgresql_extension_custom_scripts/'
64+
become: true
5765

58-
- name: supautils - chown extension custom scripts
59-
file:
60-
mode: 0775
61-
owner: postgres
62-
group: postgres
63-
path: /etc/postgresql-custom/extension-custom-scripts
64-
recurse: yes
65-
become: yes
66-
when: debpkg_mode or stage2_nix
66+
- name: supautils - chown extension custom scripts
67+
ansible.builtin.file:
68+
group: 'postgres'
69+
mode: '0775'
70+
owner: 'postgres'
71+
path: '/etc/postgresql-custom/extension-custom-scripts'
72+
recurse: true
73+
become: true
6774

68-
- name: supautils - include /etc/postgresql-custom/supautils.conf in postgresql.conf
69-
become: yes
70-
replace:
71-
path: /etc/postgresql/postgresql.conf
72-
regexp: "#include = '/etc/postgresql-custom/supautils.conf'"
73-
replace: "include = '/etc/postgresql-custom/supautils.conf'"
74-
when: debpkg_mode or stage2_nix
75+
- name: supautils - include /etc/postgresql-custom/supautils.conf in postgresql.conf
76+
ansible.builtin.replace:
77+
path: '/etc/postgresql/postgresql.conf'
78+
regexp: "#include = '/etc/postgresql-custom/supautils.conf'"
79+
replace: "include = '/etc/postgresql-custom/supautils.conf'"
80+
become: true
7581

7682
- name: Cleanup - extension packages
77-
file:
78-
path: /tmp/extensions
79-
state: absent
80-
when: debpkg_mode
83+
ansible.builtin.file:
84+
path: '/tmp/extensions'
85+
state: 'absent'
86+
when:
87+
- debpkg_mode

ansible/tasks/setup-envoy.yml

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,61 @@
11
- name: Envoy - system user
22
ansible.builtin.user:
3-
name: envoy
3+
name: 'envoy'
4+
state: 'present'
45

56
- name: Envoy - download binary
67
ansible.builtin.get_url:
78
checksum: "{{ envoy_release_checksum }}"
8-
dest: /opt/envoy
9-
group: envoy
10-
mode: u+x
11-
owner: envoy
9+
dest: '/opt/envoy'
10+
group: 'envoy'
11+
mode: '0700'
12+
owner: 'envoy'
1213
# yamllint disable-line rule:line-length
1314
url: "https://github.com/envoyproxy/envoy/releases/download/v{{ envoy_release }}/envoy-{{ envoy_release }}-linux-aarch_64"
1415

1516
- name: Envoy - download hot restarter script
1617
ansible.builtin.get_url:
1718
checksum: "{{ envoy_hot_restarter_release_checksum }}"
18-
dest: /opt/envoy-hot-restarter.py
19-
group: envoy
20-
mode: u+x
21-
owner: envoy
19+
dest: '/opt/envoy-hot-restarter.py'
20+
group: 'envoy'
21+
mode: '0700'
22+
owner: 'envoy'
2223
# yamllint disable-line rule:line-length
23-
url: https://raw.githubusercontent.com/envoyproxy/envoy/v{{ envoy_release }}/restarter/hot-restarter.py
24+
url: "https://raw.githubusercontent.com/envoyproxy/envoy/v{{ envoy_release }}/restarter/hot-restarter.py"
2425

2526
- name: Envoy - bump up ulimit
2627
community.general.pam_limits:
27-
domain: envoy
28-
limit_item: nofile
29-
limit_type: soft
30-
value: 4096
28+
domain: 'envoy'
29+
limit_item: 'nofile'
30+
limit_type: 'soft'
31+
value: '4096'
3132

3233
- name: Envoy - create script to start envoy
3334
ansible.builtin.copy:
34-
dest: /opt/start-envoy.sh
35-
group: envoy
36-
mode: u+x
37-
owner: envoy
38-
src: files/start-envoy.sh
35+
dest: '/opt/start-envoy.sh'
36+
group: 'envoy'
37+
mode: '0700'
38+
owner: 'envoy'
39+
src: 'files/start-envoy.sh'
3940

4041
- name: Envoy - create configuration files
4142
ansible.builtin.copy:
42-
dest: /etc/envoy/
43-
directory_mode: u=rwx,g=rwx,o=rx
44-
group: envoy
45-
mode: u=rw,g=rw,o=r
46-
owner: envoy
47-
src: files/envoy_config/
43+
dest: '/etc/envoy/'
44+
directory_mode: '0775'
45+
group: 'envoy'
46+
mode: '0664'
47+
owner: 'envoy'
48+
src: 'files/envoy_config/'
4849

4950
- name: Envoy - create service file
5051
ansible.builtin.copy:
51-
dest: /etc/systemd/system/envoy.service
52-
mode: u=rw,g=r,o=r
53-
src: files/envoy.service
52+
dest: '/etc/systemd/system/envoy.service'
53+
mode: '0644'
54+
src: 'files/envoy.service'
5455

5556
- name: Envoy - disable service
56-
ansible.builtin.systemd:
57+
ansible.builtin.systemd_service:
5758
daemon_reload: true
5859
enabled: false
59-
name: envoy
60-
state: stopped
60+
name: 'envoy'
61+
state: 'stopped'

0 commit comments

Comments
 (0)