Merge pull request #2879 from pterodactyl/fix/backups-failing-early

Allow changing the prune age for backups
This commit is contained in:
Dane Everitt 2020-12-24 09:12:59 -08:00 committed by GitHub
commit 2f17e75395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 6 deletions

View file

@ -25,11 +25,13 @@ class Kernel extends ConsoleKernel
// Execute scheduled commands for servers every minute, as if there was a normal cron running. // Execute scheduled commands for servers every minute, as if there was a normal cron running.
$schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping(); $schedule->command('p:schedule:process')->everyMinute()->withoutOverlapping();
// Every 30 minutes, run the backup pruning command so that any abandoned backups can be removed // Every 30 minutes, run the backup pruning command so that any abandoned backups can be deleted.
// from the UI view for the server. $pruneAge = config('backups.prune_age', 360); // Defaults to 6 hours (time is in minuteS)
$schedule->command('p:maintenance:prune-backups', [ if ($pruneAge > 0) {
'--since-minutes' => '30', $schedule->command('p:maintenance:prune-backups', [
])->everyThirtyMinutes(); '--since-minutes' => $pruneAge,
])->everyThirtyMinutes();
}
// Every day cleanup any internal backups of service files. // Every day cleanup any internal backups of service files.
$schedule->command('p:maintenance:clean-service-backups')->daily(); $schedule->command('p:maintenance:clean-service-backups')->daily();

View file

@ -52,7 +52,7 @@ class BackupRemoteUploadController extends Controller
public function __invoke(Request $request, string $backup) public function __invoke(Request $request, string $backup)
{ {
// Get the size query parameter. // Get the size query parameter.
$size = (int)$request->query('size'); $size = (int) $request->query('size');
if (empty($size)) { if (empty($size)) {
throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.'); throw new BadRequestHttpException('A non-empty "size" query parameter must be provided.');
} }

View file

@ -12,6 +12,10 @@ return [
// uses to upload backups to S3 storage. Value is in minutes, so this would default to an hour. // uses to upload backups to S3 storage. Value is in minutes, so this would default to an hour.
'presigned_url_lifespan' => env('BACKUP_PRESIGNED_URL_LIFESPAN', 60), 'presigned_url_lifespan' => env('BACKUP_PRESIGNED_URL_LIFESPAN', 60),
// The time to wait before automatically failing a backup, time is in minutes and defaults
// to 6 hours. To disable this feature, set the value to `0`.
'prune_age' => env('BACKUP_PRUNE_AGE', 360),
'disks' => [ 'disks' => [
// There is no configuration for the local disk for Wings. That configuration // There is no configuration for the local disk for Wings. That configuration
// is determined by the Daemon configuration, and not the Panel. // is determined by the Daemon configuration, and not the Panel.