update scripts

This commit is contained in:
Andras Bacsai 2023-05-03 09:57:06 +02:00
parent 97572f158c
commit 8bfdcdbf44
3 changed files with 12 additions and 9 deletions

View File

@ -37,6 +37,7 @@ class SyncBunny extends Command
$compose_file = "docker-compose.yml"; $compose_file = "docker-compose.yml";
$compose_file_prod = "docker-compose.prod.yml"; $compose_file_prod = "docker-compose.prod.yml";
$upgrade_script = "upgrade.sh"; $upgrade_script = "upgrade.sh";
$docker_install_script = "install-docker.sh";
$production_env = ".env.production"; $production_env = ".env.production";
PendingRequest::macro('storage', function ($file) { PendingRequest::macro('storage', function ($file) {
@ -53,8 +54,9 @@ class SyncBunny extends Command
Http::pool(fn (Pool $pool) => [ 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")->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/$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/$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([ $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",
"url" => "$bunny_cdn/$bunny_cdn_path/$compose_file_prod", "url" => "$bunny_cdn/$bunny_cdn_path/$compose_file_prod",
"url" => "$bunny_cdn/$bunny_cdn_path/$upgrade_script", "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()) { if ($res->ok()) {
echo "All files uploaded & purged...\n"; echo "All files uploaded & purged...\n";
return;
} }
throw new \Exception("Something went wrong.");
} catch (\Exception $e) { } catch (\Exception $e) {
echo "Something went wrong.\n";
echo $e->getMessage(); echo $e->getMessage();
} }
} }

View File

@ -2,10 +2,12 @@
## Do not modify this file. You will lost the ability to installation and autoupdate! ## 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" VERSION="1.0.0"
DOCKER_VERSION="23.0"
CDN="https://coolify-cdn.b-cdn.net/files" CDN="https://coolify-cdn.b-cdn.net/files"
OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"') 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 '"') 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 if ! [ -x "$(command -v docker)" ]; then
echo "Docker is not installed. Installing Docker..." echo "Docker is not installed. Installing Docker..."
curl -fsSL https://get.docker.com -o get-docker.sh curl https://releases.rancher.com/install-docker/${DOCKER_VERSION}.sh | sh
sh get-docker.sh
rm get-docker.sh
echo "Docker installed successfully" echo "Docker installed successfully"
fi fi

View File

@ -21,8 +21,7 @@ function help {
compgen -A function | cat -n compgen -A function | cat -n
} }
function sync-bunny { 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 { function queue {
bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen