mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-15 10:14:47 +00:00
fix(backups): enforce authorization and safe retention
- Gate volume backup retention and S3 controls by update permission - Preserve backup records when S3 deletion fails - Share SFTP download streaming with consistent missing-file handling - Handle schedule creation errors and link service database backups
This commit is contained in:
1 parent
99a8a96e7f
commit
72a0a57f0e
13 files changed
+433
-112
No files matched your search
@@ -10,12 +10,12 @@
|
||||
@else
|
||||
@include('livewire.project.shared.storages.volume-backups.general')
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@script
|
||||
<script>
|
||||
window.download_volume_backup_file = function(executionId) {
|
||||
window.open('/download/volume-backup/' + executionId, '_blank');
|
||||
}
|
||||
</script>
|
||||
@endscript
|
||||
@script
|
||||
<script>
|
||||
window.download_volume_backup_file = function(executionId) {
|
||||
window.open('/download/volume-backup/' + executionId, '_blank');
|
||||
}
|
||||
</script>
|
||||
@endscript
|
||||
</div>
|
||||
@@ -1,7 +1,8 @@
|
||||
<form wire:submit="save" class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center">
|
||||
<h2>Retention</h2>
|
||||
<x-forms.button type="submit" class="w-full sm:w-auto">Save</x-forms.button>
|
||||
<x-forms.button type="submit" class="w-full sm:w-auto" canGate="update"
|
||||
:canResource="$backup">Save</x-forms.button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -16,15 +17,15 @@
|
||||
<h3 class="mb-3">Local Backup Retention</h3>
|
||||
<div class="grid grid-cols-1 gap-2 md:grid-cols-3">
|
||||
<x-forms.input label="Number of backups to keep" id="retentionAmountLocally" type="number"
|
||||
min="0"
|
||||
min="0" canGate="update" :canResource="$backup"
|
||||
helper="Keeps only the specified number of most recent backups on the server. Set to 0 for unlimited backups."
|
||||
required />
|
||||
<x-forms.input label="Days to keep backups" id="retentionDaysLocally" type="number"
|
||||
min="0"
|
||||
min="0" canGate="update" :canResource="$backup"
|
||||
helper="Automatically removes backups older than the specified number of days. Set to 0 for no time limit."
|
||||
required />
|
||||
<x-forms.input label="Maximum storage (GB)" id="retentionMaxStorageLocally" type="number"
|
||||
min="0" step="any"
|
||||
min="0" step="any" canGate="update" :canResource="$backup"
|
||||
helper="When total size of all backups in the current backup job exceeds this limit in GB, the oldest backups will be removed. Decimal values are supported (e.g. 0.001 for 1MB). Set to 0 for unlimited storage."
|
||||
required />
|
||||
</div>
|
||||
@@ -34,13 +35,15 @@
|
||||
<h3 class="mb-3">S3 Storage Retention</h3>
|
||||
<div class="grid grid-cols-1 gap-2 md:grid-cols-3">
|
||||
<x-forms.input label="Number of backups to keep" id="retentionAmountS3" type="number" min="0"
|
||||
canGate="update" :canResource="$backup"
|
||||
helper="Keeps only the specified number of most recent backups on S3 storage. Set to 0 for unlimited backups."
|
||||
required />
|
||||
<x-forms.input label="Days to keep backups" id="retentionDaysS3" type="number" min="0"
|
||||
canGate="update" :canResource="$backup"
|
||||
helper="Automatically removes S3 backups older than the specified number of days. Set to 0 for no time limit."
|
||||
required />
|
||||
<x-forms.input label="Maximum storage (GB)" id="retentionMaxStorageS3" type="number" min="0"
|
||||
step="any"
|
||||
step="any" canGate="update" :canResource="$backup"
|
||||
helper="When total size of all backups in the current backup job exceeds this limit in GB, the oldest backups will be removed. Decimal values are supported (e.g. 0.5 for 500MB). Set to 0 for unlimited storage."
|
||||
required />
|
||||
</div>
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
<form wire:submit="save" class="flex flex-col gap-4">
|
||||
<div class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center">
|
||||
<h2>S3</h2>
|
||||
<x-forms.button type="submit" class="w-full sm:w-auto">Save</x-forms.button>
|
||||
<x-forms.button type="submit" class="w-full sm:w-auto" canGate="update"
|
||||
:canResource="$backup">Save</x-forms.button>
|
||||
@if (!$saveToS3)
|
||||
<x-forms.button type="button" wire:click="toggleS3" wire:loading.attr="disabled"
|
||||
wire:target="toggleS3" isHighlighted>Enable S3</x-forms.button>
|
||||
wire:target="toggleS3" isHighlighted canGate="update" :canResource="$backup">Enable S3</x-forms.button>
|
||||
@else
|
||||
<x-forms.button type="button" wire:click="toggleS3" wire:loading.attr="disabled"
|
||||
wire:target="toggleS3">Disable S3</x-forms.button>
|
||||
wire:target="toggleS3" canGate="update" :canResource="$backup">Disable S3</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -29,7 +30,8 @@
|
||||
<x-highlighted text="*" />
|
||||
@endif
|
||||
</div>
|
||||
<x-forms.select id="s3StorageId" wire:model.live="s3StorageId" :required="$saveToS3">
|
||||
<x-forms.select id="s3StorageId" wire:model.live="s3StorageId" :required="$saveToS3" canGate="update"
|
||||
:canResource="$backup">
|
||||
@foreach ($availableS3Storages as $s3Storage)
|
||||
<option value="{{ $s3Storage->id }}">{{ $s3Storage->name }}</option>
|
||||
@endforeach
|
||||
@@ -39,10 +41,12 @@
|
||||
<div class="w-full max-w-md">
|
||||
@if ($saveToS3)
|
||||
<x-forms.checkbox instantSave id="disableLocalBackup" label="Disable Local Backup"
|
||||
helper="When enabled, backup files are deleted locally after a successful S3 upload." />
|
||||
helper="When enabled, backup files are deleted locally after a successful S3 upload." canGate="update"
|
||||
:canResource="$backup" />
|
||||
@else
|
||||
<x-forms.checkbox id="disableLocalBackup" label="Disable Local Backup"
|
||||
helper="When enabled, backup files are deleted locally after a successful S3 upload." disabled />
|
||||
helper="When enabled, backup files are deleted locally after a successful S3 upload." disabled
|
||||
canGate="update" :canResource="$backup" />
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user