Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge remote-tracking branch 'origin/next' into jean/add-restart-loop-limit

Andras Bacsaid581abb2842b
diff --cc app/Livewire/Project/Application/Advanced.php
index 9954c34221,947368a0d6..f62f8bfddd
--- a/app/Livewire/Project/Application/Advanced.php
+++ b/app/Livewire/Project/Application/Advanced.php
@@@ -147,8 -149,11 +152,12 @@@ class Advanced extends Componen
$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;
}
+
+ // Load stop_grace_period separately since it has its own save handler
+ // Convert null to empty string to prevent dirty detection issues
+ $this->stopGracePeriod = $this->application->settings->stop_grace_period ?? '';
}
private function resetDefaultLabels()
diff --cc app/Models/Application.php
index 85a04041b5,a1d34600e5..eee67022f0
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@@ -118,16 -121,115 +121,117 @@@ class Application extends BaseMode
private static $parserVersion = '5';
- protected $guarded = [];
+ protected $fillable = [
+ 'name',
+ 'description',
+ 'fqdn',
+ 'git_repository',
+ 'git_branch',
+ 'git_commit_sha',
+ 'git_full_url',
+ 'docker_registry_image_name',
+ 'docker_registry_image_tag',
+ 'build_pack',
+ 'static_image',
+ 'install_command',
+ 'build_command',
+ 'start_command',
+ 'ports_exposes',
+ 'ports_mappings',
+ 'base_directory',
+ 'publish_directory',
+ 'health_check_enabled',
+ 'health_check_path',
+ 'health_check_port',
+ 'health_check_host',
+ 'health_check_method',
+ 'health_check_return_code',
+ 'health_check_scheme',
+ 'health_check_response_text',
+ 'health_check_interval',
+ 'health_check_timeout',
+ 'health_check_retries',
+ 'health_check_start_period',
+ 'health_check_type',
+ 'health_check_command',
+ 'limits_memory',
+ 'limits_memory_swap',
+ 'limits_memory_swappiness',
+ 'limits_memory_reservation',
+ 'limits_cpus',
+ 'limits_cpuset',
+ 'limits_cpu_shares',
+ 'status',
+ 'preview_url_template',
+ 'dockerfile',
+ 'dockerfile_location',
+ 'dockerfile_target_build',
+ 'custom_labels',
+ 'custom_docker_run_options',
+ 'post_deployment_command',
+ 'post_deployment_command_container',
+ 'pre_deployment_command',
+ 'pre_deployment_command_container',
+ 'manual_webhook_secret_github',
+ 'manual_webhook_secret_gitlab',
+ 'manual_webhook_secret_bitbucket',
+ 'manual_webhook_secret_gitea',
+ 'docker_compose_location',
+ 'docker_compose_pr_location',
+ 'docker_compose',
+ 'docker_compose_pr',
+ 'docker_compose_raw',
+ 'docker_compose_pr_raw',
+ 'docker_compose_domains',
+ 'docker_compose_custom_start_command',
+ 'docker_compose_custom_build_command',
+ 'swarm_replicas',
+ 'swarm_placement_constraints',
+ 'watch_paths',
+ 'redirect',
+ 'compose_parsing_version',
+ 'custom_nginx_configuration',
+ 'custom_network_aliases',
+ 'custom_healthcheck_found',
+ 'nixpkgsarchive',
+ 'is_http_basic_auth_enabled',
+ 'http_basic_auth_username',
+ 'http_basic_auth_password',
+ 'connect_to_docker_network',
+ 'force_domain_override',
+ 'is_container_label_escape_enabled',
+ 'use_build_server',
+ 'config_hash',
+ 'last_online_at',
+ 'restart_count',
++ 'max_restart_count',
+ 'last_restart_at',
+ 'last_restart_type',
+ 'uuid',
+ 'environment_id',
+ 'destination_id',
+ 'destination_type',
+ 'source_id',
+ 'source_type',
+ 'repository_project_id',
+ 'private_key_id',
+ ];
protected $appends = ['server_status'];
- protected $casts = [
- 'http_basic_auth_password' => 'encrypted',
- 'restart_count' => 'integer',
- 'max_restart_count' => 'integer',
- 'last_restart_at' => 'datetime',
- ];
+ protected function casts(): array
+ {
+ return [
+ 'http_basic_auth_password' => 'encrypted',
+ 'manual_webhook_secret_github' => 'encrypted',
+ 'manual_webhook_secret_gitlab' => 'encrypted',
+ 'manual_webhook_secret_bitbucket' => 'encrypted',
+ 'manual_webhook_secret_gitea' => 'encrypted',
+ 'restart_count' => 'integer',
++ 'max_restart_count' => 'integer',
+ 'last_restart_at' => 'datetime',
+ ];
+ }
protected static function booted()
{
diff --cc resources/views/livewire/project/application/advanced.blade.php
index 92020334b9,d6fcc2e4af..3bbb60a4d7
--- a/resources/views/livewire/project/application/advanced.blade.php
+++ b/resources/views/livewire/project/application/advanced.blade.php
@@@ -49,40 -86,21 +86,33 @@@
helper="Readonly labels are disabled. You need to set the labels in the labels section." disabled
instantSave id="isStripprefixEnabled" label="Strip Prefixes" canGate="update" :canResource="$application" />
@endif
- @if ($application->build_pack === 'dockercompose')
- <h3>Docker Compose</h3>
- <x-forms.checkbox instantSave id="isRawComposeDeploymentEnabled" label="Raw Compose Deployment"
- helper="WARNING: Advanced use cases only. Your docker compose file will be deployed as-is. Nothing is modified by Coolify. You need to configure the proxy parts. More info in the <a class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/compose#raw-docker-compose-deployment'>documentation.</a>"
- canGate="update" :canResource="$application" />
- @endif
- <h3 class="pt-4">Container Names</h3>
- <x-forms.checkbox
- helper="The deployed container will have the same name ({{ $application->uuid }}). <span class='font-bold dark:text-warning'>You will lose the rolling update feature!</span>"
- instantSave id="isConsistentContainerNameEnabled" label="Consistent Container Names" canGate="update"
- :canResource="$application" />
- @if ($isConsistentContainerNameEnabled === false)
- <form class="flex items-end gap-2 " wire:submit.prevent='saveCustomName'>
- <x-forms.input
- helper="You can add a custom name for your container.<br><br>The name will be converted to slug format when you save it. <span class='font-bold dark:text-warning'>You will lose the rolling update feature!</span>"
- instantSave id="customInternalName" label="Custom Container Name" canGate="update"
- :canResource="$application" />
- <x-forms.button canGate="update" :canResource="$application" type="submit">Save</x-forms.button>
- </form>
- @endif
- @if ($application->build_pack === 'dockercompose')
- <h3 class="pt-4">Network</h3>
- <x-forms.checkbox instantSave id="isConnectToDockerNetworkEnabled" label="Connect To Predefined Network"
- helper="By default, you do not reach the Coolify defined networks.<br>Starting a docker compose based resource will have an internal network. <br>If you connect to a Coolify defined network, you maybe need to use different internal DNS names to connect to a resource.<br><br>For more information, check <a class='underline dark:text-white' target='_blank' href='https://coolify.io/docs/knowledge-base/docker/compose#connect-to-predefined-networks'>this</a>."
- canGate="update" :canResource="$application" />
- @endif
- <h3 class="pt-4">Restart Limit</h3>
+ <h3 class="pt-4">Operations</h3>
+ <form class="flex items-end gap-2" wire:submit.prevent='saveStopGracePeriod'>
+ <x-forms.input
+ type="number"
+ id="stopGracePeriod"
+ label="Stop Grace Period (seconds)"
+ placeholder="{{ DEFAULT_STOP_GRACE_PERIOD_SECONDS }}"
+ helper="How long to wait for graceful shutdown during rolling updates, manual stops, and restarts. Applies to all containers for this application. Default: {{ DEFAULT_STOP_GRACE_PERIOD_SECONDS }} seconds. Range: {{ MIN_STOP_GRACE_PERIOD_SECONDS }}-{{ MAX_STOP_GRACE_PERIOD_SECONDS }} seconds (1 hour)."
+ min="{{ MIN_STOP_GRACE_PERIOD_SECONDS }}"
+ max="{{ MAX_STOP_GRACE_PERIOD_SECONDS }}"
+ canGate="update"
+ :canResource="$application"
+ />
+ <x-forms.button canGate="update" :canResource="$application" type="submit">Save</x-forms.button>
+ </form>
+ <form class="flex items-end gap-2" wire:submit.prevent='saveMaxRestartCount'>
- <x-forms.input type="number" min="0"
++ <x-forms.input
++ type="number"
++ min="0"
+ helper="Maximum number of crash restarts before Coolify automatically stops the application and sends a notification. Set to 0 to disable the limit."
- id="maxRestartCount" label="Max Restart Count" canGate="update"
- :canResource="$application" />
++ id="maxRestartCount"
++ label="Max Restart Count"
++ canGate="update"
++ :canResource="$application"
++ />
+ <x-forms.button canGate="update" :canResource="$application" type="submit">Save</x-forms.button>
+ </form>
<h3 class="pt-4">Logs</h3>
<x-forms.checkbox helper="Drain logs to your configured log drain endpoint in your Server settings."
instantSave id="isLogDrainEnabled" label="Drain Logs" canGate="update" :canResource="$application" />