-
-
Notifications
You must be signed in to change notification settings - Fork 218
feat(ansible): add pgBackRest tasks and configurations #1878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jchancojr
wants to merge
33
commits into
develop
Choose a base branch
from
PSQL-773
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+147
−0
Open
Changes from 12 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5be45c3
feat(ansible): add pgBackRest tasks and configurations
jchancojr 32ffede
fix(setup-pgbackrest.yml): update nix install path
jchancojr 16c6474
fix(setup-pgbackrest.yml): fix file module
jchancojr 9bb0eb8
fix(setup-pgbackrest.yml): errant indentation fix
jchancojr e9b3216
Merge remote-tracking branch 'origin/PSQL-773' into PSQL-773
hunleyd 56e3d22
fix(setup-pgbackrest): adjust as per Sam
hunleyd 6b71d69
style(setup-pgbackrest.yml): ansible-lint
jchancojr 7345b6a
refactor(setup-pgbackrest.yml): refactor as per Sam
jchancojr b191228
fix(setup-pgbackrest): Sanitize pgbackrest wrapper script arguments
hunleyd 365fa48
Merge branch 'develop' into PSQL-773
hunleyd 32c047e
Merge branch 'develop' into PSQL-773
jchancojr b223518
feat(setup-pgbackrest.yml): add pgbackrest to sudoers
jchancojr fb412ba
Update ansible/files/pgbackrest_config/pgbackrest.conf
jchancojr 7a50d3b
Update ansible/playbook.yml
jchancojr 865da58
Apply suggestions from code review
jchancojr 6d74ce5
fix(setup-pgbackrest.yml): allow postgres user to run pgbackrest cmds
jchancojr dc709b7
fix(setup-pgbackrest.yml): add /usr/bin/bash to sudoers task
jchancojr f7b9c60
Update ansible/tasks/setup-pgbackrest.yml
hunleyd 1d62a99
Update ansible/tasks/setup-pgbackrest.yml
hunleyd 7d4e051
Merge branch 'develop' into PSQL-773
hunleyd cb223f1
Merge branch 'develop' into PSQL-773
jchancojr 4d2c41a
test(osquery): remove osquery bits to unblock AMI builds
jchancojr 9dac53a
test(osquery): undo previous exclusion of osquery
jchancojr 19c238d
fix(ansible): remove errant syntax
jchancojr 356c105
Merge branch 'develop' into PSQL-773
jchancojr 1b3e7b2
Merge branch 'develop' into PSQL-773
jchancojr 03d62bf
Merge branch 'develop' into PSQL-773
jchancojr eddd913
Merge branch 'develop' into PSQL-773
jchancojr 6d31ff7
Merge branch 'develop' into PSQL-773
jchancojr 852f716
build(vars.yml): update ami suffix for testing
jchancojr f5af39a
Merge branch 'develop' into PSQL-773
hunleyd 9ae839f
Merge branch 'develop' into PSQL-773
jchancojr 4a4a1bd
Merge branch 'develop' into PSQL-773
jchancojr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [global] | ||
| # process-max = 1 | ||
|
|
||
| [archive-get] | ||
| # process-max = 1 | ||
|
|
||
| [archive-push] | ||
| # process-max = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [global] | ||
| archive-async = n | ||
| archive-copy = y | ||
| backup-standby = prefer | ||
| compress-type = zst | ||
| delta = y | ||
| expire-auto = n | ||
| link-all = y | ||
| log-level-console = info | ||
| log-level-file = detail | ||
| log-subprocess = y | ||
| resume = n | ||
| start-fast = y | ||
| [supabase] | ||
| pg1-path = /var/lib/postgresql/data | ||
| pg1-socket-path = /run/postgresql | ||
| pg1-user = supabase_admin | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [supabase] | ||
| repo1-block = y | ||
| repo1-bundle = y | ||
| # repo1-path = <foo> | ||
| repo1-retention-diff = 1 | ||
| repo1-retention-full = 28 | ||
| repo1-retention-full-type = time | ||
| repo1-retention-history = 0 | ||
| # repo1-s3-bucket= <foo> | ||
| # repo1-s3-endpoint= <foo> | ||
| repo1-s3-key-type = auto | ||
| # repo1-s3-region = <foo> | ||
| repo1-storage-upload-chunk-size = 10MiB | ||
| repo1-type = s3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [supabase] | ||
| # archive-async = y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [supabase] | ||
| # repo-cipher-pass = {{ generated pass }} | ||
| # repo-cipher-type = aes-256-cbc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| - name: Create pgBackRest group | ||
| ansible.builtin.group: | ||
| name: pgbackrest | ||
| state: present | ||
| when: nixpkg_mode | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Create pgBackRest user | ||
| ansible.builtin.user: | ||
| comment: pgBackRest user | ||
| group: pgbackrest | ||
| groups: pgbackrest, postgres | ||
| home: /var/lib/pgbackrest | ||
| name: pgbackrest | ||
| shell: /sbin/nologin | ||
| system: true | ||
| when: nixpkg_mode | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Allow pgBackRest to run commands | ||
| copy: | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dest: /etc/sudoers.d/pgbackrest | ||
| owner: root | ||
| group: root | ||
| mode: '0440' | ||
| content: | | ||
| pgbackrest ALL=(ALL) NOPASSWD: /usr/bin/pgbackrest | ||
| - name: Install pgBackRest | ||
| become: true | ||
| become_user: pgbackrest | ||
| ansible.builtin.shell: | | ||
| 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" | ||
| changed_when: true | ||
| when: stage2_nix | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - 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 | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Symlink pgbackrest.conf | ||
| ansible.legacy.file: | ||
| force: true | ||
| path: /etc/pgbackrest/pgbackrest.conf | ||
| src: /etc/pgbackrest.conf | ||
| state: link | ||
|
|
||
| - name: Move pgBackRest files to /etc/pgbackrest | ||
| ansible.legacy.copy: | ||
| group: postgres | ||
| dest: "/etc/pgbackrest/{{ conf_item['path'] }}/{{ conf_item['name'] }}" | ||
| mode: '0644' | ||
| owner: pgbackrest | ||
| src: "files/pgbackrest_config/{{ conf_item['name'] }}" | ||
| loop: | ||
| - {name: computed_globals.conf, path: conf.d} | ||
| - {name: pgbackrest.conf, path: ''} | ||
| - {name: repo1_async.conf, path: conf.d} | ||
| - {name: repo1_encrypted.conf, path: conf.d} | ||
| - {name: repo1.conf, path: conf.d} | ||
| loop_control: | ||
| loop_var: conf_item | ||
| when: stage2_nix | ||
jchancojr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: Configure sudoers for pgBackRest | ||
| ansible.builtin.lineinfile: | ||
| create: yes | ||
| line: 'postgres ALL=(pgbackrest) NOPASSWD: /var/lib/pgbackrest/.nix-profile/bin/pgbackrest' | ||
| mode: '0440' | ||
| path: '/etc/sudoers.d/pgbackrest' | ||
| validate: 'visudo -cf %s' | ||
|
|
||
| - name: Create pgBackRest wrapper script | ||
| ansible.builtin.copy: | ||
| content: | | ||
| #!/bin/bash | ||
| _raw_args="$@" | ||
| _sanitized_args=$(echo $_raw_args | sed -e 's/--cmd=[^ ]*//g; s/--repo-host-cmd=[^ ]*//g; s/--config=[^ ]*//g' ) | ||
| exec sudo -u pgbackrest /var/lib/pgbackrest/.nix-profile/bin/pgbackrest "$_sanitized_args" | ||
| dest: '/usr/bin/pgbackrest' | ||
| group: 'root' | ||
| mode: '0755' | ||
| owner: 'root' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.