-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add media backup * Update prod deploy docs * ad dbbackups.md * Move unbind-service We have a race condition where if the service is unbound too quickly, the backups fail * Add environment input to backup script * Change filename to match default --------- Co-authored-by: Tadhg O'Higgins <2626258+tadhg-ohiggins@users.noreply.github.com>
- Loading branch information
1 parent
afa3712
commit 8974656
Showing
4 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/bash | ||
|
||
echo "Environment set as: $1" | ||
export PATH=/home/vcap/deps/0/apt/usr/lib/postgresql/15/bin:$PATH | ||
date=$(date '+%Y-%m-%d-%H%M') | ||
python manage.py dbbackup -o "prod-db-backup-$date.dump" | ||
python manage.py dbbackup -o "$1-db-backup-$date.psql.bin" | ||
python manage.py mediabackup -o "$1-media-backup-$date.tar" |
This file contains 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,27 @@ | ||
# Database Backups | ||
|
||
Information regarding the django utility can be found [on the documentation page](https://django-dbbackup.readthedocs.io/en/master/commands.html) | ||
Database backups occur in the following ways: | ||
1. Django backups | ||
```bash | ||
python manage.py dbbbackup | ||
python manage.py mediabackup | ||
``` | ||
2. Django restores | ||
```bash | ||
python manage.py dbrestore | ||
python manage.py mediarestore | ||
``` | ||
3. Backups in the prod environment occur every deployment, [before the most recent code is applied](https://github.com/GSA-TTS/FAC/blob/fd3a59287d58aec06a78d6da3b42a5def8fc9c98/.github/workflows/deploy-application.yml#L72-L100) | ||
4. Manual steps are listed in the following document for where to catalog backups | ||
* [Deploying](./deploying.md) | ||
* Login via CF and tail the logs during a deployment (before it gets to deploy application stage) | ||
* Post the most recent dbbackup and mediabackup file names in https://github.com/GSA-TTS/FAC/issues/2221 | ||
```bash | ||
cf login -a api.fr.cloud.gov --sso | ||
Select an org: | ||
1. gsa-tts-oros-fac | ||
Select a space: | ||
5. production | ||
cf logs gsa-fac | ||
``` |
This file contains 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