diff --git a/app/Console/Commands/SyncBunny.php b/app/Console/Commands/SyncBunny.php index 7757a7e6c..27d4a8b79 100644 --- a/app/Console/Commands/SyncBunny.php +++ b/app/Console/Commands/SyncBunny.php @@ -37,6 +37,7 @@ class SyncBunny extends Command $compose_file = "docker-compose.yml"; $compose_file_prod = "docker-compose.prod.yml"; $upgrade_script = "upgrade.sh"; + $docker_install_script = "install-docker.sh"; $production_env = ".env.production"; PendingRequest::macro('storage', function ($file) { @@ -53,8 +54,9 @@ 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/scripts/$upgrade_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$upgrade_script"), $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/$docker_install_script")->put("/$bunny_cdn_storage_name/$bunny_cdn_path/$docker_install_script"), ]); $res = Http::withHeaders([ @@ -64,13 +66,15 @@ class SyncBunny extends Command "url" => "$bunny_cdn/$bunny_cdn_path/$compose_file", "url" => "$bunny_cdn/$bunny_cdn_path/$compose_file_prod", "url" => "$bunny_cdn/$bunny_cdn_path/$upgrade_script", - "url" => "$bunny_cdn/$bunny_cdn_path/$production_env" + "url" => "$bunny_cdn/$bunny_cdn_path/$production_env", + "url" => "$bunny_cdn/$bunny_cdn_path/$docker_install_script" ]); if ($res->ok()) { echo "All files uploaded & purged...\n"; + return; } + throw new \Exception("Something went wrong."); } catch (\Exception $e) { - echo "Something went wrong.\n"; echo $e->getMessage(); } } diff --git a/scripts/install.sh b/scripts/install.sh index 4d512120a..8aa22b17e 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -2,10 +2,12 @@ ## Do not modify this file. You will lost the ability to installation and autoupdate! ########### -## Always run "php artisan app:sync-to-bunny-cdn --env=secrets" if you update this file. +## Always run "php artisan app:sync-to-bunny-cdn --env=secrets" or "scripts/run sync-bunny" if you update this file. ########### VERSION="1.0.0" +DOCKER_VERSION="23.0" + CDN="https://coolify-cdn.b-cdn.net/files" OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"') OS_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"') @@ -18,9 +20,7 @@ fi if ! [ -x "$(command -v docker)" ]; then echo "Docker is not installed. Installing Docker..." - curl -fsSL https://get.docker.com -o get-docker.sh - sh get-docker.sh - rm get-docker.sh + curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh echo "Docker installed successfully" fi diff --git a/scripts/run b/scripts/run index 9aad129ac..6c4cdcb5d 100755 --- a/scripts/run +++ b/scripts/run @@ -21,8 +21,7 @@ function help { compgen -A function | cat -n } function sync-bunny { - bash vendor/bin/spin exec -u webuser coolify php artisan sync:bunny --env=secret || - php artisan sync:bunny --env=secrets + php artisan sync:bunny --env=secrets } function queue { bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen