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 make command to snapshot database. #1281

Merged
merged 2 commits into from
May 26, 2022

Conversation

newswangerd
Copy link
Member

@newswangerd newswangerd commented May 25, 2022

Usage:

make docker/db_snapshot -> create a database dump and save it to db_snapshots/galaxy.backup
make docker/db_restore -> restore the database from db_snapshots/galaxy.backup

Multiple snapshots can be made by passing in NAME=

make docker/db_snapshot NAME=pre-migration -> creates db_snapshots/pre-migration.backup
make docker/db_restore NAME=pre-migration -> restores db_snapshots/pre-migration.backup

This command was originally created to help debug the permissions to roles migration, however I have found it to be useful for cleaning up after tests run as well and wanted to share it.

@netlify
Copy link

netlify bot commented May 25, 2022

Deploy Preview for galaxyng ready!

Name Link
🔨 Latest commit e6a4a10
🔍 Latest deploy log https://app.netlify.com/sites/galaxyng/deploys/628f80fba5589b00089cb362
😎 Deploy Preview https://deploy-preview-1281--galaxyng.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@awcrosby awcrosby left a comment

Choose a reason for hiding this comment

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

added possible suggestion

Makefile Outdated
@@ -130,6 +130,19 @@ docker/resetdb: ## Cleans database
./compose stop
./compose run --rm api /bin/bash -c "./entrypoint.sh manage reset_db && django-admin migrate"

.PHONY: docker/db_snapshot
NAME ?= galaxy
docker/db_snapshot: ## Snapshot database. Example: make docker/db_snapshot NAME=my_special_backup
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
docker/db_snapshot: ## Snapshot database. Example: make docker/db_snapshot NAME=my_special_backup
docker/db_snapshot: ## Snapshot database with optional NAME param. Example: make docker/db_snapshot NAME=my_special_backup

Makefile Outdated

.PHONY: docker/db_restore
NAME ?= galaxy
docker/db_restore: ## Restore database from a snapshot. Example: make docker/db_restore NAME=my_special_backup
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@newswangerd newswangerd merged commit 3dc3c18 into ansible:master May 26, 2022
drodowic pushed a commit to drodowic/galaxy_ng that referenced this pull request May 31, 2022
* Add make command to snapshot database.

No-Issue
@newswangerd newswangerd mentioned this pull request Jun 3, 2022
6 tasks
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