From 4c2ab23552f30aecb11a974fbd97dae9e8d3c77a Mon Sep 17 00:00:00 2001 From: Marc Bekhuis Date: Tue, 14 Jul 2026 16:12:47 +0200 Subject: [PATCH] Made some fixes for the restore commands related to the search containers --- commands/restore-full.cmd | 8 ++++++++ commands/restore.cmd | 25 ++++++++++++++++++++++++- version | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/commands/restore-full.cmd b/commands/restore-full.cmd index 5c833a5..a53689a 100644 --- a/commands/restore-full.cmd +++ b/commands/restore-full.cmd @@ -429,6 +429,9 @@ function detectBackupServices() { if [[ -f "$backup_path/es.tar.gz" ]]; then services+=("elasticsearch") fi + if [[ -f "$backup_path/os.tar.gz" ]]; then + services+=("opensearch") + fi fi echo "${services[@]}" @@ -547,6 +550,11 @@ function restoreVolume() { elif [[ -f "$backup_path/${service_name}.tar.gz" ]]; then # Legacy format backup_file="$backup_path/${service_name}.tar.gz" + elif [[ "$service_name" == "elasticsearch" && -f "$backup_path/es.tar.gz" ]]; then + # Legacy format uses short names for the search engines + backup_file="$backup_path/es.tar.gz" + elif [[ "$service_name" == "opensearch" && -f "$backup_path/os.tar.gz" ]]; then + backup_file="$backup_path/os.tar.gz" else logMessage WARNING "Backup file not found for service: $service_name" logVerbose "Searched in: $backup_path/volumes/ and $backup_path/" diff --git a/commands/restore.cmd b/commands/restore.cmd index 90272a2..3dfea1a 100755 --- a/commands/restore.cmd +++ b/commands/restore.cmd @@ -86,6 +86,12 @@ while [[ $# -gt 0 ]]; do error "Unknown option: $1" exit 1 ;; + all) + # Legacy alias from the old restore interface ("roll restore all"), + # still emitted by pull/pull-exp: means all services from the latest + # backup, which is already the default — must not be taken as a backup ID + shift + ;; *) # If no backup ID specified yet, use this as the backup ID if [[ -z "$RESTORE_BACKUP_ID" ]]; then @@ -380,8 +386,11 @@ function detectBackupServices() { if [[ -f "$backup_path/es.tar.gz" ]]; then services+=("elasticsearch") fi + if [[ -f "$backup_path/os.tar.gz" ]]; then + services+=("opensearch") + fi fi - + echo "${services[@]}" } @@ -472,12 +481,26 @@ function restoreVolume() { elif [[ -f "$backup_path/${service_name}.tar.gz" ]]; then # Legacy format backup_file="$backup_path/${service_name}.tar.gz" + elif [[ "$service_name" == "elasticsearch" && -f "$backup_path/es.tar.gz" ]]; then + # Legacy format uses short names for the search engines + backup_file="$backup_path/es.tar.gz" + elif [[ "$service_name" == "opensearch" && -f "$backup_path/os.tar.gz" ]]; then + backup_file="$backup_path/os.tar.gz" else logMessage WARNING "Backup file not found for service: $service_name" logVerbose "Searched in: $backup_path/volumes/ and $backup_path/" return 0 fi + # A search-index volume is only mounted when the matching engine is enabled + # in this environment's .env.roll — warn instead of silently restoring into + # a volume that no service will ever use + if [[ "$service_name" == "elasticsearch" && "${ROLL_ELASTICSEARCH:-0}" != "1" ]]; then + logMessage WARNING "Backup contains an Elasticsearch index but ROLL_ELASTICSEARCH is not enabled - the restored volume will not be mounted by 'roll env up'" + elif [[ "$service_name" == "opensearch" && "${ROLL_OPENSEARCH:-0}" != "1" ]]; then + logMessage WARNING "Backup contains an OpenSearch index but ROLL_OPENSEARCH is not enabled - the restored volume will not be mounted by 'roll env up'" + fi + logVerbose "Found backup file: $backup_file" logVerbose "Encrypted: $is_encrypted" diff --git a/version b/version index 5be6b75..cbf93a1 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.7.0.5 \ No newline at end of file +0.7.0.6 \ No newline at end of file