-
Notifications
You must be signed in to change notification settings - Fork 34
Add datasets and models to the upgrade script #288
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
base: release-1.4.0
Are you sure you want to change the base?
Changes from all commits
61d0be8
6503095
d513b00
096e377
b620f91
8fad87b
aa2d875
98e957d
e7cb986
d49e6e4
b510818
15d8d7f
0e532c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -333,8 +333,54 @@ run_migration() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy_models_to_volume() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local temp_container="init_models" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| local models_src="model_installer/models" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log_message "Initializing models volume..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker volume rm scenescape_vol-models 2>/dev/null || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker volume create scenescape_vol-models | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker run --name ${temp_container} \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -d \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -v ${PWD}/${models_src}:/source/models \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -v scenescape_vol-models:/dest/models \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alpine:latest sleep 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| log_message "Copying models to volume..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker exec ${temp_container} /bin/sh -c "cp -r /source/models/* /dest/models/" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker exec ${temp_container} /bin/sh -c "cp -r /source/models/* /dest/models/" | |
| docker exec ${temp_container} /bin/sh -c "cp -r /source/models/. /dest/models/" |
Copilot
AI
Aug 8, 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.
Similar to the models volume, the datasets volume is removed without verification. This could lead to data loss if the volume contains user data that should be preserved during upgrade.
| log_message "Initializing datasets volume..." | |
| local backup_dir="backup_datasets_$(date +%Y%m%d_%H%M%S)" | |
| log_message "Checking for existing data in scenescape_vol-datasets volume..." | |
| # Use a temporary container to check if the volume is non-empty | |
| docker run --rm \ | |
| -v scenescape_vol-datasets:/data \ | |
| alpine:latest /bin/sh -c "ls -A /data" > /tmp/datasets_volume_contents.txt 2>/dev/null || true | |
| if [ -s /tmp/datasets_volume_contents.txt ]; then | |
| echo "WARNING: Existing data found in scenescape_vol-datasets volume:" | |
| cat /tmp/datasets_volume_contents.txt | |
| echo "Do you want to back up the existing datasets before removal? [y/N]" | |
| read -r backup_choice | |
| if [ "$backup_choice" = "y" ] || [ "$backup_choice" = "Y" ]; then | |
| mkdir -p "$backup_dir" | |
| docker run --rm \ | |
| -v scenescape_vol-datasets:/data \ | |
| -v ${PWD}/$backup_dir:/backup \ | |
| alpine:latest /bin/sh -c "cp -r /data/* /backup/" | |
| echo "Backup completed: $backup_dir" | |
| fi | |
| echo "Do you want to delete the existing datasets volume? This will permanently remove all data. [y/N]" | |
| read -r delete_choice | |
| if [ ! "$delete_choice" = "y" ] && [ ! "$delete_choice" = "Y" ]; then | |
| echo "Aborting datasets volume removal." | |
| return 1 | |
| fi | |
| fi | |
| rm -f /tmp/datasets_volume_contents.txt | |
| log_message "Removing and re-creating datasets volume..." |
Copilot
AI
Aug 8, 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.
Same issue as with the models container - potential naming conflicts if a container with the same name already exists from a previous failed run.
| # Remove any existing container with the same name to avoid naming conflicts | |
| docker rm -f ${temp_container} 2>/dev/null || true |
Copilot
AI
Aug 8, 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.
Same issue as with the models copy - the command will fail if /source/datasets/ is empty. The shell glob /* expansion requires at least one file to match.
| docker exec ${temp_container} /bin/sh -c "cp -r /source/datasets/* /dest/datasets/" | |
| docker exec ${temp_container} /bin/sh -c "if [ \"\$(ls -A /source/datasets)\" ]; then cp -r /source/datasets/* /dest/datasets/; else echo 'No datasets to copy.'; fi" |
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.
The script forcibly removes existing volumes without checking if they contain important data. Consider adding a backup or confirmation step before removing volumes to prevent accidental data loss.