Skip to content

feat: additional config for pgbackrest#2099

Draft
Crispy1975 wants to merge 1 commit intodevelopfrom
pjc/indata-403-admin-agent-pgbackrest
Draft

feat: additional config for pgbackrest#2099
Crispy1975 wants to merge 1 commit intodevelopfrom
pjc/indata-403-admin-agent-pgbackrest

Conversation

@Crispy1975
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Additional config for pgBackRest backups and restores. Details further in: https://linear.app/supabase/issue/INDATA-403/admin-agent-add-new-command-to-control-pgbackrest

@Crispy1975 Crispy1975 self-assigned this Mar 30, 2026
@Crispy1975 Crispy1975 force-pushed the pjc/indata-403-admin-agent-pgbackrest branch from 8f44ad4 to 2370c92 Compare March 31, 2026 16:50
Comment on lines +27 to +31
to-pgbackrest)
exec /usr/bin/chown -R pgbackrest:pgbackrest "$REAL"
;;
to-postgres)
exec /usr/bin/chown -R postgres:postgres "$REAL"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
to-pgbackrest)
exec /usr/bin/chown -R pgbackrest:pgbackrest "$REAL"
;;
to-postgres)
exec /usr/bin/chown -R postgres:postgres "$REAL"
to-pgbackrest|to-postgres)
exec /usr/bin/chown -R ${ACTION:3}:postgres "$REAL" ;;

we've been setting everything to group postgres thus far

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pgBackRest binary in the wrapper is executed as the pgbackrest user so the PGDATA path needs to be altered for restores and relics setup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i get that. it'd still be owner pgbackrest with my change?

Comment on lines +20 to +21
recovery) FILE="/data/pgdata/recovery.signal" ;;
standby) FILE="/data/pgdata/standby.signal" ;;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
recovery) FILE="/data/pgdata/recovery.signal" ;;
standby) FILE="/data/pgdata/standby.signal" ;;
recovery|standby) FILE="/data/pgdata/${SIGHNAL_TYPE}.signal" ;;

Comment on lines +28 to +30
case "$ACTION" in
create) exec /usr/bin/touch "$FILE" ;;
remove) exec /usr/bin/rm -f "$FILE" ;;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you make ACTION either touch or rm then you can:

Suggested change
case "$ACTION" in
create) exec /usr/bin/touch "$FILE" ;;
remove) exec /usr/bin/rm -f "$FILE" ;;
case "$ACTION" in
touch|rm) exec /usr/bin/${ACTION} -f "$FILE" ;;

Comment on lines 43 to +67
- name: Create needed directories for pgBackRest
ansible.legacy.file:
group: postgres
mode: '0770'
owner: pgbackrest
path: "{{ backrest_dir }}"
state: directory
loop:
- /etc/pgbackrest/conf.d
- /var/lib/pgbackrest
- /var/spool/pgbackrest
- /var/log/pgbackrest
loop_control:
loop_var: backrest_dir
when:
- nixpkg_mode

- name: Create pgBackRest conf.d directory with setgid
ansible.legacy.file:
group: postgres
mode: '02770'
owner: pgbackrest
path: /etc/pgbackrest/conf.d
state: directory
when:
- nixpkg_mode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- nixpkg_mode
- name: Create needed directories for pgBackRest
ansible.legacy.file:
group: postgres
mode: "{{ backrest_dir['mode'] | default('0770', true) }}"
owner: pgbackrest
path: "{{ backrest_dir['dir'] }}"
state: directory
loop:
- { dir: /etc/pgbackrest/conf.d, mode: '02770' }
- { dir: /var/lib/pgbackrest }
- { dir: /var/spool/pgbackrest }
- { dir: /var/log/pgbackrest }
when:
- nixpkg_mode

Comment on lines +95 to +100
ansible.legacy.copy:
src: files/pgbackrest_config/pgbackrest.logrotate
dest: /etc/logrotate.d/pgbackrest
owner: root
group: root
mode: '0644'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ansible.legacy.copy:
src: files/pgbackrest_config/pgbackrest.logrotate
dest: /etc/logrotate.d/pgbackrest
owner: root
group: root
mode: '0644'
ansible.legacy.copy:
dest: /etc/logrotate.d/pgbackrest
group: root
mode: '0644'
owner: root
src: files/pgbackrest_config/pgbackrest.logrotate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants