From c803768e5f406124b7fa5ede1998161cd7b2a026 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 11 Dec 2023 20:55:58 +0100 Subject: [PATCH] set autoupdate --- app/Console/Commands/Init.php | 8 +++++++- database/seeders/ProductionSeeder.php | 7 +------ scripts/install.sh | 9 --------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php index 69e1100f4..d864c9c48 100644 --- a/app/Console/Commands/Init.php +++ b/app/Console/Commands/Init.php @@ -18,7 +18,6 @@ use App\Models\StandalonePostgresql; use App\Models\StandaloneRedis; use Illuminate\Console\Command; use Illuminate\Support\Facades\Http; -use Illuminate\Support\Facades\Storage; class Init extends Command { @@ -37,6 +36,13 @@ class Init extends Command $this->cleanup_in_progress_application_deployments(); $this->cleanup_stucked_helper_containers(); setup_dynamic_configuration(); + + $settings = InstanceSettings::get(); + if (env('AUTOUPDATE') == true) { + $settings->update(['is_auto_update_enabled' => true]); + } else { + $settings->update(['is_auto_update_enabled' => false]); + } } private function cleanup_stucked_helper_containers() { diff --git a/database/seeders/ProductionSeeder.php b/database/seeders/ProductionSeeder.php index 04d699287..aaf07bb7a 100644 --- a/database/seeders/ProductionSeeder.php +++ b/database/seeders/ProductionSeeder.php @@ -122,14 +122,9 @@ class ProductionSeeder extends Seeder ]); } } - $settings = InstanceSettings::get(); - if (env('AUTOUPDATE')) { - $settings->update(['is_auto_update_enabled' => true]); - } else { - $settings->update(['is_auto_update_enabled' => false]); - } try { + $settings = InstanceSettings::get(); if (is_null($settings->public_ipv4)) { $ipv4 = Process::run('curl -4s https://ifconfig.io')->output(); if ($ipv4) { diff --git a/scripts/install.sh b/scripts/install.sh index e935d65df..b7afeaefb 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -130,13 +130,6 @@ curl -fsSL $CDN/docker-compose.prod.yml -o /data/coolify/source/docker-compose.p curl -fsSL $CDN/.env.production -o /data/coolify/source/.env.production curl -fsSL $CDN/upgrade.sh -o /data/coolify/source/upgrade.sh -# Check if AUTOUPDATE env variable is set, if set use it, if not set to true -if [ -z "$AUTOUPDATE" ]; then - AUTOUPDATE=true -else - AUTOUPDATE=false -fi - # Copy .env.example if .env does not exist if [ ! -f /data/coolify/source/.env ]; then cp /data/coolify/source/.env.production /data/coolify/source/.env @@ -149,8 +142,6 @@ if [ ! -f /data/coolify/source/.env ]; then sed -i "s|PUSHER_APP_SECRET=.*|PUSHER_APP_SECRET=$(openssl rand -hex 32)|g" /data/coolify/source/.env fi -sed -i "s|AUTOUPDATE=.*|AUTOUPDATE=$AUTOUPDATE|g" /data/coolify/source/.env - # Merge .env and .env.production. New values will be added to .env sort -u -t '=' -k 1,1 /data/coolify/source/.env /data/coolify/source/.env.production | sed '/^$/d' >/data/coolify/source/.env.temp && mv /data/coolify/source/.env.temp /data/coolify/source/.env