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.

Add dynamic timeout for deployments

Andras Bacsai6acc0e602586
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index fa828acbe3..1b14e7e12f 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -123,6 +123,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->source = $source->getMorphClass()::where('id', $this->application->source->id)->first();
}
$this->server = Server::find($this->application_deployment_queue->server_id);
+ $this->timeout = $this->server->settings->dynamic_timeout;
$this->destination = $this->server->destinations()->where('id', $this->application_deployment_queue->destination_id)->first();
$this->server = $this->mainServer = $this->destination->server;
$this->serverUser = $this->server->user;
@@ -535,7 +536,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
}
private function push_to_docker_registry()
{
- $forceFail = false;
+ $forceFail = true;
if (str($this->application->docker_registry_image_name)->isEmpty()) {
ray('empty docker_registry_image_name');
return;
diff --git a/app/Livewire/Server/Form.php b/app/Livewire/Server/Form.php
index 936f8e7241..bb9c7c3a10 100644
--- a/app/Livewire/Server/Form.php
+++ b/app/Livewire/Server/Form.php
@@ -28,6 +28,7 @@ class Form extends Component
'server.settings.is_swarm_worker' => 'required|boolean',
'server.settings.is_build_server' => 'required|boolean',
'server.settings.concurrent_builds' => 'required|integer|min:1',
+ 'server.settings.dynamic_timeout' => 'required|integer|min:1',
'wildcard_domain' => 'nullable|url',
];
protected $validationAttributes = [
@@ -42,6 +43,8 @@ class Form extends Component
'server.settings.is_swarm_worker' => 'Swarm Worker',
'server.settings.is_build_server' => 'Build Server',
'server.settings.concurrent_builds' => 'Concurrent Builds',
+ 'server.settings.dynamic_timeout' => 'Dynamic Timeout',
+
];
public function mount()
diff --git a/config/queue.php b/config/queue.php
index 2ef618584b..a46085a9f9 100644
--- a/config/queue.php
+++ b/config/queue.php
@@ -65,7 +65,7 @@ return [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
- 'retry_after' => 3600,
+ 'retry_after' => 86400,
'block_for' => null,
'after_commit' => true,
],
diff --git a/database/migrations/2024_02_08_112304_add_dynamic_timeout_for_deployments.php b/database/migrations/2024_02_08_112304_add_dynamic_timeout_for_deployments.php
new file mode 100644
index 0000000000..f45bd7a2a4
--- /dev/null
+++ b/database/migrations/2024_02_08_112304_add_dynamic_timeout_for_deployments.php
@@ -0,0 +1,28 @@
+<?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
+ {
+ Schema::table('server_settings', function (Blueprint $table) {
+ $table->integer('dynamic_timeout')->default(3600);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('server_settings', function (Blueprint $table) {
+ $table->dropColumn('dynamic_timeout');
+ });
+ }
+};
diff --git a/resources/views/livewire/server/form.blade.php b/resources/views/livewire/server/form.blade.php
index 0a50321e8a..8259a997d4 100644
--- a/resources/views/livewire/server/form.blade.php
+++ b/resources/views/livewire/server/form.blade.php
@@ -42,7 +42,7 @@
<x-forms.input id="server.description" label="Description" />
@if (!$server->settings->is_swarm_worker && !$server->settings->is_build_server)
<x-forms.input placeholder="https://example.com" id="wildcard_domain" label="Wildcard Domain"
- helper="Wildcard domain for your applications. If you set this, you will get a random generated domain for your new applications.<br><span class='font-bold text-white'>Example:</span><br>In case you set:<span class='text-helper'>https://example.com</span> your applications will get:<br> <span class='text-helper'>https://randomId.example.com</span>" />
+ helper='A wildcard domain allows you to receive a randomly generated domain for your new applications. <br><br>For instance, if you set "https://example.com" as your wildcard domain, your applications will receive domains like "https://randomId.example.com".' />
@endif
</div>
@@ -61,7 +61,7 @@
label="Use it as a build server?" />
@else
<x-forms.checkbox instantSave
- helper="If you are using Cloudflare Tunnels, enable this. It will proxy all ssh requests to your server through Cloudflare.<br><span class='text-warning'>Coolify does not install/setup Cloudflare (cloudflared) on your server.</span>"
+ helper="If you are using Cloudflare Tunnels, enable this. It will proxy all SSH requests to your server through Cloudflare.<br><span class='text-warning'>Coolify does not install or set up Cloudflare (cloudflared) on your server.</span>"
id="server.settings.is_cloudflare_tunnel" label="Cloudflare Tunnel" />
@if ($server->isSwarm())
<div class="pt-6"> Swarm support is experimental. </div>
@@ -93,9 +93,11 @@
<h3 class="py-4">Settings</h3>
<div class="flex gap-2">
<x-forms.input id="cleanup_after_percentage" label="Disk cleanup threshold (%)" required
- helper="Disk cleanup job will be executed if disk usage is more than this number." />
+ helper="The disk cleanup task will run when the disk usage exceeds this threshold." />
<x-forms.input id="server.settings.concurrent_builds" label="Number of concurrent builds" required
- helper="You can define how many concurrent builds processes / deployments should run at the same time." />
+ helper="You can specify the number of simultaneous build processes/deployments that should run concurrently." />
+ <x-forms.input id="server.settings.dynamic_timeout" label="Deployment timeout (seconds)" required
+ helper="You can define the maximum duration for a deployment to run before timing it out." />
</div>
@endif
</form>