Skip to content

Commit 57bb5bc

Browse files
authored
chore: init admin-mgr (#514)
* chore: bump versions * chore: update adminapi.sudoers.conf * chore: remove no longer needed scripts * chore: update archive and restore commands * chore: install admin-mgr * chore: bump admin-mgr version * chore: bump version * chore: cleanup unnecessary perms * chore: cleanup even more no longer needed perms * chore: more cleanup
1 parent c67969b commit 57bb5bc

13 files changed

+31
-114
lines changed

ansible/files/admin_api_scripts/commence_walg_backup.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

ansible/files/admin_api_scripts/commence_walg_restore.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

ansible/files/admin_api_scripts/complete_walg_restore.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

ansible/files/admin_api_scripts/disable_walg.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

ansible/files/admin_api_scripts/enable_walg.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

ansible/files/adminapi.sudoers.conf

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ Cmnd_Alias GOTRUE = /bin/systemctl start gotrue.service, /bin/systemctl stop got
44
Cmnd_Alias PGBOUNCER = /bin/systemctl start pgbouncer.service, /bin/systemctl stop pgbouncer.service, /bin/systemctl restart pgbouncer.service, /bin/systemctl disable pgbouncer.service, /bin/systemctl enable pgbouncer.service, /bin/systemctl reload pgbouncer.service
55

66
%adminapi ALL= NOPASSWD: /root/grow_fs.sh
7-
%adminapi ALL= NOPASSWD: /root/commence_walg_backup.sh
8-
%adminapi ALL= NOPASSWD: /root/commence_walg_restore.sh
9-
%adminapi ALL= NOPASSWD: /root/complete_walg_restore.sh
10-
%adminapi ALL= NOPASSWD: /root/disable_walg.sh
11-
%adminapi ALL= NOPASSWD: /root/enable_walg.sh
127
%adminapi ALL= NOPASSWD: /root/manage_readonly_mode.sh
138
%adminapi ALL= NOPASSWD: /root/pg_upgrade_prepare.sh
149
%adminapi ALL= NOPASSWD: /root/pg_upgrade_initiate.sh
@@ -22,6 +17,7 @@ Cmnd_Alias PGBOUNCER = /bin/systemctl start pgbouncer.service, /bin/systemctl st
2217
%adminapi ALL= NOPASSWD: /bin/systemctl daemon-reload
2318
%adminapi ALL= NOPASSWD: /bin/systemctl restart services.slice
2419
%adminapi ALL= NOPASSWD: /usr/sbin/nft -f /etc/nftables/supabase_managed.conf
20+
%adminapi ALL= NOPASSWD: /usr/bin/admin-mgr
2521
%adminapi ALL= NOPASSWD: KONG
2622
%adminapi ALL= NOPASSWD: POSTGREST
2723
%adminapi ALL= NOPASSWD: GOTRUE

ansible/files/postgresql_config/custom_walg.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# - Archiving -
22

33
#archive_mode = on
4-
#archive_command = 'sudo -u wal-g wal-g wal-push %p --config /etc/wal-g/config.json >> /var/log/wal-g/wal-push.log 2>&1'
4+
#archive_command = '/usr/bin/admin-mgr wal-push %p >> /var/log/wal-g/wal-push.log 2>&1'
55
#archive_timeout = 120
66

77

88
# - Archive Recovery -
99

10-
#restore_command = '/home/postgres/wal_fetch.sh %f %p >> /var/log/wal-g/wal-fetch.log 2>&1'
10+
#restore_command = '/usr/bin/admin-mgr wal-fetch %f %p >> /var/log/wal-g/wal-fetch.log 2>&1'
1111

1212
# - Recovery Target -
1313

ansible/tasks/internal/admin-api.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
mode: "0700"
1212
owner: root
1313
loop:
14-
- { file: "commence_walg_backup.sh" }
15-
- { file: "commence_walg_restore.sh" }
16-
- { file: "complete_walg_restore.sh" }
17-
- { file: "disable_walg.sh" }
18-
- { file: "enable_walg.sh" }
1914
- { file: "grow_fs.sh" }
2015
- { file: "manage_readonly_mode.sh" }
2116
- { file: "pg_upgrade_check.sh" }

ansible/tasks/internal/admin-mgr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- name: Setting arch (x86)
2+
set_fact:
3+
arch: "x86"
4+
when: platform == "amd64"
5+
6+
- name: Setting arch (arm)
7+
set_fact:
8+
arch: "arm64"
9+
when: platform == "arm64"
10+
11+
- name: Download admin-mgr archive
12+
get_url:
13+
url: "https://supabase-public-artifacts-bucket.s3.amazonaws.com/admin-mgr/v{{ adminmgr_release }}/admin-mgr_{{ adminmgr_release }}_linux_{{ arch }}.tar.gz"
14+
dest: "/tmp/admin-mgr.tar.gz"
15+
timeout: 90
16+
17+
- name: admin-mgr - unpack archive in /usr/bin/
18+
unarchive:
19+
remote_src: yes
20+
src: /tmp/admin-mgr.tar.gz
21+
dest: /usr/bin/
22+
owner: root

ansible/tasks/setup-supabase-internal.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@
8383
- name: Install supautils
8484
import_tasks: internal/supautils.yml
8585

86+
- name: Install admin-mgr
87+
import_tasks: internal/admin-mgr.yml
88+
8689
- name: Install adminapi
8790
import_tasks: internal/admin-api.yml
8891

ansible/tasks/setup-wal-g.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@
7676
group: wal-g
7777
groups: wal-g, postgres
7878

79-
- name: Give postgres access to execute wal-g binary as wal-g user
80-
copy:
81-
content: |
82-
postgres ALL=(wal-g) NOPASSWD: /usr/local/bin/wal-g
83-
postgres ALL=(root) NOPASSWD: /root/wal_change_ownership.sh
84-
dest: /etc/sudoers.d/postgres
85-
8679
- name: Create a config directory owned by wal-g
8780
file:
8881
path: /etc/wal-g

ansible/vars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ postgres_exporter_release_checksum:
4141
arm64: sha256:d869c16791481dc8475487ad84ae4371a63f9b399898ca1c666eead5cccf7182
4242
amd64: sha256:ff541bd3ee19c0ae003d71424a75edfcc8695e828dd20d5b4555ce433c89d60b
4343

44-
adminapi_release: 0.32.0
44+
adminapi_release: 0.34.0
45+
adminmgr_release: 0.3.0
4546

4647
# Postgres Extensions
4748
postgis_release: "3.3.2"

common.vars.pkr.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.32"
1+
postgres-version = "15.1.0.33"

0 commit comments

Comments
 (0)