mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(backups): stop mc pipe panic in S3-only volume backups
The mc release in coolify-helper 1.0.17 panics on `mc pipe --quiet`. Drop the flag and keep the progress bar out of failure messages by printing only real errors and the last progress frame. Closes #11995
This commit is contained in:
@@ -407,9 +407,13 @@ class VolumeBackupJob implements ShouldBeEncrypted, ShouldQueue
|
||||
->implode(' ');
|
||||
$resolveOptions = $resolveOptions === '' ? '' : ' '.$resolveOptions;
|
||||
$destination = 'temporary/'.$s3->bucket.$backupLocation;
|
||||
// `mc pipe --quiet` panics in recent mc releases, so keep its progress bar out of the error output instead.
|
||||
// Each progress frame starts with "\r", so printing the last field per line keeps only the final frame and real errors.
|
||||
$mcPipeLog = '/tmp/mc-pipe.log';
|
||||
$streamScript = 'set -o pipefail; mc alias set'.$resolveOptions.' temporary '
|
||||
.escapeshellarg($s3->endpoint).' '.escapeshellarg($s3->key).' '.escapeshellarg($s3->secret)
|
||||
.' >/dev/null && ('.$archiveScript.' | mc pipe --quiet'.$resolveOptions.' '.escapeshellarg($destination).' >/dev/null)'
|
||||
.' >/dev/null && ('.$archiveScript.' | mc pipe'.$resolveOptions.' '.escapeshellarg($destination).' >/dev/null 2>'.$mcPipeLog
|
||||
.' || { status=$?; awk -F '.escapeshellarg('\r').' '.escapeshellarg('{ print $NF }').' '.$mcPipeLog.' >&2; exit $status; })'
|
||||
.' && mc stat --json'.$resolveOptions.' '.escapeshellarg($destination)
|
||||
.' | sed -n '.escapeshellarg('s/.*"size":\([0-9][0-9]*\).*/\1/p');
|
||||
|
||||
|
||||
@@ -2023,8 +2023,10 @@ it('streams S3-only volume backups without creating or copying a local archive',
|
||||
$expectedFilename = 'volume-app-data-1786795200.tar.gz';
|
||||
Process::assertRan(fn ($process) => str_contains($process->command, 'tar -I')
|
||||
&& str_contains($process->command, 'mc pipe')
|
||||
&& ! str_contains($process->command, '--quiet')
|
||||
&& str_contains($process->command, '>/dev/null && (compressor=')
|
||||
&& str_contains($process->command, '>/dev/null) && mc stat')
|
||||
&& str_contains($process->command, '>/dev/null 2>/tmp/mc-pipe.log || {')
|
||||
&& str_contains($process->command, '/tmp/mc-pipe.log >&2; exit $status; }) && mc stat')
|
||||
&& str_contains($process->command, 'temporary/bucket/')
|
||||
&& str_contains($process->command, $expectedFilename)
|
||||
&& substr_count($process->command, '--resolve') === 3
|
||||
|
||||
Reference in New Issue
Block a user