sentinel updates
This commit is contained in:
@@ -12,7 +12,7 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('server_settings', function (Blueprint $table) {
|
||||
$table->boolean('is_force_cleanup_enabled')->default(false)->after('is_sentinel_enabled');
|
||||
$table->boolean('is_force_cleanup_enabled')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,16 @@ return new class extends Migration
|
||||
$table->dropColumn('metrics_token');
|
||||
$table->dropColumn('metrics_refresh_rate_seconds');
|
||||
$table->dropColumn('metrics_history_days');
|
||||
$table->dropColumn('is_server_api_enabled');
|
||||
|
||||
$table->boolean('is_sentinel_enabled')->default(true);
|
||||
$table->text('sentinel_token')->nullable();
|
||||
$table->integer('sentinel_metrics_refresh_rate_seconds')->default(5);
|
||||
$table->integer('sentinel_metrics_history_days')->default(30);
|
||||
$table->integer('sentinel_metrics_refresh_rate_seconds')->default(10);
|
||||
$table->integer('sentinel_metrics_history_days')->default(7);
|
||||
$table->integer('sentinel_push_interval_seconds')->default(60);
|
||||
});
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dateTime('sentinel_update_at')->default(now());
|
||||
$table->dateTime('sentinel_updated_at')->default(now());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,12 +37,16 @@ return new class extends Migration
|
||||
$table->string('metrics_token')->nullable();
|
||||
$table->integer('metrics_refresh_rate_seconds')->default(5);
|
||||
$table->integer('metrics_history_days')->default(30);
|
||||
$table->boolean('is_server_api_enabled')->default(false);
|
||||
|
||||
$table->dropColumn('sentinel_token');
|
||||
$table->dropColumn('sentinel_metrics_refresh_rate_seconds');
|
||||
$table->dropColumn('sentinel_metrics_history_days');
|
||||
$table->dropColumn('sentinel_push_interval_seconds');
|
||||
$table->dropColumn('is_sentinel_enabled');
|
||||
});
|
||||
Schema::table('servers', function (Blueprint $table) {
|
||||
$table->dropColumn('sentinel_update_at');
|
||||
$table->dropColumn('sentinel_updated_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,6 +26,7 @@ class DatabaseSeeder extends Seeder
|
||||
S3StorageSeeder::class,
|
||||
StandalonePostgresqlSeeder::class,
|
||||
OauthSettingSeeder::class,
|
||||
GenerateSentinelTokenSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
25
database/seeders/GenerateSentinelTokenSeeder.php
Normal file
25
database/seeders/GenerateSentinelTokenSeeder.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class GenerateSentinelTokenSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
try {
|
||||
Server::chunk(100, function ($servers) {
|
||||
foreach ($servers as $server) {
|
||||
if (str($server->settings->sentinel_token)->isEmpty()) {
|
||||
$server->generateSentinelToken();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (\Throwable $e) {
|
||||
echo "Error: {$e->getMessage()}\n";
|
||||
ray($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,6 +186,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
|
||||
|
||||
$this->call(OauthSettingSeeder::class);
|
||||
$this->call(PopulateSshKeysDirectorySeeder::class);
|
||||
$this->call(GenerateSentinelTokenSeeder::class);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user