Skip to content

Commit e9b3216

Browse files
committed
Merge remote-tracking branch 'origin/PSQL-773' into PSQL-773
* origin/PSQL-773: fix(setup-pgbackrest.yml): errant indentation fix fix(setup-pgbackrest.yml): fix file module fix(setup-pgbackrest.yml): update nix install path feat(ansible): add pgBackRest tasks and configurations
2 parents 5d43513 + 9bb0eb8 commit e9b3216

File tree

7 files changed

+123
-0
lines changed

7 files changed

+123
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[global]
2+
# process-max = 1
3+
4+
[archive-get]
5+
# process-max = 1
6+
7+
[archive-push]
8+
# process-max = 1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[global]
2+
archive-async = n
3+
archive-copy = y
4+
backup-standby = prefer
5+
compress-type = zst
6+
delta = y
7+
expire-auto = n
8+
link-all = y
9+
log-level-console = info
10+
log-level-file = detail
11+
log-subprocess = y
12+
resume = n
13+
start-fast = y
14+
[supabase]
15+
pg1-path = /var/lib/postgresql/data
16+
pg1-socket-path = /run/postgresql
17+
pg1-user = supabase_admin
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[supabase]
2+
repo1-block = y
3+
repo1-bundle = y
4+
# repo1-path = <foo>
5+
repo1-retention-diff = 1
6+
repo1-retention-full = 28
7+
repo1-retention-full-type = time
8+
repo1-retention-history = 0
9+
# repo1-s3-bucket= <foo>
10+
# repo1-s3-endpoint= <foo>
11+
repo1-s3-key-type = auto
12+
# repo1-s3-region = <foo>
13+
repo1-storage-upload-chunk-size = 10MiB
14+
repo1-type = s3
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[supabase]
2+
# archive-async = y
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[supabase]
2+
# repo-cipher-pass = {{ generated pass }}
3+
# repo-cipher-type = aes-256-cbc

ansible/playbook.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
import_tasks: tasks/setup-wal-g.yml
4141
when: debpkg_mode or nixpkg_mode or stage2_nix
4242

43+
- name: Install pgBackRest
44+
import_tasks: tasks/setup-pgbackrest.yml
45+
when: debpkg_mode or nixpkg_mode or stage2_nix
46+
4347
- name: Install Gotrue
4448
import_tasks: tasks/setup-gotrue.yml
4549
tags:

ansible/tasks/setup-pgbackrest.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
- name: Create pgBackRest group
2+
group:
3+
name: pgbackrest
4+
state: present
5+
when: nixpkg_mode
6+
7+
- name: Create pgBackRest user
8+
user:
9+
name: pgbackrest
10+
comment: pgBackRest user
11+
group: pgbackrest
12+
groups: pgbackrest, postgres
13+
shell: /sbin/nologin
14+
system: true
15+
home: /var/lib/pgbackrest
16+
when: nixpkg_mode
17+
18+
- name: Install pgBackRest
19+
become: true
20+
become_user: pgbackrest
21+
shell: |
22+
sudo -u pgbackrest bash -c ". /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh && nix profile install github:supabase/postgres/{{ git_commit_sha }}#pg-backrest"
23+
when: stage2_nix
24+
25+
- name: Create needed directories for pgBackRest
26+
file:
27+
path: "{{ backrest_dir }}"
28+
state: directory
29+
owner: pgbackrest
30+
group: postgres
31+
mode: '0770'
32+
loop:
33+
- /etc/pgbackrest/conf.d
34+
- /var/lib/pgbackrest
35+
- /var/spool/pgbackrest
36+
- /var/log/pgbackrest
37+
loop_control:
38+
loop_var: backrest_dir
39+
when: nixpkg_mode
40+
41+
- name: Symlink pgbackrest.conf
42+
file:
43+
path: /etc/pgbackrest/pgbackrest.conf
44+
src: /etc/pgbackrest.conf
45+
state: link
46+
force: true
47+
48+
- name: Move pgBackRest files to /etc/pgbackrest
49+
copy:
50+
dest: "/etc/pgbackrest/{{ conf_item['path'] }}/{{ conf_item['name'] }}"
51+
group: postgres
52+
mode: '0644'
53+
owner: pgbackrest
54+
src: "files/pgbackrest_config/{{ conf_item['name'] }}"
55+
loop:
56+
- {name: computed_globals.conf, path: conf.d}
57+
- {name: pgbackrest.conf, path: ''}
58+
- {name: repo1_async.conf, path: conf.d}
59+
- {name: repo1_encrypted.conf, path: conf.d}
60+
- {name: repo1.conf, path: conf.d}
61+
loop_control:
62+
loop_var: conf_item
63+
when: stage2_nix
64+
65+
- name: Symlink pgBackRest binary
66+
file:
67+
path: /usr/bin/pgbackrest
68+
src: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest
69+
state: link
70+
71+
- name: Sticky bit the pgBackRest binary
72+
file:
73+
path: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest
74+
mode: '4755'
75+
become: true

0 commit comments

Comments
 (0)