Skip to content
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

Add support for Fly Volume Restores #63

Merged
merged 7 commits into from
Feb 3, 2023
Merged

Add support for Fly Volume Restores #63

merged 7 commits into from
Feb 3, 2023

Conversation

davissp14
Copy link
Contributor

@davissp14 davissp14 commented Feb 2, 2023

This adds support for Fly-based volume restores.

How it works

The initial cue for kicking off a restore is the presence of the FLY_RESTORED_FROM environment variable. When this environment variable is present, we will push through the following process.

  1. Check to see if the restore.lock file exists. The restore process will begin if the restore.lock file does not exist, or it exists but its value does not match the name of our app.
  2. Reconfigure the pg_hba.conf file so we can bypass authentication locally.
  3. Boot Postgres into standalone mode.
  4. Create and update the flypgadmin, repmgr and postgres users and ensure their credentials match the current environment.
  5. The repmgr database will be dropped so we can start a fresh cluster setup.
  6. Revert the pg_hba.conf file back to its original configuration.
  7. Shutdown the standalone Postgres
  8. Create the restore.lock file and set its value to the name of our app. This will ensure the restore process isn't retried.
  9. Begin the normal boot process.

Notes

  • When restoring from a snapshot using flyctl, it's recommended that you restore into a single node cluster. Scale-out as needed once the restore completes.
  • The credentials for the flypgadmin, repmgr and postgres will not be persisted across restores.

@davissp14 davissp14 marked this pull request as ready for review February 3, 2023 03:51
@davissp14 davissp14 changed the title WIP: Restore support Add support for Fly Volume Restores Feb 3, 2023
@davissp14 davissp14 merged commit 42b3712 into master Feb 3, 2023
@davissp14 davissp14 deleted the restore-support branch February 25, 2023 01:56
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.

1 participant