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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix: sync command
Andras Bacsaidf4ecd47a774
diff --git a/app/Console/Commands/SyncBunny.php b/app/Console/Commands/SyncBunny.phpindex 1be47ba8ac..85c29d2435 100644--- a/app/Console/Commands/SyncBunny.php+++ b/app/Console/Commands/SyncBunny.php@@ -30,6 +30,7 @@ class SyncBunny extends Command*/public function handle(){+ $that = $this;$only_template = $this->option('only-template');$bunny_cdn = "https://cdn.coollabs.io";$bunny_cdn_path = "coolify";@@ -46,22 +47,23 @@ class SyncBunny extends Command$versions = "versions.json";- PendingRequest::macro('storage', function ($file) {+ PendingRequest::macro('storage', function ($fileName) use($that) {$headers = ['AccessKey' => env('BUNNY_STORAGE_API_KEY'),'Accept' => 'application/json','Content-Type' => 'application/octet-stream'];- $fileStream = fopen($file, "r");- $file = fread($fileStream, filesize($file));+ $fileStream = fopen($fileName, "r");+ $file = fread($fileStream, filesize($fileName));+ $that->info('Uploading: ' . $fileName);return PendingRequest::baseUrl('https://storage.bunnycdn.com')->withHeaders($headers)->withBody($file)->throw();});- PendingRequest::macro('purge', function ($url) {+ PendingRequest::macro('purge', function ($url) use ($that) {$headers = ['AccessKey' => env('BUNNY_API_KEY'),'Accept' => 'application/json',];- ray('Purging: ' . $url);+ $that->info('Purging: ' . $url);return PendingRequest::withHeaders($headers)->get('https://api.bunny.net/purge', ["url" => $url,"async" => false@@ -82,14 +84,13 @@ class SyncBunny extends Command}Http::pool(fn (Pool $pool) => [- $pool->storage(file: "$parent_dir/$compose_file")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file"),- $pool->storage(file: "$parent_dir/$compose_file_prod")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file_prod"),- $pool->storage(file: "$parent_dir/$production_env")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$production_env"),- $pool->storage(file: "$parent_dir/scripts/$upgrade_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$upgrade_script"),- $pool->storage(file: "$parent_dir/scripts/$install_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$install_script"),- $pool->storage(file: "$parent_dir/$versions")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$versions"),+ $pool->storage(fileName: "$parent_dir/$compose_file")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file"),+ $pool->storage(fileName: "$parent_dir/$compose_file_prod")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$compose_file_prod"),+ $pool->storage(fileName: "$parent_dir/$production_env")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$production_env"),+ $pool->storage(fileName: "$parent_dir/scripts/$upgrade_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$upgrade_script"),+ $pool->storage(fileName: "$parent_dir/scripts/$install_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$install_script"),+ $pool->storage(fileName: "$parent_dir/$versions")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$versions"),]);- $this->info("{$bunny_cdn}/{$bunny_cdn_path}");Http::pool(fn (Pool $pool) => [$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file"),$pool->purge("$bunny_cdn/$bunny_cdn_path/$compose_file_prod"),