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.

format

Andras Bacsaib570ccd7d3cc
diff --git a/app/Actions/CoolifyTask/RunRemoteProcess.php b/app/Actions/CoolifyTask/RunRemoteProcess.php
index a5dfa92268..c691f52c0b 100644
--- a/app/Actions/CoolifyTask/RunRemoteProcess.php
+++ b/app/Actions/CoolifyTask/RunRemoteProcess.php
@@ -4,13 +4,13 @@ namespace App\Actions\CoolifyTask;
use App\Enums\ActivityTypes;
use App\Enums\ProcessStatus;
+use App\Helpers\SshMultiplexingHelper;
use App\Jobs\ApplicationDeploymentJob;
use App\Models\Server;
use Illuminate\Process\ProcessResult;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Process;
use Spatie\Activitylog\Models\Activity;
-use App\Helpers\SshMultiplexingHelper;
class RunRemoteProcess
{
diff --git a/app/Actions/Database/StartDragonfly.php b/app/Actions/Database/StartDragonfly.php
index 621834df0e..352c6a59f9 100644
--- a/app/Actions/Database/StartDragonfly.php
+++ b/app/Actions/Database/StartDragonfly.php
@@ -23,7 +23,7 @@ class StartDragonfly
$startCommand = "dragonfly --requirepass {$this->database->dragonfly_password}";
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -75,7 +75,7 @@ class StartDragonfly
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -118,10 +118,10 @@ class StartDragonfly
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -152,7 +152,7 @@ class StartDragonfly
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
$environment_variables->push("REDIS_PASSWORD={$this->database->dragonfly_password}");
}
diff --git a/app/Actions/Database/StartKeydb.php b/app/Actions/Database/StartKeydb.php
index 9290efc7ca..a11452a682 100644
--- a/app/Actions/Database/StartKeydb.php
+++ b/app/Actions/Database/StartKeydb.php
@@ -24,7 +24,7 @@ class StartKeydb
$startCommand = "keydb-server --requirepass {$this->database->keydb_password} --appendonly yes";
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -74,7 +74,7 @@ class StartKeydb
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -94,10 +94,10 @@ class StartKeydb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->keydb_conf) || !empty($this->database->keydb_conf)) {
+ if (! is_null($this->database->keydb_conf) || ! empty($this->database->keydb_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/keydb.conf',
+ 'source' => $this->configuration_dir.'/keydb.conf',
'target' => '/etc/keydb/keydb.conf',
'read_only' => true,
];
@@ -125,10 +125,10 @@ class StartKeydb
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -159,7 +159,7 @@ class StartKeydb
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
$environment_variables->push("REDIS_PASSWORD={$this->database->keydb_password}");
}
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php
index f37a5e3610..a5630f734a 100644
--- a/app/Actions/Database/StartMariadb.php
+++ b/app/Actions/Database/StartMariadb.php
@@ -21,7 +21,7 @@ class StartMariadb
$this->database = $database;
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -69,7 +69,7 @@ class StartMariadb
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -89,10 +89,10 @@ class StartMariadb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mariadb_conf) || !empty($this->database->mariadb_conf)) {
+ if (! is_null($this->database->mariadb_conf) || ! empty($this->database->mariadb_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/custom-config.cnf',
+ 'source' => $this->configuration_dir.'/custom-config.cnf',
'target' => '/etc/mysql/conf.d/custom-config.cnf',
'read_only' => true,
];
@@ -120,10 +120,10 @@ class StartMariadb
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -154,18 +154,18 @@ class StartMariadb
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) {
$environment_variables->push("MARIADB_ROOT_PASSWORD={$this->database->mariadb_root_password}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_DATABASE'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_DATABASE'))->isEmpty()) {
$environment_variables->push("MARIADB_DATABASE={$this->database->mariadb_database}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_USER'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_USER'))->isEmpty()) {
$environment_variables->push("MARIADB_USER={$this->database->mariadb_user}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_PASSWORD'))->isEmpty()) {
$environment_variables->push("MARIADB_PASSWORD={$this->database->mariadb_password}");
}
diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php
index 42fc8f3483..5bff194d50 100644
--- a/app/Actions/Database/StartMongodb.php
+++ b/app/Actions/Database/StartMongodb.php
@@ -23,7 +23,7 @@ class StartMongodb
$startCommand = 'mongod';
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -77,7 +77,7 @@ class StartMongodb
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -97,19 +97,19 @@ class StartMongodb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mongo_conf) || !empty($this->database->mongo_conf)) {
+ if (! is_null($this->database->mongo_conf) || ! empty($this->database->mongo_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/mongod.conf',
+ 'source' => $this->configuration_dir.'/mongod.conf',
'target' => '/etc/mongo/mongod.conf',
'read_only' => true,
];
- $docker_compose['services'][$container_name]['command'] = $startCommand . ' --config /etc/mongo/mongod.conf';
+ $docker_compose['services'][$container_name]['command'] = $startCommand.' --config /etc/mongo/mongod.conf';
}
$this->add_default_database();
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/docker-entrypoint-initdb.d',
+ 'source' => $this->configuration_dir.'/docker-entrypoint-initdb.d',
'target' => '/docker-entrypoint-initdb.d',
'read_only' => true,
];
@@ -136,10 +136,10 @@ class StartMongodb
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -170,15 +170,15 @@ class StartMongodb
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) {
$environment_variables->push("MONGO_INITDB_ROOT_USERNAME={$this->database->mongo_initdb_root_username}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) {
$environment_variables->push("MONGO_INITDB_ROOT_PASSWORD={$this->database->mongo_initdb_root_password}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) {
$environment_variables->push("MONGO_INITDB_DATABASE={$this->database->mongo_initdb_database}");
}
diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php
index 2043342fea..cc4203580c 100644
--- a/app/Actions/Database/StartMysql.php
+++ b/app/Actions/Database/StartMysql.php
@@ -21,7 +21,7 @@ class StartMysql
$this->database = $database;
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -69,7 +69,7 @@ class StartMysql
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -89,10 +89,10 @@ class StartMysql
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mysql_conf) || !empty($this->database->mysql_conf)) {
+ if (! is_null($this->database->mysql_conf) || ! empty($this->database->mysql_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/custom-config.cnf',
+ 'source' => $this->configuration_dir.'/custom-config.cnf',
'target' => '/etc/mysql/conf.d/custom-config.cnf',
'read_only' => true,
];
@@ -120,10 +120,10 @@ class StartMysql
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -154,18 +154,18 @@ class StartMysql
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MYSQL_ROOT_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_ROOT_PASSWORD'))->isEmpty()) {
$environment_variables->push("MYSQL_ROOT_PASSWORD={$this->database->mysql_root_password}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MYSQL_DATABASE'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_DATABASE'))->isEmpty()) {
$environment_variables->push("MYSQL_DATABASE={$this->database->mysql_database}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MYSQL_USER'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_USER'))->isEmpty()) {
$environment_variables->push("MYSQL_USER={$this->database->mysql_user}");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('MYSQL_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('MYSQL_PASSWORD'))->isEmpty()) {
$environment_variables->push("MYSQL_PASSWORD={$this->database->mysql_password}");
}
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index bc37fd5cf4..2a8e5476c9 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -37,7 +37,6 @@ class StartPostgresql
$this->generate_init_scripts();
$this->add_custom_conf();
-
$docker_compose = [
'services' => [
$container_name => [
diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php
index b837414d6e..eeddab924a 100644
--- a/app/Actions/Database/StartRedis.php
+++ b/app/Actions/Database/StartRedis.php
@@ -24,7 +24,7 @@ class StartRedis
$startCommand = "redis-server --requirepass {$this->database->redis_password} --appendonly yes";
$container_name = $this->database->uuid;
- $this->configuration_dir = database_configuration_dir() . '/' . $container_name;
+ $this->configuration_dir = database_configuration_dir().'/'.$container_name;
$this->commands = [
"echo 'Starting {$database->name}.'",
@@ -78,7 +78,7 @@ class StartRedis
],
],
];
- if (!is_null($this->database->limits_cpuset)) {
+ if (! is_null($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -98,10 +98,10 @@ class StartRedis
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->redis_conf) || !empty($this->database->redis_conf)) {
+ if (! is_null($this->database->redis_conf) || ! empty($this->database->redis_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
- 'source' => $this->configuration_dir . '/redis.conf',
+ 'source' => $this->configuration_dir.'/redis.conf',
'target' => '/usr/local/etc/redis/redis.conf',
'read_only' => true,
];
@@ -130,10 +130,10 @@ class StartRedis
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
- $local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
} else {
$volume_name = $persistentStorage->name;
- $local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
+ $local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
}
}
@@ -164,7 +164,7 @@ class StartRedis
$environment_variables->push("$env->key=$env->real_value");
}
- if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
+ if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
$environment_variables->push("REDIS_PASSWORD={$this->database->redis_password}");
}
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 96313d2854..df166c1cd1 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -27,9 +27,9 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Process;
use Illuminate\Support\Sleep;
use Illuminate\Support\Str;
-use Illuminate\Support\Facades\Process;
use RuntimeException;
use Symfony\Component\Yaml\Yaml;
use Throwable;
@@ -2227,7 +2227,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
);
}
} catch (\Exception $error) {
- $this->application_deployment_queue->addLogEntry("Error stopping container $containerName: " . $error->getMessage(), 'stderr');
+ $this->application_deployment_queue->addLogEntry("Error stopping container $containerName: ".$error->getMessage(), 'stderr');
}
$this->remove_container($containerName);
@@ -2250,7 +2250,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
$containers = getCurrentApplicationContainerStatus($this->server, $this->application->id, $this->pull_request_id);
if ($this->pull_request_id === 0) {
$containers = $containers->filter(function ($container) {
- return data_get($container, 'Names') !== $this->container_name && data_get($container, 'Names') !== $this->container_name . '-pr-' . $this->pull_request_id;
+ return data_get($container, 'Names') !== $this->container_name && data_get($container, 'Names') !== $this->container_name.'-pr-'.$this->pull_request_id;
});
}
$containers->each(function ($container) {
diff --git a/app/Jobs/CheckForUpdatesJob.php b/app/Jobs/CheckForUpdatesJob.php
index ddc2648391..747a9a98af 100644
--- a/app/Jobs/CheckForUpdatesJob.php
+++ b/app/Jobs/CheckForUpdatesJob.php
@@ -9,8 +9,8 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
-use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\File;
+use Illuminate\Support\Facades\Http;
class CheckForUpdatesJob implements ShouldBeEncrypted, ShouldQueue
{
diff --git a/app/Jobs/CleanupStaleMultiplexedConnections.php b/app/Jobs/CleanupStaleMultiplexedConnections.php
index acb28c2f47..6d49bee4b0 100644
--- a/app/Jobs/CleanupStaleMultiplexedConnections.php
+++ b/app/Jobs/CleanupStaleMultiplexedConnections.php
@@ -3,6 +3,7 @@
namespace App\Jobs;
use App\Models\Server;
+use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
@@ -10,7 +11,6 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Facades\Storage;
-use Carbon\Carbon;
class CleanupStaleMultiplexedConnections implements ShouldQueue
{
@@ -30,8 +30,9 @@ class CleanupStaleMultiplexedConnections implements ShouldQueue
$serverUuid = $this->extractServerUuidFromMuxFile($muxFile);
$server = Server::where('uuid', $serverUuid)->first();
- if (!$server) {
+ if (! $server) {
$this->removeMultiplexFile($muxFile);
+
continue;
}
@@ -60,7 +61,7 @@ class CleanupStaleMultiplexedConnections implements ShouldQueue
foreach ($muxFiles as $muxFile) {
$serverUuid = $this->extractServerUuidFromMuxFile($muxFile);
- if (!in_array($serverUuid, $existingServerUuids)) {
+ if (! in_array($serverUuid, $existingServerUuids)) {
$this->removeMultiplexFile($muxFile);
}
}
diff --git a/app/Jobs/ScheduledTaskJob.php b/app/Jobs/ScheduledTaskJob.php
index 93d5fca709..3752164931 100644
--- a/app/Jobs/ScheduledTaskJob.php
+++ b/app/Jobs/ScheduledTaskJob.php
@@ -56,11 +56,14 @@ class ScheduledTaskJob implements ShouldQueue
{
if ($this->resource instanceof Application) {
$timezone = $this->resource->destination->server->settings->server_timezone;
+
return $timezone;
} elseif ($this->resource instanceof Service) {
$timezone = $this->resource->server->settings->server_timezone;
+
return $timezone;
}
+
return 'UTC';
}
@@ -94,12 +97,12 @@ class ScheduledTaskJob implements ShouldQueue
} elseif ($this->resource->type() == 'service') {
$this->resource->applications()->get()->each(function ($application) {
if (str(data_get($application, 'status'))->contains('running')) {
- $this->containers[] = data_get($application, 'name') . '-' . data_get($this->resource, 'uuid');
+ $this->containers[] = data_get($application, 'name').'-'.data_get($this->resource, 'uuid');
}
});
$this->resource->databases()->get()->each(function ($database) {
if (str(data_get($database, 'status'))->contains('running')) {
- $this->containers[] = data_get($database, 'name') . '-' . data_get($this->resource, 'uuid');
+ $this->containers[] = data_get($database, 'name').'-'.data_get($this->resource, 'uuid');
}
});
}
@@ -112,8 +115,8 @@ class ScheduledTaskJob implements ShouldQueue
}
foreach ($this->containers as $containerName) {
- if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container . '-' . $this->resource->uuid)) {
- $cmd = "sh -c '" . str_replace("'", "'\''", $this->task->command) . "'";
+ if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container.'-'.$this->resource->uuid)) {
+ $cmd = "sh -c '".str_replace("'", "'\''", $this->task->command)."'";
$exec = "docker exec {$containerName} {$cmd}";
$this->task_output = instant_remote_process([$exec], $this->server, true);
$this->task_log->update([
diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php
index 21dcda50fa..52d4674ee1 100644
--- a/app/Livewire/Boarding/Index.php
+++ b/app/Livewire/Boarding/Index.php
@@ -247,7 +247,7 @@ uZx9iFkCELtxrh31QJ68AAAAEXNhaWxANzZmZjY2ZDJlMmRkAQIDBA==
$this->createdPrivateKey = $privateKey;
$this->currentState = 'create-server';
} catch (\Exception $e) {
- $this->addError('privateKey', 'Failed to save private key: ' . $e->getMessage());
+ $this->addError('privateKey', 'Failed to save private key: '.$e->getMessage());
}
}
diff --git a/app/Livewire/Destination/Form.php b/app/Livewire/Destination/Form.php
index 5b3115dea0..87ae839313 100644
--- a/app/Livewire/Destination/Form.php
+++ b/app/Livewire/Destination/Form.php
@@ -1,6 +1,7 @@
<?php
namespace App\Livewire\Destination;
+
use Livewire\Component;
class Form extends Component
diff --git a/app/Livewire/NavbarDeleteTeam.php b/app/Livewire/NavbarDeleteTeam.php
index 6b3ea3fd4d..988add7c89 100644
--- a/app/Livewire/NavbarDeleteTeam.php
+++ b/app/Livewire/NavbarDeleteTeam.php
@@ -2,10 +2,10 @@
namespace App\Livewire;
-use Illuminate\Support\Facades\DB;
-use Livewire\Component;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
+use Livewire\Component;
class NavbarDeleteTeam extends Component
{
@@ -18,8 +18,9 @@ class NavbarDeleteTeam extends Component
public function delete($password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
diff --git a/app/Livewire/Project/Application/Deployment/Show.php b/app/Livewire/Project/Application/Deployment/Show.php
index f2968f6d92..3de895f8c5 100644
--- a/app/Livewire/Project/Application/Deployment/Show.php
+++ b/app/Livewire/Project/Application/Deployment/Show.php
@@ -4,7 +4,6 @@ namespace App\Livewire\Project\Application\Deployment;
use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
-use Illuminate\Support\Collection;
use Livewire\Component;
class Show extends Component
diff --git a/app/Livewire/Project/Application/Previews.php b/app/Livewire/Project/Application/Previews.php
index 397e159ad3..b1ba035dc4 100644
--- a/app/Livewire/Project/Application/Previews.php
+++ b/app/Livewire/Project/Application/Previews.php
@@ -5,12 +5,12 @@ namespace App\Livewire\Project\Application;
use App\Actions\Docker\GetContainersStatus;
use App\Models\Application;
use App\Models\ApplicationPreview;
+use Illuminate\Process\InvokedProcess;
use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Process;
use Livewire\Component;
use Spatie\Url\Url;
use Visus\Cuid2\Cuid2;
-use Illuminate\Process\InvokedProcess;
-use Illuminate\Support\Facades\Process;
class Previews extends Component
{
@@ -195,7 +195,7 @@ class Previews extends Component
$containers = getCurrentApplicationContainerStatus($server, $this->application->id, $pull_request_id)->toArray();
$this->stopContainers($containers, $server, $timeout);
}
-
+
GetContainersStatus::run($server);
$this->application->refresh();
$this->dispatch('containerStatusUpdated');
@@ -242,7 +242,7 @@ class Previews extends Component
$startTime = time();
while (count($processes) > 0) {
$finishedProcesses = array_filter($processes, function ($process) {
- return !$process->running();
+ return ! $process->running();
});
foreach (array_keys($finishedProcesses) as $containerName) {
unset($processes[$containerName]);
diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.php
index 9efb2d9fc8..ec87beead4 100644
--- a/app/Livewire/Project/Database/BackupEdit.php
+++ b/app/Livewire/Project/Database/BackupEdit.php
@@ -3,10 +3,10 @@
namespace App\Livewire\Project\Database;
use App\Models\ScheduledDatabaseBackup;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
use Livewire\Component;
use Spatie\Url\Url;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Auth;
class BackupEdit extends Component
{
@@ -15,7 +15,9 @@ class BackupEdit extends Component
public $s3s;
public bool $delete_associated_backups_locally = false;
+
public bool $delete_associated_backups_s3 = false;
+
public bool $delete_associated_backups_sftp = false;
public ?string $status = null;
@@ -54,8 +56,9 @@ class BackupEdit extends Component
public function delete($password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
@@ -74,7 +77,7 @@ class BackupEdit extends Component
$url = Url::fromString($previousUrl);
$url = $url->withoutQueryParameter('selectedBackupId');
$url = $url->withFragment('backups');
- $url = $url->getPath() . "#{$url->getFragment()}";
+ $url = $url->getPath()."#{$url->getFragment()}";
return redirect($url);
} else {
@@ -135,11 +138,11 @@ class BackupEdit extends Component
} else {
$server = $this->backup->database->destination->server;
}
-
- if (!$backupFolder) {
+
+ if (! $backupFolder) {
$backupFolder = dirname($execution->filename);
}
-
+
delete_backup_locally($execution->filename, $server);
$execution->delete();
}
@@ -162,13 +165,13 @@ class BackupEdit extends Component
private function deleteEmptyBackupFolder($folderPath, $server)
{
$checkEmpty = instant_remote_process(["[ -z \"$(ls -A '$folderPath')\" ] && echo 'empty' || echo 'not empty'"], $server);
-
+
if (trim($checkEmpty) === 'empty') {
instant_remote_process(["rmdir '$folderPath'"], $server);
-
+
$parentFolder = dirname($folderPath);
$checkParentEmpty = instant_remote_process(["[ -z \"$(ls -A '$parentFolder')\" ] && echo 'empty' || echo 'not empty'"], $server);
-
+
if (trim($checkParentEmpty) === 'empty') {
instant_remote_process(["rmdir '$parentFolder'"], $server);
}
@@ -182,7 +185,7 @@ class BackupEdit extends Component
['id' => 'delete_associated_backups_locally', 'label' => 'All backups associated with this backup job from this database will be permanently deleted from local storage.'],
// ['id' => 'delete_associated_backups_s3', 'label' => 'All backups associated with this backup job from this database will be permanently deleted from the selected S3 Storage.']
// ['id' => 'delete_associated_backups_sftp', 'label' => 'All backups associated with this backup job from this database will be permanently deleted from the selected SFTP Storage.']
- ]
+ ],
]);
}
}
diff --git a/app/Livewire/Project/Database/BackupExecutions.php b/app/Livewire/Project/Database/BackupExecutions.php
index e163976526..c8c33a0223 100644
--- a/app/Livewire/Project/Database/BackupExecutions.php
+++ b/app/Livewire/Project/Database/BackupExecutions.php
@@ -3,19 +3,23 @@
namespace App\Livewire\Project\Database;
use App\Models\ScheduledDatabaseBackup;
-use Livewire\Component;
-use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
use Livewire\Attributes\On;
+use Livewire\Component;
class BackupExecutions extends Component
{
public ?ScheduledDatabaseBackup $backup = null;
+
public $database;
+
public $executions = [];
+
public $setDeletableBackup;
public $delete_backup_s3 = true;
+
public $delete_backup_sftp = true;
public function getListeners()
@@ -40,14 +44,16 @@ class BackupExecutions extends Component
#[On('deleteBackup')]
public function deleteBackup($executionId, $password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
$execution = $this->backup->executions()->where('id', $executionId)->first();
if (is_null($execution)) {
$this->dispatch('error', 'Backup execution not found.');
+
return;
}
@@ -103,16 +109,18 @@ class BackupExecutions extends Component
return $server;
}
}
+
return null;
}
public function getServerTimezone()
{
$server = $this->server();
- if (!$server) {
+ if (! $server) {
return 'UTC';
}
$serverTimezone = $server->settings->server_timezone;
+
return $serverTimezone;
}
@@ -125,6 +133,7 @@ class BackupExecutions extends Component
} catch (\Exception $e) {
$dateObj->setTimezone(new \DateTimeZone('UTC'));
}
+
return $dateObj->format('Y-m-d H:i:s T');
}
@@ -134,7 +143,7 @@ class BackupExecutions extends Component
'checkboxes' => [
['id' => 'delete_backup_s3', 'label' => 'Delete the selected backup permanently form S3 Storage'],
['id' => 'delete_backup_sftp', 'label' => 'Delete the selected backup permanently form SFTP Storage'],
- ]
+ ],
]);
}
}
diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.php
index a6e2a1320f..7a6446815b 100644
--- a/app/Livewire/Project/Database/Clickhouse/General.php
+++ b/app/Livewire/Project/Database/Clickhouse/General.php
@@ -56,7 +56,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -73,14 +73,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -95,7 +95,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php
index 00e0ff09f6..394ba6c9a3 100644
--- a/app/Livewire/Project/Database/Dragonfly/General.php
+++ b/app/Livewire/Project/Database/Dragonfly/General.php
@@ -54,7 +54,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -88,14 +88,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -110,7 +110,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php
index 320feeac7c..f976e1edde 100644
--- a/app/Livewire/Project/Database/Keydb/General.php
+++ b/app/Livewire/Project/Database/Keydb/General.php
@@ -57,7 +57,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -94,14 +94,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -116,7 +116,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php
index 70545910c5..12d4882f3c 100644
--- a/app/Livewire/Project/Database/Mariadb/General.php
+++ b/app/Livewire/Project/Database/Mariadb/General.php
@@ -63,7 +63,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -100,14 +100,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -122,7 +122,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php
index d23b66c00e..ac40e7dfa0 100644
--- a/app/Livewire/Project/Database/Mongodb/General.php
+++ b/app/Livewire/Project/Database/Mongodb/General.php
@@ -61,7 +61,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -101,14 +101,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -123,7 +123,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php
index 29a9cbae2e..7d5270ddf5 100644
--- a/app/Livewire/Project/Database/Mysql/General.php
+++ b/app/Livewire/Project/Database/Mysql/General.php
@@ -62,7 +62,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -99,14 +99,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -121,7 +121,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php
index fd2f9834fc..72fd95de88 100644
--- a/app/Livewire/Project/Database/Redis/General.php
+++ b/app/Livewire/Project/Database/Redis/General.php
@@ -57,7 +57,7 @@ class General extends Component
public function instantSaveAdvanced()
{
try {
- if (!$this->server->isLogDrainEnabled()) {
+ if (! $this->server->isLogDrainEnabled()) {
$this->database->is_log_drain_enabled = false;
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
@@ -88,14 +88,14 @@ class General extends Component
public function instantSave()
{
try {
- if ($this->database->is_public && !$this->database->public_port) {
+ if ($this->database->is_public && ! $this->database->public_port) {
$this->dispatch('error', 'Public port is required.');
$this->database->is_public = false;
return;
}
if ($this->database->is_public) {
- if (!str($this->database->status)->startsWith('running')) {
+ if (! str($this->database->status)->startsWith('running')) {
$this->dispatch('error', 'Database must be started to be publicly accessible.');
$this->database->is_public = false;
@@ -110,7 +110,7 @@ class General extends Component
$this->db_url_public = $this->database->external_db_url;
$this->database->save();
} catch (\Throwable $e) {
- $this->database->is_public = !$this->database->is_public;
+ $this->database->is_public = ! $this->database->is_public;
return handleError($e, $this);
}
diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.php
index 9fac897bf7..2150191124 100644
--- a/app/Livewire/Project/Service/FileStorage.php
+++ b/app/Livewire/Project/Service/FileStorage.php
@@ -14,9 +14,9 @@ use App\Models\StandaloneMongodb;
use App\Models\StandaloneMysql;
use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
-use Livewire\Component;
-use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+use Livewire\Component;
class FileStorage extends Component
{
@@ -87,8 +87,9 @@ class FileStorage extends Component
public function delete($password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
@@ -134,7 +135,7 @@ class FileStorage extends Component
$this->submit();
}
- public function render()
+ public function render()
{
return view('livewire.project.service.file-storage', [
'directoryDeletionCheckboxes' => [
@@ -142,7 +143,7 @@ class FileStorage extends Component
],
'fileDeletionCheckboxes' => [
['id' => 'permanently_delete', 'label' => 'The selected file will be permanently deleted form the server.'],
- ]
+ ],
]);
}
}
diff --git a/app/Livewire/Project/Shared/Destination.php b/app/Livewire/Project/Shared/Destination.php
index 1be7245680..7fb5c45db7 100644
--- a/app/Livewire/Project/Shared/Destination.php
+++ b/app/Livewire/Project/Shared/Destination.php
@@ -8,10 +8,10 @@ use App\Events\ApplicationStatusChanged;
use App\Jobs\ContainerStatusJob;
use App\Models\Server;
use App\Models\StandaloneDocker;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Auth;
class Destination extends Component
{
@@ -119,11 +119,12 @@ class Destination extends Component
public function removeServer(int $network_id, int $server_id, $password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
-
+
if ($this->resource->destination->server->id == $server_id && $this->resource->destination->id == $network_id) {
$this->dispatch('error', 'You cannot remove this destination server.', 'You are trying to remove the main server.');
diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php
index b48ee7e231..0e140b8c1a 100644
--- a/app/Livewire/Project/Shared/GetLogs.php
+++ b/app/Livewire/Project/Shared/GetLogs.php
@@ -2,6 +2,7 @@
namespace App\Livewire\Project\Shared;
+use App\Helpers\SshMultiplexingHelper;
use App\Models\Application;
use App\Models\Server;
use App\Models\Service;
@@ -17,7 +18,6 @@ use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
use Illuminate\Support\Facades\Process;
use Livewire\Component;
-use App\Helpers\SshMultiplexingHelper;
class GetLogs extends Component
{
diff --git a/app/Livewire/Project/Shared/ScheduledTask/Executions.php b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
index 5bd6b4b9b1..017cc9fd7e 100644
--- a/app/Livewire/Project/Shared/ScheduledTask/Executions.php
+++ b/app/Livewire/Project/Shared/ScheduledTask/Executions.php
@@ -7,7 +7,9 @@ use Livewire\Component;
class Executions extends Component
{
public $executions = [];
+
public $selectedKey;
+
public $task;
public function getListeners()
@@ -29,7 +31,7 @@ class Executions extends Component
public function server()
{
- if (!$this->task) {
+ if (! $this->task) {
return null;
}
@@ -42,16 +44,18 @@ class Executions extends Component
return $this->task->service->destination->server;
}
}
+
return null;
}
public function getServerTimezone()
{
$server = $this->server();
- if (!$server) {
+ if (! $server) {
return 'UTC';
}
$serverTimezone = $server->settings->server_timezone;
+
return $serverTimezone;
}
@@ -64,6 +68,7 @@ class Executions extends Component
} catch (\Exception $e) {
$dateObj->setTimezone(new \DateTimeZone('UTC'));
}
+
return $dateObj->format('Y-m-d H:i:s T');
}
}
diff --git a/app/Livewire/Project/Shared/Storages/Show.php b/app/Livewire/Project/Shared/Storages/Show.php
index a0cb54aa0f..e4b5c9b893 100644
--- a/app/Livewire/Project/Shared/Storages/Show.php
+++ b/app/Livewire/Project/Shared/Storages/Show.php
@@ -3,8 +3,8 @@
namespace App\Livewire\Project\Shared\Storages;
use App\Models\LocalPersistentVolume;
-use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
use Livewire\Component;
class Show extends Component
@@ -40,8 +40,9 @@ class Show extends Component
public function delete($password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
diff --git a/app/Livewire/Security/PrivateKey/Create.php b/app/Livewire/Security/PrivateKey/Create.php
index 95f6a71bf1..319cec1926 100644
--- a/app/Livewire/Security/PrivateKey/Create.php
+++ b/app/Livewire/Security/PrivateKey/Create.php
@@ -8,9 +8,13 @@ use Livewire\Component;
class Create extends Component
{
public string $name = '';
+
public string $value = '';
+
public ?string $from = null;
+
public ?string $description = null;
+
public ?string $publicKey = null;
protected $rules = [
@@ -49,7 +53,7 @@ class Create extends Component
$privateKey = PrivateKey::createAndStore([
'name' => $this->name,
'description' => $this->description,
- 'private_key' => trim($this->value) . "\n",
+ 'private_key' => trim($this->value)."\n",
'team_id' => currentTeam()->id,
]);
@@ -72,7 +76,7 @@ class Create extends Component
$validationResult = PrivateKey::validateAndExtractPublicKey($this->value);
$this->publicKey = $validationResult['publicKey'];
- if (!$validationResult['isValid']) {
+ if (! $validationResult['isValid']) {
$this->addError('value', 'Invalid private key');
}
}
diff --git a/app/Livewire/Security/PrivateKey/Index.php b/app/Livewire/Security/PrivateKey/Index.php
index 0b50ba1d80..76441a67e5 100644
--- a/app/Livewire/Security/PrivateKey/Index.php
+++ b/app/Livewire/Security/PrivateKey/Index.php
@@ -2,8 +2,8 @@
namespace App\Livewire\Security\PrivateKey;
-use Livewire\Component;
use App\Models\PrivateKey;
+use Livewire\Component;
class Index extends Component
{
diff --git a/app/Livewire/Server/Delete.php b/app/Livewire/Server/Delete.php
index 08e91a4c70..ed2345b2a5 100644
--- a/app/Livewire/Server/Delete.php
+++ b/app/Livewire/Server/Delete.php
@@ -3,9 +3,9 @@
namespace App\Livewire\Server;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
-use Livewire\Component;
-use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+use Livewire\Component;
class Delete extends Component
{
@@ -15,8 +15,9 @@ class Delete extends Component
public function delete($password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
try {
diff --git a/app/Livewire/Server/Proxy/Deploy.php b/app/Livewire/Server/Proxy/Deploy.php
index c66ed1795f..eaa3126635 100644
--- a/app/Livewire/Server/Proxy/Deploy.php
+++ b/app/Livewire/Server/Proxy/Deploy.php
@@ -6,9 +6,9 @@ use App\Actions\Proxy\CheckProxy;
use App\Actions\Proxy\StartProxy;
use App\Events\ProxyStatusChanged;
use App\Models\Server;
-use Livewire\Component;
-use Illuminate\Support\Facades\Process;
use Illuminate\Process\InvokedProcess;
+use Illuminate\Support\Facades\Process;
+use Livewire\Component;
class Deploy extends Component
{
diff --git a/app/Livewire/Team/AdminView.php b/app/Livewire/Team/AdminView.php
index ee5e673a5f..3026cb2971 100644
--- a/app/Livewire/Team/AdminView.php
+++ b/app/Livewire/Team/AdminView.php
@@ -4,9 +4,9 @@ namespace App\Livewire\Team;
use App\Models\Team;
use App\Models\User;
-use Livewire\Component;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
+use Livewire\Component;
class AdminView extends Component
{
@@ -77,8 +77,9 @@ class AdminView extends Component
public function delete($id, $password)
{
- if (!Hash::check($password, Auth::user()->password)) {
+ if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
+
return;
}
if (! auth()->user()->isInstanceAdmin()) {
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 8c7520eaf3..55006745ac 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -6,10 +6,10 @@ use App\Enums\ApplicationDeploymentStatus;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Process\InvokedProcess;
use Illuminate\Support\Collection;
-use Illuminate\Support\Str;
use Illuminate\Support\Facades\Process;
-use Illuminate\Process\InvokedProcess;
+use Illuminate\Support\Str;
use OpenApi\Attributes as OA;
use RuntimeException;
use Spatie\Activitylog\Models\Activity;
@@ -170,7 +170,7 @@ class Application extends BaseModel
$startTime = time();
while (count($processes) > 0) {
$finishedProcesses = array_filter($processes, function ($process) {
- return !$process->running();
+ return ! $process->running();
});
foreach ($finishedProcesses as $containerName => $process) {
unset($processes[$containerName]);
@@ -209,7 +209,7 @@ class Application extends BaseModel
$server = data_get($this, 'destination.server');
$workdir = $this->workdir();
if (str($workdir)->endsWith($this->uuid)) {
- instant_remote_process(['rm -rf ' . $this->workdir()], $server, false);
+ instant_remote_process(['rm -rf '.$this->workdir()], $server, false);
}
}
@@ -237,7 +237,6 @@ class Application extends BaseModel
instant_remote_process(["docker network rm {$uuid}"], $server, false);
}
-
public function additional_servers()
{
return $this->belongsToMany(Server::class, 'additional_destinations')
@@ -345,7 +344,7 @@ class Application extends BaseModel
public function publishDirectory(): Attribute
{
return Attribute::make(
- set: fn ($value) => $value ? '/' . ltrim($value, '/') : null,
+ set: fn ($value) => $value ? '/'.ltrim($value, '/') : null,
);
}
@@ -353,7 +352,7 @@ class Application extends BaseModel
{
return Attribute::make(
get: function () {
- if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
+ if (! is_null($this->source?->html_url) && ! is_null($this->git_repository) && ! is_null($this->git_branch)) {
if (str($this->git_repository)->contains('bitbucket')) {
return "{$this->source->html_url}/{$this->git_repository}/src/{$this->git_branch}";
}
@@ -380,7 +379,7 @@ class Application extends BaseModel
{
return Attribute::make(
get: function () {
- if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
+ if (! is_null($this->source?->html_url) && ! is_null($this->git_repository) && ! is_null($this->git_branch)) {
return "{$this->source->html_url}/{$this->git_repository}/settings/hooks";
}
// Convert the SSH URL to HTTPS URL
@@ -399,7 +398,7 @@ class Application extends BaseModel
{
return Attribute::make(
get: function () {
- if (!is_null($this->source?->html_url) && !is_null($this->git_repository) && !is_null($this->git_branch)) {
+ if (! is_null($this->source?->html_url) && ! is_null($this->git_repository) && ! is_null($this->git_branch)) {
return "{$this->source->html_url}/{$this->git_repository}/commits/{$this->git_branch}";
}
// Convert the SSH URL to HTTPS URL
@@ -416,7 +415,7 @@ class Application extends BaseModel
public function gitCommitLink($link): string
{
- if (!is_null(data_get($this, 'source.html_url')) && !is_null(data_get($this, 'git_repository')) && !is_null(data_get($this, 'git_branch'))) {
+ if (! is_null(data_get($this, 'source.html_url')) && ! is_null(data_get($this, 'git_repository')) && ! is_null(data_get($this, 'git_branch'))) {
if (str($this->source->html_url)->contains('bitbucket')) {
return "{$this->source->html_url}/{$this->git_repository}/commits/{$link}";
}
@@ -427,7 +426,7 @@ class Application extends BaseModel
$git_repository = str_replace('.git', '', $this->git_repository);
$url = Url::fromString($git_repository);
$url = $url->withUserInfo('');
- $url = $url->withPath($url->getPath() . '/commits/' . $link);
+ $url = $url->withPath($url->getPath().'/commits/'.$link);
return $url->__toString();
}
@@ -480,7 +479,7 @@ class Application extends BaseModel
public function baseDirectory(): Attribute
{
return Attribute::make(
- set: fn ($value) => '/' . ltrim($value, '/'),
+ set: fn ($value) => '/'.ltrim($value, '/'),
);
}
@@ -823,7 +822,7 @@ class Application extends BaseModel
public function workdir()
{
- return application_configuration_dir() . "/{$this->uuid}";
+ return application_configuration_dir()."/{$this->uuid}";
}
public function isLogDrainEnabled()
@@ -833,7 +832,7 @@ class Application extends BaseModel
public function isConfigurationChanged(bool $save = false)
{
- $newConfigHash = $this->fqdn . $this->git_repository . $this->git_branch . $this->git_commit_sha . $this->build_pack . $this->static_image . $this->install_command . $this->build_command . $this->start_command . $this->ports_exposes . $this->ports_mappings . $this->base_directory . $this->publish_directory . $this->dockerfile . $this->dockerfile_location . $this->custom_labels . $this->custom_docker_run_options . $this->dockerfile_target_build . $this->redirect;
+ $newConfigHash = $this->fqdn.$this->git_repository.$this->git_branch.$this->git_commit_sha.$this->build_pack.$this->static_image.$this->install_command.$this->build_command.$this->start_command.$this->ports_exposes.$this->ports_mappings.$this->base_directory.$this->publish_directory.$this->dockerfile.$this->dockerfile_location.$this->custom_labels.$this->custom_docker_run_options.$this->dockerfile_target_build.$this->redirect;
if ($this->pull_request_id === 0 || $this->pull_request_id === null) {
$newConfigHash .= json_encode($this->environment_variables()->get('value')->sort());
} else {
@@ -887,7 +886,7 @@ class Application extends BaseModel
public function dirOnServer()
{
- return application_configuration_dir() . "/{$this->uuid}";
+ return application_configuration_dir()."/{$this->uuid}";
}
public function setGitImportSettings(string $deployment_uuid, string $git_clone_command, bool $public = false)
@@ -933,7 +932,7 @@ class Application extends BaseModel
if ($this->source->is_public) {
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
- if (!$only_checkout) {
+ if (! $only_checkout) {
$git_clone_command = $this->setGitImportSettings($deployment_uuid, $git_clone_command, public: true);
}
if ($exec_in_docker) {
@@ -950,7 +949,7 @@ class Application extends BaseModel
$git_clone_command = "{$git_clone_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository} {$baseDir}";
$fullRepoUrl = "$source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}";
}
- if (!$only_checkout) {
+ if (! $only_checkout) {
$git_clone_command = $this->setGitImportSettings($deployment_uuid, $git_clone_command, public: false);
}
if ($exec_in_docker) {
@@ -1011,7 +1010,7 @@ class Application extends BaseModel
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && " . $this->buildGitCheckoutCommand($pr_branch_name);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'github' || $git_type === 'gitea') {
$branch = "pull/{$pull_request_id}/head:$pr_branch_name";
if ($exec_in_docker) {
@@ -1019,14 +1018,14 @@ class Application extends BaseModel
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && " . $this->buildGitCheckoutCommand($pr_branch_name);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'bitbucket') {
if ($exec_in_docker) {
$commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'"));
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" " . $this->buildGitCheckoutCommand($commit);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" ".$this->buildGitCheckoutCommand($commit);
}
}
@@ -1055,7 +1054,7 @@ class Application extends BaseModel
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && " . $this->buildGitCheckoutCommand($pr_branch_name);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'github' || $git_type === 'gitea') {
$branch = "pull/{$pull_request_id}/head:$pr_branch_name";
if ($exec_in_docker) {
@@ -1063,14 +1062,14 @@ class Application extends BaseModel
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && " . $this->buildGitCheckoutCommand($pr_branch_name);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" git fetch origin $branch && ".$this->buildGitCheckoutCommand($pr_branch_name);
} elseif ($git_type === 'bitbucket') {
if ($exec_in_docker) {
$commands->push(executeInDocker($deployment_uuid, "echo 'Checking out $branch'"));
} else {
$commands->push("echo 'Checking out $branch'");
}
- $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" " . $this->buildGitCheckoutCommand($commit);
+ $git_clone_command = "{$git_clone_command} && cd {$baseDir} && GIT_SSH_COMMAND=\"ssh -o ConnectTimeout=30 -p {$customPort} -o Port={$customPort} -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /root/.ssh/id_rsa\" ".$this->buildGitCheckoutCommand($commit);
}
}
@@ -1096,6 +1095,7 @@ class Application extends BaseModel
throw new \Exception($e->getMessage());
}
$services = data_get($yaml, 'services');
+
$commands = collect([]);
$services = collect($services)->map(function ($service) use ($commands) {
$serviceVolumes = collect(data_get($service, 'volumes', []));
@@ -1122,20 +1122,20 @@ class Application extends BaseModel
}
if ($source->startsWith('.')) {
$source = $source->after('.');
- $source = $workdir . $source;
+ $source = $workdir.$source;
}
$commands->push("mkdir -p $source > /dev/null 2>&1 || true");
}
}
}
$labels = collect(data_get($service, 'labels', []));
- if (!$labels->contains('coolify.managed')) {
+ if (! $labels->contains('coolify.managed')) {
$labels->push('coolify.managed=true');
}
- if (!$labels->contains('coolify.applicationId')) {
- $labels->push('coolify.applicationId=' . $this->id);
+ if (! $labels->contains('coolify.applicationId')) {
+ $labels->push('coolify.applicationId='.$this->id);
}
- if (!$labels->contains('coolify.type')) {
+ if (! $labels->contains('coolify.type')) {
$labels->push('coolify.type=application');
}
data_set($service, 'labels', $labels->toArray());
@@ -1211,7 +1211,7 @@ class Application extends BaseModel
$jsonNames = $json->keys()->toArray();
$diff = array_diff($jsonNames, $names);
$json = $json->filter(function ($value, $key) use ($diff) {
- return !in_array($key, $diff);
+ return ! in_array($key, $diff);
});
if ($json) {
$this->docker_compose_domains = json_encode($json);
@@ -1233,7 +1233,7 @@ class Application extends BaseModel
public function parseContainerLabels(?ApplicationPreview $preview = null)
{
$customLabels = data_get($this, 'custom_labels');
- if (!$customLabels) {
+ if (! $customLabels) {
return;
}
if (base64_encode(base64_decode($customLabels, true)) !== $customLabels) {
@@ -1316,10 +1316,10 @@ class Application extends BaseModel
continue;
}
if (isset($healthcheckCommand) && str_contains($trimmedLine, '\\')) {
- $healthcheckCommand .= ' ' . trim($trimmedLine, '\\ ');
+ $healthcheckCommand .= ' '.trim($trimmedLine, '\\ ');
}
- if (isset($healthcheckCommand) && !str_contains($trimmedLine, '\\') && !empty($healthcheckCommand)) {
- $healthcheckCommand .= ' ' . $trimmedLine;
+ if (isset($healthcheckCommand) && ! str_contains($trimmedLine, '\\') && ! empty($healthcheckCommand)) {
+ $healthcheckCommand .= ' '.$trimmedLine;
break;
}
}
diff --git a/app/Models/ScheduledDatabaseBackup.php b/app/Models/ScheduledDatabaseBackup.php
index 50a0c81731..ce5d3a87fb 100644
--- a/app/Models/ScheduledDatabaseBackup.php
+++ b/app/Models/ScheduledDatabaseBackup.php
@@ -35,14 +35,17 @@ class ScheduledDatabaseBackup extends BaseModel
{
return $this->hasMany(ScheduledDatabaseBackupExecution::class)->where('created_at', '>=', now()->subDays($days))->get();
}
+
public function server()
{
if ($this->database) {
if ($this->database->destination && $this->database->destination->server) {
$server = $this->database->destination->server;
+
return $server;
}
}
+
return null;
}
}
diff --git a/app/Models/ScheduledTask.php b/app/Models/ScheduledTask.php
index 82f0036a5e..3cee5a875a 100644
--- a/app/Models/ScheduledTask.php
+++ b/app/Models/ScheduledTask.php
@@ -4,8 +4,6 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
-use App\Models\Service;
-use App\Models\Application;
class ScheduledTask extends BaseModel
{
@@ -37,19 +35,23 @@ class ScheduledTask extends BaseModel
if ($this->application) {
if ($this->application->destination && $this->application->destination->server) {
$server = $this->application->destination->server;
+
return $server;
}
} elseif ($this->service) {
if ($this->service->destination && $this->service->destination->server) {
$server = $this->service->destination->server;
+
return $server;
}
} elseif ($this->database) {
if ($this->database->destination && $this->database->destination->server) {
$server = $this->database->destination->server;
+
return $server;
}
}
+
return null;
}
}
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 80464db7d4..d236869baa 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -6,9 +6,9 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Process\InvokedProcess;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Process;
-use Illuminate\Process\InvokedProcess;
use Illuminate\Support\Facades\Storage;
use OpenApi\Attributes as OA;
use Spatie\Url\Url;
@@ -70,7 +70,7 @@ class Service extends BaseModel
$databaseStorages = $this->databases()->get()->pluck('persistentStorages')->flatten()->sortBy('id');
$storages = $applicationStorages->merge($databaseStorages)->implode('updated_at');
- $newConfigHash = $images . $domains . $images . $storages;
+ $newConfigHash = $images.$domains.$images.$storages;
$newConfigHash .= json_encode($this->environment_variables()->get('value')->sort());
$newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash');
@@ -144,6 +144,7 @@ class Service extends BaseModel
foreach ($dbs as $db) {
$containersToStop[] = "{$db->name}-{$this->uuid}";
}
+
return $containersToStop;
}
@@ -157,7 +158,7 @@ class Service extends BaseModel
$startTime = time();
while (count($processes) > 0) {
$finishedProcesses = array_filter($processes, function ($process) {
- return !$process->running();
+ return ! $process->running();
});
foreach (array_keys($finishedProcesses) as $containerName) {
unset($processes[$containerName]);
@@ -196,7 +197,7 @@ class Service extends BaseModel
$server = data_get($this, 'destination.server');
$workdir = $this->workdir();
if (str($workdir)->endsWith($this->uuid)) {
- instant_remote_process(['rm -rf ' . $this->workdir()], $server, false);
+ instant_remote_process(['rm -rf '.$this->workdir()], $server, false);
}
}
@@ -1061,7 +1062,7 @@ class Service extends BaseModel
public function workdir()
{
- return service_configuration_dir() . "/{$this->uuid}";
+ return service_configuration_dir()."/{$this->uuid}";
}
public function saveComposeConfigs()
diff --git a/app/Models/ServiceApplication.php b/app/Models/ServiceApplication.php
index f0c78cc08b..d312fab964 100644
--- a/app/Models/ServiceApplication.php
+++ b/app/Models/ServiceApplication.php
@@ -23,7 +23,7 @@ class ServiceApplication extends BaseModel
public function restart()
{
- $container_id = $this->name . '-' . $this->service->uuid;
+ $container_id = $this->name.'-'.$this->service->uuid;
instant_remote_process(["docker restart {$container_id}"], $this->service->server);
}
@@ -69,7 +69,7 @@ class ServiceApplication extends BaseModel
public function workdir()
{
- return service_configuration_dir() . "/{$this->service->uuid}";
+ return service_configuration_dir()."/{$this->service->uuid}";
}
public function serviceType()
diff --git a/app/Models/ServiceDatabase.php b/app/Models/ServiceDatabase.php
index 2e25f4402f..6b96738e81 100644
--- a/app/Models/ServiceDatabase.php
+++ b/app/Models/ServiceDatabase.php
@@ -21,7 +21,7 @@ class ServiceDatabase extends BaseModel
public function restart()
{
- $container_id = $this->name . '-' . $this->service->uuid;
+ $container_id = $this->name.'-'.$this->service->uuid;
remote_process(["docker restart {$container_id}"], $this->service->server);
}
@@ -88,7 +88,7 @@ class ServiceDatabase extends BaseModel
public function workdir()
{
- return service_configuration_dir() . "/{$this->service->uuid}";
+ return service_configuration_dir()."/{$this->service->uuid}";
}
public function service()
diff --git a/app/Traits/ExecuteRemoteCommand.php b/app/Traits/ExecuteRemoteCommand.php
index 03726f0958..f8ccee9db7 100644
--- a/app/Traits/ExecuteRemoteCommand.php
+++ b/app/Traits/ExecuteRemoteCommand.php
@@ -3,11 +3,11 @@
namespace App\Traits;
use App\Enums\ApplicationDeploymentStatus;
+use App\Helpers\SshMultiplexingHelper;
use App\Models\Server;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Process;
-use App\Helpers\SshMultiplexingHelper;
trait ExecuteRemoteCommand
{
diff --git a/database/migrations/2024_09_08_130756_update_server_settings_default_timezone.php b/database/migrations/2024_09_08_130756_update_server_settings_default_timezone.php
index db1322e625..109bc40ef1 100644
--- a/database/migrations/2024_09_08_130756_update_server_settings_default_timezone.php
+++ b/database/migrations/2024_09_08_130756_update_server_settings_default_timezone.php
@@ -2,8 +2,8 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Schema;
class UpdateServerSettingsDefaultTimezone extends Migration
{
diff --git a/resources/views/livewire/project/application/general.blade.php b/resources/views/livewire/project/application/general.blade.php
index c2c5127e08..94669f3a4b 100644
--- a/resources/views/livewire/project/application/general.blade.php
+++ b/resources/views/livewire/project/application/general.blade.php
@@ -68,17 +68,10 @@
<option value="www">Redirect to www.</option>
<option value="non-www">Redirect to non-www.</option>
</x-forms.select>
- <x-modal-confirmation
- title="Confirm Redirection Setting?"
- buttonTitle="Set Direction"
- submitAction="set_redirect"
- :actions="['All traffic will be redirected to the selected direction.']"
- confirmationText="{{ $application->fqdn . '/' }}"
- confirmationLabel="Please confirm the execution of the action by entering the Application URL below"
- shortConfirmationLabel="Application URL"
- :confirmWithPassword="false"
- step2ButtonText="Set Direction"
- >
+ <x-modal-confirmation title="Confirm Redirection Setting?" buttonTitle="Set Direction"
+ submitAction="set_redirect" :actions="['All traffic will be redirected to the selected direction.']" confirmationText="{{ $application->fqdn . '/' }}"
+ confirmationLabel="Please confirm the execution of the action by entering the Application URL below"
+ shortConfirmationLabel="Application URL" :confirmWithPassword="false" step2ButtonText="Set Direction">
<x-slot:customButton>
<div class="w-[7.2rem]">Set Direction</div>
</x-slot:customButton>
@@ -311,18 +304,15 @@
helper="If you know what are you doing, you can enable this to edit the labels directly. Coolify won't update labels automatically. <br><br>Be careful, it could break the proxy configuration after you restart the container."
id="application.settings.is_container_label_readonly_enabled" instantSave></x-forms.checkbox>
</div>
- <x-modal-confirmation
- title="Confirm Labels Reset to Coolify Defaults?"
- buttonTitle="Reset Labels to Coolify Defaults"
- buttonFullWidth
- submitAction="resetDefaultLabels"
- :actions="['All your custom proxy labels will be lost.', 'Proxy labels (traefik, caddy, etc) will be reset to the coolify defaults.']"
- confirmationText="{{ $application->fqdn . '/' }}"
- confirmationLabel="Please confirm the execution of the actions by entering the Application URL below"
- shortConfirmationLabel="Application URL"
- :confirmWithPassword="false"
- step2ButtonText="Permanently Reset Labels"
- />
+ <x-modal-confirmation title="Confirm Labels Reset to Coolify Defaults?"
+ buttonTitle="Reset Labels to Coolify Defaults" buttonFullWidth submitAction="resetDefaultLabels"
+ :actions="[
+ 'All your custom proxy labels will be lost.',
+ 'Proxy labels (traefik, caddy, etc) will be reset to the coolify defaults.',
+ ]" confirmationText="{{ $application->fqdn . '/' }}"
+ confirmationLabel="Please confirm the execution of the actions by entering the Application URL below"
+ shortConfirmationLabel="Application URL" :confirmWithPassword="false"
+ step2ButtonText="Permanently Reset Labels" />
@endif
<h3 class="pt-8">Pre/Post Deployment Commands</h3>
diff --git a/routes/web.php b/routes/web.php
index bd5edc0751..53ea6fdbf0 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -67,7 +67,6 @@ use App\Livewire\Team\Member\Index as TeamMemberIndex;
use App\Livewire\Terminal\Index as TerminalIndex;
use App\Livewire\Waitlist\Index as WaitlistIndex;
use App\Models\GitlabApp;
-use App\Models\PrivateKey;
use App\Models\ScheduledDatabaseBackupExecution;
use App\Models\Server;
use App\Models\StandaloneDocker;