Edit & Download (local) Backups (#436)

* Allow editing of backups

* pint updates

* setup of backup download

* allow download for local backup files

* delete uploaded files on delete of BackupFile

* pint updates

* S3 upload & download fixes

* Deletion of backup files

* support $ARCH selector for s3 installation

* delete files when deleting backup

* fixed ui issue

* adjustment

* Use system temp path for downloads

---------

Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
Richard Anderson
2025-01-25 20:59:35 +00:00
committed by GitHub
parent 465951fd1e
commit a73476c1dd
31 changed files with 382 additions and 184 deletions

View File

@ -23,7 +23,7 @@ public function upload(string $src, string $dest): array
$uploadCommand = $this->getScript('s3/upload.sh', [
'src' => $src,
'bucket' => $this->storageProvider->credentials['bucket'],
'dest' => $this->prepareS3Path($this->storageProvider->credentials['path'].'/'.$dest),
'dest' => $this->prepareS3Path($dest),
'key' => $this->storageProvider->credentials['key'],
'secret' => $this->storageProvider->credentials['secret'],
'region' => $this->storageProvider->credentials['region'],
@ -52,7 +52,7 @@ public function download(string $src, string $dest): void
$provider = $this->storageProvider->provider();
$downloadCommand = $this->getScript('s3/download.sh', [
'src' => $this->prepareS3Path($this->storageProvider->credentials['path'].'/'.$src),
'src' => $this->prepareS3Path($src),
'dest' => $dest,
'bucket' => $this->storageProvider->credentials['bucket'],
'key' => $this->storageProvider->credentials['key'],
@ -71,8 +71,21 @@ public function download(string $src, string $dest): void
}
}
/**
* @TODO Implement delete method
*/
public function delete(string $path): void {}
public function delete(string $src): void
{
/** @var \App\StorageProviders\S3 $provider */
$provider = $this->storageProvider->provider();
$this->server->ssh()->exec(
$this->getScript('s3/delete-file.sh', [
'src' => $this->prepareS3Path($src),
'bucket' => $this->storageProvider->credentials['bucket'],
'key' => $this->storageProvider->credentials['key'],
'secret' => $this->storageProvider->credentials['secret'],
'region' => $this->storageProvider->credentials['region'],
'endpoint' => $provider->getApiUrl(),
]),
'delete-from-s3'
);
}
}