You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/backups_and_restores.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ Information regarding the fac-backup-utility can be found [at the repository](ht
34
34
Database backups occur in the following ways:
35
35
1. An initial backup, where a backup has not been run in the target environment. This input of `initial_backup` is important, as when it does a the `db_to_db` command, it will not truncate the target table, as the table does not exist in the destination database.
36
36
```bash
37
-
./fac-backup-util.sh v0.1.10 initial_backup
37
+
./fac-backup-util.sh v0.1.11 initial_backup
38
38
# Curl the utility
39
39
# Install AWS
40
40
# DB to S3 table dump (backups)
@@ -44,7 +44,7 @@ Database backups occur in the following ways:
44
44
45
45
2. A deploy backup, where the `db_to_db` function is not called. This is a standard backup strategy before the application deploys, to ensure the s3 contents of the primary s3 are sync'd to the backups bucket, and a table dump is stored in the backups bucket.
46
46
```bash
47
-
./fac-backup-util.sh v0.1.10 deploy_backup
47
+
./fac-backup-util.sh v0.1.11 deploy_backup
48
48
# Curl the utility
49
49
# Install AWS
50
50
# DB to S3 table dump (backups)
@@ -53,7 +53,7 @@ Database backups occur in the following ways:
53
53
54
54
3. A scheduled backup is run every two hours, across each environment, ensuring that we have a clean backup in s3, rds, and the bucket contents are in sync.
55
55
```bash
56
-
./fac-backup-util.sh v0.1.10 scheduled_backup
56
+
./fac-backup-util.sh v0.1.11 scheduled_backup
57
57
# Curl the utility
58
58
# Install AWS
59
59
# DB to S3 table dump (fac-db -> backups)
@@ -66,7 +66,7 @@ Restoring from backups can be run via workflow, from designated individuals. The
66
66
67
67
1. S3 Restore takes a `operation-mm-DD-HH` input (ex `scheduled-06-04-10`), and is required for the backups to be restored. The utility looks in `s3://${bucket}/backups/operation-mm-DD-HH/` for its table dumps, and without supplying the target backups, it will not restore. Once it does a `--data-only` restoration, it will then sync the files from the backups bucket to the application bucket. We do this to ensure the contents of the application bucket are up to date, relative to the data in the database. We know that if we use the latest folder in `/backups/` then the contents of the s3 are the latest available, from the prior backup.
The purpose of this document is to highlight examples for when a developer wishes to delete stale backups from the s3 bucket `backups`.
4
+
5
+
**Warning:** This command is classified as a destructive command, and should only be run after receiving confirmation from members of the team, and after putting a formal annoucement in the developer slack channel. It is advised that after this command is run, to take a formal backup of the environment just for extra precautions.
6
+
7
+
#### Information:
8
+
The management command is located here: [delete_stale_backups.py](../backend/support/management/commands/delete_stale_backups.py). This command accepts two inputs. `--days` & `--delete`.
9
+
- The value of `--days` must be greater than or equal to `14` (`--days 14`)
10
+
- The value of `--delete` is required to actually perform the delete, and is a boolean (`--delete true`)
11
+
- The full command to perform a delete will look like this:
6. Navigate to [The backup environment action](https://github.com/GSA-TTS/FAC/actions/workflows/fac-backup-util.yml) and perform a backup with the following inputs or alternatively, navigate to [the scheduled backup action](https://github.com/GSA-TTS/FAC/actions/workflows/fac-backup-scheduler.yml) and run.
22
+
```sh
23
+
branch: main
24
+
environment: <env where backups were just deleted (dev/staging/prod)>
0 commit comments