-
Notifications
You must be signed in to change notification settings - Fork 54
Add backup/restore plans #339
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
Merged
Merged
Changes from 100 commits
Commits
Show all changes
121 commits
Select commit
Hold shift + click to select a range
564cafe
Re-add backup/restore plans
timidri 9e29589
first WIP version of test plan and workflow
timidri 05c5009
remove buildevents refs
timidri 42ee72f
copy inventory file for teardown
timidri af03f37
fix typo
timidri d134538
don't start ssh session during provisioning
timidri b39cec0
cleanup even if cancelled
timidri a0414da
wait for pause even if previous step failed
timidri 791a2db
try to wait before tearing down
timidri ca063d6
add continue on error
timidri 34311d4
another attempt
timidri 2db76d5
removed always()
timidri eb86c03
don't wait in the ssh loop if previous job was cancelled
timidri 293c5a4
continue on error
timidri fc5d215
now looking at correct pause file
timidri d3bcb83
refactor into 2 jobs
timidri 1a9deb8
fix check wait; fix indentation
timidri 8d50129
fix conditions
timidri 7214920
backup test WIP
timidri 8292db3
Merge main
timidri 01b23db
allow for ca backup
timidri 0d4d485
change implementation to ruby
timidri 9c764db
formatting
timidri 15ad2df
typo and path fixes, use cert auth for pdb export
timidri b12008a
update REFERENCE.md
timidri c7151ee
use cert auth for pdb import
timidri dfbf1f8
regenerate REFERENCE.md using the rake task
timidri b368a7a
Change params to support recovery use case
timidri c0d73d8
restore config from backup if primary degrated
timidri 3f19b4c
fix quoting error
timidri 208f809
check if backup or restore run on a non-peadm cluster
timidri 88ab524
Add backup_type and restore_type params
timidri a331103
Adding test for backup restore
ragingra 182e6f1
Adding test for backup restore
ragingra 4f8a0a4
Merge branch 'SOLARCH-1160' of github.com:puppetlabs/puppetlabs-peadm…
timidri b4f87f9
Fix issue in test_restore.pp
timidri 713a9ea
fix merge conflict
timidri 4ad111d
Changed backup to use ip instead of hostname
ragingra f7764de
Merge branch 'SOLARCH-1160' of github.com:puppetlabs/puppetlabs-peadm…
ragingra 4879fa8
Use $targets for running tasks and commands
timidri da2d273
Moving pause below yq
ragingra fdba96b
Moving .uri outside select
ragingra c74410c
Added inventory file to commands and moving backup file lookup inside…
ragingra 7050b83
Fixing backup file location
ragingra cedb4c1
Fix ls command result
timidri 7fee7b3
strip leading spaces from tar filename
timidri 4e7163f
untar before using peadm config file
timidri dff1c23
Adding host entries to /etc/hosts
timidri 32513a4
fix hosts file format
timidri ce15596
Break by removing classifier database files
timidri 55131f1
add plan to edit inventory file
timidri 710c2d8
merge recovery backup and restore
timidri bf98786
Modify inventory to include name
timidri 3b7cedd
stop breaking classifier db
timidri 7355630
add PE reinstall step
timidri a7efdc7
reinstate remove classifier db
timidri 0a54f83
Fix calling the reinstall task
timidri 694561f
Add continue on error for when reinstall exits with non-zero code
timidri 074a69d
some textual fixes
timidri dc0c376
update docs
timidri 7a99564
add in-code docs
timidri 5badbb7
Merge branch 'main' into SOLARCH-1160
timidri 11673d6
Adding PR review trigger
ragingra cc0bdc1
Add TODOs
timidri c5163b7
Edit backup_restore (first pass)
J-Hunniford ce347a0
Edit to be explicit about primary and db
J-Hunniford 3435e41
another quick edit to clarify primary and db
J-Hunniford a79db7c
Another quick edit for clarity
J-Hunniford e81ab57
revert previous commit
J-Hunniford 7d05ec2
Merge pull request #411 from puppetlabs/J-Hunniford-patch-1
timidri 2af7768
Manually copying Jason's suggestion
timidri 89fa277
Update backup_restore.md
J-Hunniford 8cda117
Merge pull request #414 from puppetlabs/J-Hunniford-patch-1
ragingra ca990e3
Added todos
timidri 7d36a7c
Merge branch 'SOLARCH-1160' of github.com:puppetlabs/puppetlabs-peadm…
timidri a925ad1
added recovery-db restore type
timidri 5dca665
Updating workflow for db recovery
ragingra a01eb43
Add init_db_server and refactor
timidri 782fd1d
fix error handling
timidri 7b080df
document changes needed
timidri b0de776
Updating db recovery step
ragingra f9a8751
Updating db restore
ragingra 621e3d5
revert back to running puppet installer on the db server
timidri 32f6c5f
* add node_manager to bolt-project
timidri 4aedd18
split recovering primary and database
timidri 718e800
remove init_db_server call from the restore plan
timidri 18a3590
Adding puppetrun smoke tests
ragingra 7041b8e
Moving resinstall and init_db
ragingra 47efb18
Changing smoke test to run on all hosts
ragingra 35232d3
rewrite spec test
timidri 1a29af5
Merge branch 'SOLARCH-1160' of github.com:puppetlabs/puppetlabs-peadm…
timidri da2662b
restore spec WIP
timidri e198fa4
removing obsolete files
timidri eec3fb7
add restore spec
timidri 6daff4f
add peadm_config fixtures to test broken cluster restore
timidri 8b41b24
Merge main
timidri 8357651
Add require 'spec_helper' to sanitize_pg_pe_conf_spec.rb
timidri 1dd6d77
Update documentation
timidri e49d6b6
fix rubocop checks
timidri 57f60b7
Adding couple more spec cases
ragingra 5c1c4af
Update documentation/backup_restore.md
timidri bffd086
Update documentation/backup_restore.md
timidri 74b6e99
Update documentation/backup_restore.md
timidri e6458f5
Update documentation/backup_restore.md
timidri b50d3fe
Update documentation/backup_restore.md
timidri fa0d3eb
Update documentation/backup_restore.md
timidri 83568f0
Update documentation/backup_restore.md
timidri ffd6f28
Update documentation/backup_restore.md
timidri aecb6a5
Update documentation/backup_restore.md
timidri 334dfe5
Some suggested updates to backup-restore docs.
timidri 10f903d
Updating backup options table
ragingra 1c5eede
update language
timidri da3e07c
add info on hostname equality
timidri e29233a
Updating output message to remote quote, updating docs to include pe_…
ragingra d17a2db
Merge branch 'main' into SOLARCH-1160
ragingra bffe3f8
Fixing rubocop issues
ragingra 697c1b4
Fixing expected text in spec test
ragingra e71d9e1
Removing todo comments
ragingra 376c65e
[ITHELP-87329] Update test-backup-restore.yaml (#447)
binford2k 9c1a20d
Update backup_restore.md (#432)
J-Hunniford 7606aa5
Merge branch 'main' into SOLARCH-1160
ragingra 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
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,241 @@ | ||
--- | ||
name: "Backup and restore test" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
image: | ||
description: "GCP image for test cluster" | ||
required: true | ||
default: "almalinux-cloud/almalinux-8" | ||
architecture: | ||
description: "PE architecture to test" | ||
required: true | ||
default: "standard" | ||
version: | ||
description: "PE version to install" | ||
required: true | ||
default: "2021.7.4" | ||
ssh-debugging: | ||
description: "Boolean; whether or not to pause for ssh debugging" | ||
required: true | ||
default: "false" | ||
|
||
jobs: | ||
backup: | ||
name: "Backup: Cluster A: PE ${{ inputs.version }} ${{ inputs.architecture }} on ${{ inputs.image }}" | ||
runs-on: ubuntu-20.04 | ||
env: | ||
BOLT_GEM: true | ||
BOLT_DISABLE_ANALYTICS: true | ||
LANG: "en_US.UTF-8" | ||
|
||
steps: | ||
- name: "Start SSH session" | ||
if: ${{ github.event.inputs.ssh-debugging == 'true' }} | ||
uses: luchihoratiu/debug-via-ssh@main | ||
with: | ||
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} | ||
SSH_PASS: ${{ secrets.SSH_PASS }} | ||
|
||
- name: "Checkout Source" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Activate Ruby 2.7" | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: "2.7" | ||
bundler-cache: true | ||
|
||
- name: "Print bundle environment" | ||
if: ${{ github.repository_owner == 'puppetlabs' }} | ||
run: | | ||
echo ::group::info:bundler | ||
bundle env | ||
echo ::endgroup:: | ||
|
||
- name: "Provision test cluster" | ||
timeout-minutes: 15 | ||
run: | | ||
echo ::group::prepare | ||
mkdir -p $HOME/.ssh | ||
echo 'Host *' > $HOME/.ssh/config | ||
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config | ||
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config | ||
bundle exec rake spec_prep | ||
echo ::endgroup:: | ||
|
||
echo ::group::provision | ||
bundle exec bolt plan run peadm_spec::provision_test_cluster \ | ||
--modulepath spec/fixtures/modules \ | ||
provider=provision_service \ | ||
image=${{ inputs.image }} \ | ||
architecture=${{ inputs.architecture }} | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:request | ||
cat request.json || true; echo | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:inventory | ||
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true | ||
echo ::endgroup:: | ||
|
||
# - name: Save inventory file A to an artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: inventory_A | ||
# path: spec/fixtures/litmus_inventory.yaml | ||
|
||
- name: "Install PE on test cluster" | ||
timeout-minutes: 120 | ||
run: | | ||
bundle exec bolt plan run peadm_spec::install_test_cluster \ | ||
--inventoryfile spec/fixtures/litmus_inventory.yaml \ | ||
--modulepath spec/fixtures/modules \ | ||
architecture=${{ inputs.architecture }} \ | ||
version=${{ inputs.version }} | ||
|
||
- name: "Start SSH session" | ||
if: github.event.inputs.ssh-debugging == 'true' | ||
uses: luchihoratiu/debug-via-ssh@main | ||
with: | ||
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} | ||
SSH_PASS: ${{ secrets.SSH_PASS }} | ||
|
||
# - name: Download artifacts | ||
# # if: always() | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# path: spec/fixtures/ | ||
|
||
- name: perform PE backup of cluster A | ||
timeout-minutes: 10 | ||
continue-on-error: true | ||
run: | | ||
echo ::group::prepare | ||
mkdir -p $HOME/.ssh | ||
echo 'Host *' > $HOME/.ssh/config | ||
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config | ||
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config | ||
bundle exec rake spec_prep | ||
echo ::endgroup:: | ||
|
||
echo ::group::backup | ||
bundle exec bolt plan run peadm_spec::test_backup \ | ||
--inventoryfile spec/fixtures/litmus_inventory.yaml \ | ||
--modulepath spec/fixtures/modules | ||
echo ::endgroup:: | ||
|
||
- name: "Wait as long as the file ${HOME}/pause file is present" | ||
continue-on-error: true | ||
# if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} | ||
if: github.event.inputs.ssh-debugging == 'true' | ||
run: | | ||
while [ -f "${HOME}/pause" ] ; do | ||
echo "${HOME}/pause present, sleeping for 60 seconds..." | ||
sleep 10 | ||
done | ||
echo "${HOME}/pause absent, continuing workflow." | ||
|
||
- name: "Tear down cluster A" | ||
if: always() | ||
run: | | ||
if [ -f spec/fixtures/litmus_inventory.yaml ]; then | ||
echo ::group::tear_down | ||
bundle exec rake 'litmus:tear_down' | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:request | ||
cat request.json || true; echo | ||
echo ::endgroup:: | ||
fi | ||
|
||
restore: | ||
name: "Restore: Cluster B: PE ${{ inputs.version }} ${{ inputs.architecture }} on ${{ inputs.image }}" | ||
runs-on: ubuntu-20.04 | ||
env: | ||
BOLT_GEM: true | ||
BOLT_DISABLE_ANALYTICS: true | ||
LANG: "en_US.UTF-8" | ||
|
||
steps: | ||
- name: "Checkout Source" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Activate Ruby 2.7" | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: "2.7" | ||
bundler-cache: true | ||
|
||
- name: "Print bundle environment" | ||
if: ${{ github.repository_owner == 'puppetlabs' }} | ||
run: | | ||
echo ::group::info:bundler | ||
bundle env | ||
echo ::endgroup:: | ||
|
||
- name: "Provision test cluster" | ||
timeout-minutes: 15 | ||
run: | | ||
echo ::group::prepare | ||
mkdir -p $HOME/.ssh | ||
echo 'Host *' > $HOME/.ssh/config | ||
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config | ||
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config | ||
bundle exec rake spec_prep | ||
echo ::endgroup:: | ||
|
||
echo ::group::provision | ||
bundle exec bolt plan run peadm_spec::provision_test_cluster \ | ||
--modulepath spec/fixtures/modules \ | ||
provider=provision_service \ | ||
image=${{ inputs.image }} \ | ||
architecture=${{ inputs.architecture }} | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:request | ||
cat request.json || true; echo | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:inventory | ||
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true | ||
echo ::endgroup:: | ||
|
||
# - name: Save inventory file B to an artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: inventory_B | ||
# path: spec/fixtures/litmus_inventory.yaml | ||
|
||
- name: "Install PE on test cluster" | ||
timeout-minutes: 120 | ||
run: | | ||
bundle exec bolt plan run peadm_spec::install_test_cluster \ | ||
--inventoryfile spec/fixtures/litmus_inventory.yaml \ | ||
--modulepath spec/fixtures/modules \ | ||
architecture=${{ inputs.architecture }} \ | ||
version=${{ inputs.version }} | ||
|
||
- name: Wait for backup to finish | ||
uses: lewagon/[email protected] | ||
with: | ||
ref: ${{ github.ref }} | ||
check-name: "Backup: Cluster A: PE ${{ inputs.version }} ${{ inputs.architecture }} on ${{ inputs.image }}" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
wait-interval: 10 | ||
|
||
- name: "Tear down cluster B" | ||
if: always() | ||
run: | | ||
cp spec/fixtures/inventory_B/litmus_inventory.yaml spec/fixtures/litmus_inventory.yaml || true | ||
if [ -f spec/fixtures/litmus_inventory.yaml ]; then | ||
echo ::group::tear_down | ||
bundle exec rake 'litmus:tear_down' | ||
echo ::endgroup:: | ||
|
||
echo ::group::info:request | ||
cat request.json || true; echo | ||
echo ::endgroup:: | ||
fi |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was that committed if it isn't used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could have been moved to another branch until migration was picked up, but wasn't doing any harm for the time being.