Skip to content

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.

fix(storage): Hetzner storage buckets not working

peaklabs-dev8b6b1b6a9da3
diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php
index 0861c6bcc8..09a187f6a7 100644
--- a/app/Jobs/DatabaseBackupJob.php
+++ b/app/Jobs/DatabaseBackupJob.php
@@ -495,12 +495,7 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
} else {
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
}
- if ($this->s3->isHetzner()) {
- $endpointWithoutBucket = 'https://'.str($endpoint)->after('https://')->after('.')->value();
- $commands[] = "docker exec backup-of-{$this->backup->uuid} mc alias set --path=off --api=S3v4 temporary {$endpointWithoutBucket} $key $secret";
- } else {
- $commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
- }
+ $commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
instant_remote_process($commands, $this->server);
diff --git a/app/Livewire/Storage/Create.php b/app/Livewire/Storage/Create.php
index c5250e1e3b..d0fdbcdf7d 100644
--- a/app/Livewire/Storage/Create.php
+++ b/app/Livewire/Storage/Create.php
@@ -49,12 +49,6 @@ class Create extends Component
$this->endpoint = 'https://'.$value;
$value = $this->endpoint;
}
-
- if (str($value)->contains('your-objectstorage.com') && ! isset($this->bucket)) {
- $this->bucket = str($value)->after('//')->before('.');
- } elseif (str($value)->contains('your-objectstorage.com')) {
- $this->bucket = $this->bucket ?: str($value)->after('//')->before('.');
- }
}
public function submit()
diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php
index f1247e6f74..4b1d745fb5 100644
--- a/app/Models/S3Storage.php
+++ b/app/Models/S3Storage.php
@@ -40,11 +40,6 @@ class S3Storage extends BaseModel
return "{$this->endpoint}/{$this->bucket}";
}
- public function isHetzner()
- {
- return str($this->endpoint)->contains('your-objectstorage.com');
- }
-
public function isDigitalOcean()
{
return str($this->endpoint)->contains('digitaloceanspaces.com');
diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php
index ee65a902fe..0e879ad3b7 100644
--- a/bootstrap/helpers/databases.php
+++ b/bootstrap/helpers/databases.php
@@ -208,7 +208,7 @@ function deleteBackupsS3(string|array|null $filenames, S3Storage $s3): void
'bucket' => $s3->bucket,
'endpoint' => $s3->endpoint,
'use_path_style_endpoint' => true,
- 'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(),
+ 'bucket_endpoint' => $s3->isDigitalOcean(),
'aws_url' => $s3->awsUrl(),
]);
diff --git a/bootstrap/helpers/s3.php b/bootstrap/helpers/s3.php
index 2ee7bf44a0..10bc66fa10 100644
--- a/bootstrap/helpers/s3.php
+++ b/bootstrap/helpers/s3.php
@@ -14,7 +14,7 @@ function set_s3_target(S3Storage $s3)
'bucket' => $s3['bucket'],
'endpoint' => $s3['endpoint'],
'use_path_style_endpoint' => true,
- 'bucket_endpoint' => $s3->isHetzner() || $s3->isDigitalOcean(),
+ 'bucket_endpoint' => $s3->isDigitalOcean(),
'aws_url' => $s3->awsUrl(),
]);
}