diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e29ac07..8f3493f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added - Manual email verification requests. ([bc659387](https://github.com/pixelfed/pixelfed/commit/bc659387)) - Added StatusMentionService, fixes #3026. ([e5387d67](https://github.com/pixelfed/pixelfed/commit/e5387d67)) +- Cloud Backups, a command to store backups on S3 or compatible filesystems. [#3037](https://github.com/pixelfed/pixelfed/pull/3037) ([3515a98e](https://github.com/pixelfed/pixelfed/commit/3515a98e)) ### Updated - Updated NotificationService, fix 500 bug. ([4a609dc3](https://github.com/pixelfed/pixelfed/commit/4a609dc3)) diff --git a/app/Console/Commands/BackupToCloud.php b/app/Console/Commands/BackupToCloud.php new file mode 100644 index 000000000..815e23ac3 --- /dev/null +++ b/app/Console/Commands/BackupToCloud.php @@ -0,0 +1,76 @@ +error('Backup disk not configured.'); + $this->error('See https://docs.pixelfed.org/technical-documentation/env.html#filesystem for more information.'); + return Command::FAILURE; + } + + $newest = $backupDestination->newestBackup(); + $name = $newest->path(); + $parts = explode('/', $name); + $fileName = array_pop($parts); + $storagePath = 'backups'; + $path = storage_path('app/'. $name); + $file = $cloudDisk->putFileAs($storagePath, new File($path), $fileName, 'private'); + $this->info("Backup file successfully saved!"); + $url = $cloudDisk->url($file); + $this->table( + ['Name', 'URL'], + [ + [$fileName, $url] + ], + ); + return Command::SUCCESS; + } +} diff --git a/config/filesystems.php b/config/filesystems.php index 0df7cf308..a43e5b470 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -82,7 +82,7 @@ return [ ], 'backup' => [ - 'driver' => env('PF_BACKUP_DRIVER', 'local'), + 'driver' => env('PF_BACKUP_DRIVER', 's3'), 'visibility' => 'private', 'root' => env('PF_BACKUP_DRIVER', 'local') == 'local' ? storage_path('app/backups/') :