-
Notifications
You must be signed in to change notification settings - Fork 3
refactor(docker-monolithic): refactor backup script to use docker cp #282
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the Docker monolithic backup script to use docker cp for copying files directly from the container to the host, eliminating the intermediate step of copying files to a temporary directory within the container first.
Key Changes:
- Replaced container-based file operations (
docker compose exec ... cp) withdocker cpcommands that copy directly to the host - Changed
TEMP_BACKUP_DIR(container path/tmp/tmp-backups/${TIMESTAMP}) toTMP_DIR(host path${ABS_BACKUP_PATH}/tmp-${TIMESTAMP}) - Simplified cleanup by only needing to remove the host temporary directory instead of both host and container cleanup
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Cleanup. | ||
| docker compose exec -u root supportpal bash -c "rm -rf ${TEMP_BACKUP_DIR}/" | ||
| # Cleanup (now only needs to clean the host TMP_DIR, container cleanup is minimal) |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment mentions "container cleanup is minimal" but there's no longer any container cleanup happening in this refactored version. The database backup file is explicitly deleted from the container on line 86, which is the only cleanup. Consider updating the comment to be more accurate, e.g., "Cleanup temporary directory from host" or "Cleanup (database backup already removed from container on line 86)".
| # Cleanup (now only needs to clean the host TMP_DIR, container cleanup is minimal) | |
| # Cleanup temporary directory from host (database backup already removed from container on line 86) |
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
* Initial plan * fix: remove trailing slashes from docker cp source paths Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
* Initial plan * Add error checking to docker cp operations in backup script Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
Rather than copying to tmp directory within the container, we can simplify the process and just copy directly to the host.