An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(backups): pin S3 endpoint DNS for mc cp uploads
Andras Bacsai065d4825d35e
diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.phpindex 92d24bab3d..99e691af86 100644--- a/app/Jobs/DatabaseBackupJob.php+++ b/app/Jobs/DatabaseBackupJob.php@@ -889,7 +889,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue$resolveOptions = $resolveOptions === '' ? '' : ' '.$resolveOptions;$commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc alias set{$resolveOptions} temporary {$escapedEndpoint} {$escapedKey} {$escapedSecret}";- $commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc cp {$escapedBackupLocation} {$escapedS3Destination}";+ $commands[] = "docker exec backup-of-{$this->backup_log_uuid} mc cp{$resolveOptions} {$escapedBackupLocation} {$escapedS3Destination}";instant_remote_process($commands, $this->server, true, false, $this->commandTimeout(), disableMultiplexing: true);$this->s3_uploaded = true;diff --git a/app/Jobs/VolumeBackupJob.php b/app/Jobs/VolumeBackupJob.phpindex d635894b09..7b1406233c 100644--- a/app/Jobs/VolumeBackupJob.php+++ b/app/Jobs/VolumeBackupJob.php@@ -372,7 +372,7 @@ class VolumeBackupJob implements ShouldBeEncrypted, ShouldQueue.escapeshellarg($backupLocation.':'.$backupLocation.':ro').' '.escapeshellarg($image),'docker exec '.escapeshellarg($containerName).' mc alias set'.$resolveOptions.' temporary '.escapeshellarg($s3->endpoint).' '.escapeshellarg($s3->key).' '.escapeshellarg($s3->secret),- 'docker exec '.escapeshellarg($containerName).' mc cp '.escapeshellarg($backupLocation).' '+ 'docker exec '.escapeshellarg($containerName).' mc cp'.$resolveOptions.' '.escapeshellarg($backupLocation).' '.escapeshellarg('temporary/'.$s3->bucket.$backupDirectory.'/'),], $server, timeout: $this->timeout, disableMultiplexing: true);} finally {diff --git a/tests/Feature/Jobs/DatabaseBackupJobTest.php b/tests/Feature/Jobs/DatabaseBackupJobTest.phpindex a19958608f..a699a60eee 100644--- a/tests/Feature/Jobs/DatabaseBackupJobTest.php+++ b/tests/Feature/Jobs/DatabaseBackupJobTest.php@@ -330,7 +330,7 @@ test('database backup job escapes the S3 copy destination argument', function ()$source = file_get_contents(app_path('Jobs/DatabaseBackupJob.php'));expect($source)->toContain('$escapedS3Destination = escapeshellarg("temporary/{$bucket}{$this->backup_dir}/");')- ->and($source)->toContain('mc cp {$escapedBackupLocation} {$escapedS3Destination}')+ ->and($source)->toContain('mc cp{$resolveOptions} {$escapedBackupLocation} {$escapedS3Destination}')->and($source)->not->toContain('mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/');});diff --git a/tests/Feature/VolumeBackupTest.php b/tests/Feature/VolumeBackupTest.phpindex d247a7a4e6..c254cea724 100644--- a/tests/Feature/VolumeBackupTest.php+++ b/tests/Feature/VolumeBackupTest.php@@ -2122,7 +2122,7 @@ it('keeps local-first archive creation and mc copy when retaining a local volumeProcess::assertRan(fn ($process) => str_contains($process->command, 'tar -I')&& str_contains($process->command, '>')&& ! str_contains($process->command, 'mc pipe'));- Process::assertRan(fn ($process) => str_contains($process->command, 'mc cp')+ Process::assertRan(fn ($process) => str_contains($process->command, 'mc cp --resolve ')&& ! str_contains($process->command, 'mc pipe'));});