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

Migrate Airflow database during SPS deployment #290

Merged
merged 8 commits into from
Jan 27, 2025
Merged

Conversation

LucaCinquini
Copy link
Collaborator

Purpose

  • This PR supports backing up and restoring the Airflow database during an SPS redeployment. Additionally, the Airflow database will now be automatically backed-up daily, and each back-up retained for 7 days.

Proposed Changes

  • [ADD] Final snapshot of the Postgres database automatically created and restored.
  • [ADD] Daily backups of the Postgres database, with 7 days retention period.

Issues

Testing

  • Deployed the SPS, executed a few DAGs, destroyed the SPS, redeployed the SPS and re-published the DAGs through the OGC API. The previous DAG instance runs were retained.
  • Also verified that automatic backups were created nightly.

Copy link
Collaborator

@nikki-t nikki-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I don't have a ton of experience with managing database instances in terraform. So to check my understanding, it looks like the check_rds_snapshot.sh script is used to determine if an RDS snapshot exists which sets the data source for the snapshot. This data source is then used as the snapshot identifier in the aws_db_instance resource which has also been modified to include snapshots. It seems like the snapshot identifier specifies whether to create the database from a snapshot which allows it to be restored after being destroyed. If I have got that right, I think this covers migrating the database during deployments!

@LucaCinquini
Copy link
Collaborator Author

You got that right Nikki, thanks for reviewing and approving the PR.

@LucaCinquini LucaCinquini merged commit dd2d53a into develop Jan 27, 2025
2 checks passed
@LucaCinquini LucaCinquini deleted the 253-migrate-db branch January 27, 2025 15:53
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.

3 participants