mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-25 17:01:49 -04:00
feat(restarts): make resource restart limits opt-in
Default restart limits to zero for applications, previews, and services, and bump the Coolify version to 4.3.21.
This commit is contained in:
@@ -82,7 +82,7 @@ class Advanced extends Component
|
||||
public bool $isConnectToDockerNetworkEnabled = false;
|
||||
|
||||
#[Validate(['integer', 'min:0'])]
|
||||
public int $maxRestartCount = 10;
|
||||
public int $maxRestartCount = 0;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
@@ -142,7 +142,7 @@ class Advanced extends Component
|
||||
$this->disableBuildCache = $this->application->settings->disable_build_cache;
|
||||
$this->injectBuildArgsToDockerfile = $this->application->settings->inject_build_args_to_dockerfile ?? true;
|
||||
$this->includeSourceCommitInBuild = $this->application->settings->include_source_commit_in_build ?? false;
|
||||
$this->maxRestartCount = $this->application->max_restart_count ?? 10;
|
||||
$this->maxRestartCount = $this->application->max_restart_count ?? 0;
|
||||
}
|
||||
|
||||
// Load stop_grace_period separately since it has its own save handler
|
||||
|
||||
@@ -84,7 +84,7 @@ class Index extends Component
|
||||
|
||||
public bool $isStripprefixEnabled = false;
|
||||
|
||||
public mixed $maxRestartCount = 10;
|
||||
public mixed $maxRestartCount = 0;
|
||||
|
||||
protected $listeners = ['generateDockerCompose', 'refreshScheduledBackups' => '$refresh', 'refreshFileStorages'];
|
||||
|
||||
@@ -432,7 +432,7 @@ class Index extends Component
|
||||
$this->isLogDrainEnabled = data_get($this->serviceApplication, 'is_log_drain_enabled', false);
|
||||
$this->isGzipEnabled = data_get($this->serviceApplication, 'is_gzip_enabled', true);
|
||||
$this->isStripprefixEnabled = data_get($this->serviceApplication, 'is_stripprefix_enabled', true);
|
||||
$this->maxRestartCount = $this->serviceApplication->max_restart_count ?? 10;
|
||||
$this->maxRestartCount = $this->serviceApplication->max_restart_count ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,10 @@ class Application extends BaseModel
|
||||
|
||||
private static $parserVersion = '5';
|
||||
|
||||
protected $attributes = [
|
||||
'max_restart_count' => 0,
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
|
||||
@@ -13,6 +13,10 @@ class ApplicationPreview extends BaseModel
|
||||
{
|
||||
use HasRestartLimit, SoftDeletes;
|
||||
|
||||
protected $attributes = [
|
||||
'max_restart_count' => 0,
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
'application_id',
|
||||
|
||||
@@ -54,6 +54,7 @@ class ServiceApplication extends BaseModel
|
||||
|
||||
protected $attributes = [
|
||||
'is_force_https_enabled' => true,
|
||||
'max_restart_count' => 0,
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
return [
|
||||
'coolify' => [
|
||||
'version' => env('COOLIFY_VERSION') ?: '4.3.20',
|
||||
'version' => env('COOLIFY_VERSION') ?: '4.3.21',
|
||||
'helper_version' => '1.0.17',
|
||||
'realtime_version' => '1.0.19',
|
||||
'railpack_version' => '0.23.0',
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
foreach (['applications', 'application_previews', 'service_applications'] as $tableName) {
|
||||
Schema::table($tableName, function (Blueprint $table) {
|
||||
$table->integer('max_restart_count')->default(0)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
foreach (['applications', 'application_previews', 'service_applications'] as $tableName) {
|
||||
Schema::table($tableName, function (Blueprint $table) {
|
||||
$table->integer('max_restart_count')->default(10)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"coolify": {
|
||||
"v4": {
|
||||
"version": "4.3.20"
|
||||
"version": "4.3.21"
|
||||
},
|
||||
"nightly": {
|
||||
"version": "4.4-rc.1"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
use App\Actions\Docker\GetContainersStatus;
|
||||
use App\Actions\Service\StopServiceApplication;
|
||||
use App\Jobs\PushServerUpdateJob;
|
||||
use App\Models\Application;
|
||||
use App\Models\ApplicationPreview;
|
||||
use App\Models\ServiceApplication;
|
||||
use App\Models\ServiceDatabase;
|
||||
@@ -209,6 +210,33 @@ it('limits restarts only for applications', function () {
|
||||
->toContain('$resetRestartCount && $serviceApplication instanceof ServiceApplication');
|
||||
});
|
||||
|
||||
it('makes restart limits opt in for new application resources', function () {
|
||||
$migrationPaths = glob(database_path('migrations/*_make_restart_limits_opt_in.php'));
|
||||
|
||||
expect($migrationPaths)->toHaveCount(1);
|
||||
|
||||
$migration = file_get_contents($migrationPaths[0]);
|
||||
|
||||
expect($migration)
|
||||
->toContain("['applications', 'application_previews', 'service_applications']")
|
||||
->toContain("integer('max_restart_count')->default(0)->change()")
|
||||
->not->toContain('->update(');
|
||||
|
||||
$applicationSettings = file_get_contents(app_path('Livewire/Project/Application/Advanced.php'));
|
||||
$serviceSettings = file_get_contents(app_path('Livewire/Project/Service/Index.php'));
|
||||
|
||||
expect($applicationSettings)
|
||||
->toContain('public int $maxRestartCount = 0;')
|
||||
->toContain('$this->application->max_restart_count ?? 0')
|
||||
->and($serviceSettings)
|
||||
->toContain('public mixed $maxRestartCount = 0;')
|
||||
->toContain('$this->serviceApplication->max_restart_count ?? 0');
|
||||
|
||||
foreach ([Application::class, ApplicationPreview::class, ServiceApplication::class] as $modelClass) {
|
||||
expect((new $modelClass)->max_restart_count)->toBe(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('does not render restart limit warnings for service databases', function () {
|
||||
$html = Blade::render(
|
||||
'<x-application.restart-limit-warning :application="$database" />',
|
||||
|
||||
@@ -23,8 +23,8 @@ it('publishes v4 branch builds under the commit sha with a traceable internal ve
|
||||
->toContain('ARG COOLIFY_VERSION')
|
||||
->toContain('ENV COOLIFY_VERSION=${COOLIFY_VERSION}')
|
||||
->and($constants)
|
||||
->toContain("'version' => env('COOLIFY_VERSION') ?: '4.3.19'")
|
||||
->and($versions['coolify']['v4']['version'])->toBe('4.3.19')
|
||||
->toContain("'version' => env('COOLIFY_VERSION') ?: '4.3.21'")
|
||||
->and($versions['coolify']['v4']['version'])->toBe('4.3.21')
|
||||
->and($versions['coolify']['nightly']['version'])->toBe('4.4-rc.1')
|
||||
->and($nightlyVersions)->toBe($versions);
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"coolify": {
|
||||
"v4": {
|
||||
"version": "4.3.20"
|
||||
"version": "4.3.21"
|
||||
},
|
||||
"nightly": {
|
||||
"version": "4.4-rc.1"
|
||||
|
||||
Reference in New Issue
Block a user