Merge branch 'next' into feat/disable-default-redirect
This commit is contained in:
@@ -39,7 +39,6 @@ class RunRemoteProcess
|
|||||||
*/
|
*/
|
||||||
public function __construct(Activity $activity, bool $hide_from_output = false, bool $ignore_errors = false, $call_event_on_finish = null, $call_event_data = null)
|
public function __construct(Activity $activity, bool $hide_from_output = false, bool $ignore_errors = false, $call_event_on_finish = null, $call_event_data = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::COMMAND->value) {
|
if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::COMMAND->value) {
|
||||||
throw new \RuntimeException('Incompatible Activity to run a remote command.');
|
throw new \RuntimeException('Incompatible Activity to run a remote command.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use App\Models\ApplicationPreview;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\ServiceDatabase;
|
use App\Models\ServiceDatabase;
|
||||||
use App\Notifications\Container\ContainerRestarted;
|
use App\Notifications\Container\ContainerRestarted;
|
||||||
use App\Notifications\Container\ContainerStopped;
|
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ class StartProxy
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($async) {
|
if ($async) {
|
||||||
$activity = remote_process($commands, $server, callEventOnFinish: 'ProxyStarted', callEventData: $server);
|
return remote_process($commands, $server, callEventOnFinish: 'ProxyStarted', callEventData: $server);
|
||||||
|
|
||||||
return $activity;
|
|
||||||
} else {
|
} else {
|
||||||
instant_remote_process($commands, $server);
|
instant_remote_process($commands, $server);
|
||||||
$server->proxy->set('status', 'running');
|
$server->proxy->set('status', 'running');
|
||||||
@@ -70,6 +68,5 @@ class StartProxy
|
|||||||
|
|
||||||
return 'OK';
|
return 'OK';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class ConfigureCloudflared
|
|||||||
'rm -fr /tmp/cloudflared',
|
'rm -fr /tmp/cloudflared',
|
||||||
]);
|
]);
|
||||||
instant_remote_process($commands, $server);
|
instant_remote_process($commands, $server);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ class RunCommand
|
|||||||
|
|
||||||
public function handle(Server $server, $command)
|
public function handle(Server $server, $command)
|
||||||
{
|
{
|
||||||
$activity = remote_process(command: [$command], server: $server, ignore_errors: true, type: ActivityTypes::COMMAND->value);
|
return remote_process(command: [$command], server: $server, ignore_errors: true, type: ActivityTypes::COMMAND->value);
|
||||||
|
|
||||||
return $activity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ class StartService
|
|||||||
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} >/dev/null 2>&1 || true";
|
$commands[] = "docker network connect --alias {$serviceName}-{$service->uuid} $network {$serviceName}-{$service->uuid} >/dev/null 2>&1 || true";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$activity = remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');
|
|
||||||
|
|
||||||
return $activity;
|
return remote_process($commands, $service->server, type_uuid: $service->uuid, callEventOnFinish: 'ServiceStatusChanged');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,5 @@ class CleanupDatabase extends Command
|
|||||||
if ($this->option('yes')) {
|
if ($this->option('yes')) {
|
||||||
$webhooks->delete();
|
$webhooks->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,5 @@ class CleanupRedis extends Command
|
|||||||
collect($queueOverlaps)->each(function ($key) {
|
collect($queueOverlaps)->each(function ($key) {
|
||||||
Redis::connection()->del($key);
|
Redis::connection()->del($key);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class CleanupStuckedResources extends Command
|
|||||||
|
|
||||||
private function cleanup_stucked_resources()
|
private function cleanup_stucked_resources()
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$servers = Server::all()->filter(function ($server) {
|
$servers = Server::all()->filter(function ($server) {
|
||||||
return $server->isFunctional();
|
return $server->isFunctional();
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ class CloudCleanupSubscriptions extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->error($e->getMessage());
|
$this->error($e->getMessage());
|
||||||
|
|
||||||
@@ -95,6 +94,5 @@ class CloudCleanupSubscriptions extends Command
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ class Dev extends Command
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateOpenApi()
|
public function generateOpenApi()
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class Init extends Command
|
|||||||
|
|
||||||
$this->servers = Server::all();
|
$this->servers = Server::all();
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->send_alive_signal();
|
$this->send_alive_signal();
|
||||||
get_public_ips();
|
get_public_ips();
|
||||||
@@ -120,7 +119,6 @@ class Init extends Command
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error in cleaning up unnecessary dynamic proxy configuration: {$e->getMessage()}\n";
|
echo "Error in cleaning up unnecessary dynamic proxy configuration: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,5 @@ class OpenApi extends Command
|
|||||||
$error = preg_replace('/^\h*\v+/m', '', $error);
|
$error = preg_replace('/^\h*\v+/m', '', $error);
|
||||||
echo $error;
|
echo $error;
|
||||||
echo $process->output();
|
echo $process->output();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,128 +3,82 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
class ServicesGenerate extends Command
|
class ServicesGenerate extends Command
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
protected $signature = 'services:generate';
|
protected $signature = 'services:generate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
protected $description = 'Generate service-templates.yaml based on /templates/compose directory';
|
protected $description = 'Generate service-templates.yaml based on /templates/compose directory';
|
||||||
|
|
||||||
/**
|
public function handle(): int
|
||||||
* Execute the console command.
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
{
|
||||||
$files = array_diff(scandir(base_path('templates/compose')), ['.', '..']);
|
$serviceTemplatesJson = collect(glob(base_path('templates/compose/*.yaml')))
|
||||||
$files = array_filter($files, function ($file) {
|
->mapWithKeys(function ($file): array {
|
||||||
return strpos($file, '.yaml') !== false;
|
$file = basename($file);
|
||||||
});
|
$parsed = $this->processFile($file);
|
||||||
$serviceTemplatesJson = [];
|
|
||||||
foreach ($files as $file) {
|
return $parsed === false ? [] : [
|
||||||
$parsed = $this->process_file($file);
|
Arr::pull($parsed, 'name') => $parsed,
|
||||||
if ($parsed) {
|
];
|
||||||
$name = data_get($parsed, 'name');
|
})->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
||||||
$parsed = data_forget($parsed, 'name');
|
|
||||||
$serviceTemplatesJson[$name] = $parsed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$serviceTemplatesJson = json_encode($serviceTemplatesJson, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|
|
||||||
file_put_contents(base_path('templates/service-templates.json'), $serviceTemplatesJson.PHP_EOL);
|
file_put_contents(base_path('templates/service-templates.json'), $serviceTemplatesJson.PHP_EOL);
|
||||||
|
|
||||||
|
return self::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function process_file($file)
|
private function processFile(string $file): false|array
|
||||||
{
|
{
|
||||||
$serviceName = str($file)->before('.yaml')->value();
|
|
||||||
$content = file_get_contents(base_path("templates/compose/$file"));
|
$content = file_get_contents(base_path("templates/compose/$file"));
|
||||||
// $this->info($content);
|
|
||||||
$ignore = collect(preg_grep('/^# ignore:/', explode("\n", $content)))->values();
|
$data = collect(explode(PHP_EOL, $content))->mapWithKeys(function ($line): array {
|
||||||
if ($ignore->count() > 0) {
|
preg_match('/^#(?<key>.*):(?<value>.*)$/U', $line, $m);
|
||||||
$ignore = (bool) str($ignore[0])->after('# ignore:')->trim()->value();
|
|
||||||
} else {
|
return $m ? [trim($m['key']) => trim($m['value'])] : [];
|
||||||
$ignore = false;
|
});
|
||||||
}
|
|
||||||
if ($ignore) {
|
if (str($data->get('ignore'))->toBoolean()) {
|
||||||
$this->info("Ignoring $file");
|
$this->info("Ignoring $file");
|
||||||
|
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->info("Processing $file");
|
$this->info("Processing $file");
|
||||||
$documentation = collect(preg_grep('/^# documentation:/', explode("\n", $content)))->values();
|
|
||||||
if ($documentation->count() > 0) {
|
|
||||||
$documentation = str($documentation[0])->after('# documentation:')->trim()->value();
|
|
||||||
$documentation = str($documentation)->append('?utm_source=coolify.io');
|
|
||||||
} else {
|
|
||||||
$documentation = 'https://coolify.io/docs';
|
|
||||||
}
|
|
||||||
|
|
||||||
$slogan = collect(preg_grep('/^# slogan:/', explode("\n", $content)))->values();
|
$documentation = $data->get('documentation');
|
||||||
if ($slogan->count() > 0) {
|
$documentation = $documentation ? $documentation.'?utm_source=coolify.io' : 'https://coolify.io/docs';
|
||||||
$slogan = str($slogan[0])->after('# slogan:')->trim()->value();
|
|
||||||
} else {
|
|
||||||
$slogan = str($file)->headline()->value();
|
|
||||||
}
|
|
||||||
$logo = collect(preg_grep('/^# logo:/', explode("\n", $content)))->values();
|
|
||||||
if ($logo->count() > 0) {
|
|
||||||
$logo = str($logo[0])->after('# logo:')->trim()->value();
|
|
||||||
} else {
|
|
||||||
$logo = 'svgs/coolify.png';
|
|
||||||
}
|
|
||||||
$minversion = collect(preg_grep('/^# minversion:/', explode("\n", $content)))->values();
|
|
||||||
if ($minversion->count() > 0) {
|
|
||||||
$minversion = str($minversion[0])->after('# minversion:')->trim()->value();
|
|
||||||
} else {
|
|
||||||
$minversion = '0.0.0';
|
|
||||||
}
|
|
||||||
$env_file = collect(preg_grep('/^# env_file:/', explode("\n", $content)))->values();
|
|
||||||
if ($env_file->count() > 0) {
|
|
||||||
$env_file = str($env_file[0])->after('# env_file:')->trim()->value();
|
|
||||||
} else {
|
|
||||||
$env_file = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tags = collect(preg_grep('/^# tags:/', explode("\n", $content)))->values();
|
|
||||||
if ($tags->count() > 0) {
|
|
||||||
$tags = str($tags[0])->after('# tags:')->trim()->explode(',')->map(function ($tag) {
|
|
||||||
return str($tag)->trim()->lower()->value();
|
|
||||||
})->values();
|
|
||||||
} else {
|
|
||||||
$tags = null;
|
|
||||||
}
|
|
||||||
$port = collect(preg_grep('/^# port:/', explode("\n", $content)))->values();
|
|
||||||
if ($port->count() > 0) {
|
|
||||||
$port = str($port[0])->after('# port:')->trim()->value();
|
|
||||||
} else {
|
|
||||||
$port = null;
|
|
||||||
}
|
|
||||||
$json = Yaml::parse($content);
|
$json = Yaml::parse($content);
|
||||||
$yaml = base64_encode(Yaml::dump($json, 10, 2));
|
$compose = base64_encode(Yaml::dump($json, 10, 2));
|
||||||
|
|
||||||
|
$tags = str($data->get('tags'))->lower()->explode(',')->map(fn ($tag) => trim($tag))->filter();
|
||||||
|
$tags = $tags->isEmpty() ? null : $tags->all();
|
||||||
|
|
||||||
$payload = [
|
$payload = [
|
||||||
'name' => $serviceName,
|
'name' => pathinfo($file, PATHINFO_FILENAME),
|
||||||
'documentation' => $documentation,
|
'documentation' => $documentation,
|
||||||
'slogan' => $slogan,
|
'slogan' => $data->get('slogan', str($file)->headline()),
|
||||||
'compose' => $yaml,
|
'compose' => $compose,
|
||||||
'tags' => $tags,
|
'tags' => $tags,
|
||||||
'logo' => $logo,
|
'logo' => $data->get('logo', 'svgs/coolify.png'),
|
||||||
'minversion' => $minversion,
|
'minversion' => $data->get('minversion', '0.0.0'),
|
||||||
];
|
];
|
||||||
if ($port) {
|
|
||||||
|
if ($port = $data->get('port')) {
|
||||||
$payload['port'] = $port;
|
$payload['port'] = $port;
|
||||||
}
|
}
|
||||||
if ($env_file) {
|
|
||||||
$env_file_content = file_get_contents(base_path("templates/compose/$env_file"));
|
if ($envFile = $data->get('env_file')) {
|
||||||
$env_file_base64 = base64_encode($env_file_content);
|
$envFileContent = file_get_contents(base_path("templates/compose/$envFile"));
|
||||||
$payload['envs'] = $env_file_base64;
|
$payload['envs'] = base64_encode($envFileContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payload;
|
return $payload;
|
||||||
|
|||||||
@@ -1213,7 +1213,6 @@ class ApplicationsController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['message' => 'Invalid type.'], 400);
|
return response()->json(['message' => 'Invalid type.'], 400);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Get(
|
#[OA\Get(
|
||||||
@@ -1692,9 +1691,8 @@ class ApplicationsController extends Controller
|
|||||||
'standalone_postgresql_id',
|
'standalone_postgresql_id',
|
||||||
'standalone_redis_id',
|
'standalone_redis_id',
|
||||||
]);
|
]);
|
||||||
$env = $this->removeSensitiveData($env);
|
|
||||||
|
|
||||||
return $env;
|
return $this->removeSensitiveData($env);
|
||||||
});
|
});
|
||||||
|
|
||||||
return response()->json($envs);
|
return response()->json($envs);
|
||||||
@@ -1869,18 +1867,15 @@ class ApplicationsController extends Controller
|
|||||||
|
|
||||||
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
|
return response()->json($this->removeSensitiveData($env))->setStatusCode(201);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Environment variable not found.',
|
'message' => 'Environment variable not found.',
|
||||||
], 404);
|
], 404);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Something is not okay. Are you okay?',
|
'message' => 'Something is not okay. Are you okay?',
|
||||||
], 500);
|
], 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Patch(
|
#[OA\Patch(
|
||||||
@@ -2225,14 +2220,12 @@ class ApplicationsController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'uuid' => $env->uuid,
|
'uuid' => $env->uuid,
|
||||||
])->setStatusCode(201);
|
])->setStatusCode(201);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Something went wrong.',
|
'message' => 'Something went wrong.',
|
||||||
], 500);
|
], 500);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Delete(
|
#[OA\Delete(
|
||||||
@@ -2580,7 +2573,6 @@ class ApplicationsController extends Controller
|
|||||||
'deployment_uuid' => $deployment_uuid->toString(),
|
'deployment_uuid' => $deployment_uuid->toString(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Post(
|
#[OA\Post(
|
||||||
@@ -2746,7 +2738,6 @@ class ApplicationsController extends Controller
|
|||||||
'custom_labels' => 'The custom_labels should be base64 encoded.',
|
'custom_labels' => 'The custom_labels should be base64 encoded.',
|
||||||
],
|
],
|
||||||
], 422);
|
], 422);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($request->has('domains') && $server->isProxyShouldRun()) {
|
if ($request->has('domains') && $server->isProxyShouldRun()) {
|
||||||
|
|||||||
@@ -471,7 +471,6 @@ class DatabasesController extends Controller
|
|||||||
$request->offsetSet('mysql_conf', $mysqlConf);
|
$request->offsetSet('mysql_conf', $mysqlConf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
|
$extraFields = array_diff(array_keys($request->all()), $allowedFields);
|
||||||
if ($validator->fails() || ! empty($extraFields)) {
|
if ($validator->fails() || ! empty($extraFields)) {
|
||||||
@@ -506,7 +505,6 @@ class DatabasesController extends Controller
|
|||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Database updated.',
|
'message' => 'Database updated.',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Post(
|
#[OA\Post(
|
||||||
@@ -1165,7 +1163,6 @@ class DatabasesController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(serializeApiResponse($payload))->setStatusCode(201);
|
return response()->json(serializeApiResponse($payload))->setStatusCode(201);
|
||||||
|
|
||||||
} elseif ($type === NewDatabaseTypes::MARIADB) {
|
} elseif ($type === NewDatabaseTypes::MARIADB) {
|
||||||
$allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database'];
|
$allowedFields = ['name', 'description', 'image', 'public_port', 'is_public', 'project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'instant_deploy', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'mariadb_conf', 'mariadb_root_password', 'mariadb_user', 'mariadb_password', 'mariadb_database'];
|
||||||
$validator = customApiValidator($request->all(), [
|
$validator = customApiValidator($request->all(), [
|
||||||
@@ -1826,6 +1823,5 @@ class DatabasesController extends Controller
|
|||||||
],
|
],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,7 +356,6 @@ class ProjectController extends Controller
|
|||||||
'name' => $project->name,
|
'name' => $project->name,
|
||||||
'description' => $project->description,
|
'description' => $project->description,
|
||||||
])->setStatusCode(201);
|
])->setStatusCode(201);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[OA\Delete(
|
#[OA\Delete(
|
||||||
|
|||||||
@@ -566,9 +566,8 @@ class ServicesController extends Controller
|
|||||||
'standalone_postgresql_id',
|
'standalone_postgresql_id',
|
||||||
'standalone_redis_id',
|
'standalone_redis_id',
|
||||||
]);
|
]);
|
||||||
$env = $this->removeSensitiveData($env);
|
|
||||||
|
|
||||||
return $env;
|
return $this->removeSensitiveData($env);
|
||||||
});
|
});
|
||||||
|
|
||||||
return response()->json($envs);
|
return response()->json($envs);
|
||||||
@@ -1238,6 +1237,5 @@ class ServicesController extends Controller
|
|||||||
],
|
],
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace App\Http\Controllers;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\UploadedFile;
|
use Illuminate\Http\UploadedFile;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Pion\Laravel\ChunkUpload\Exceptions\UploadMissingFileException;
|
use Pion\Laravel\ChunkUpload\Exceptions\UploadMissingFileException;
|
||||||
use Pion\Laravel\ChunkUpload\Handler\HandlerFactory;
|
use Pion\Laravel\ChunkUpload\Handler\HandlerFactory;
|
||||||
use Pion\Laravel\ChunkUpload\Receiver\FileReceiver;
|
use Pion\Laravel\ChunkUpload\Receiver\FileReceiver;
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ class Gitea extends Controller
|
|||||||
'pull_request_html_url' => $pull_request_html_url,
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ use App\Models\Webhook;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Sleep;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Stripe extends Controller
|
class Stripe extends Controller
|
||||||
@@ -64,22 +63,18 @@ class Stripe extends Controller
|
|||||||
$piData = $stripe->paymentIntents->retrieve($pi, []);
|
$piData = $stripe->paymentIntents->retrieve($pi, []);
|
||||||
$customerId = data_get($piData, 'customer');
|
$customerId = data_get($piData, 'customer');
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
if (! $subscription) {
|
|
||||||
Sleep::for(5)->seconds();
|
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
|
||||||
}
|
|
||||||
if (! $subscription) {
|
|
||||||
Sleep::for(5)->seconds();
|
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
|
||||||
}
|
|
||||||
if ($subscription) {
|
if ($subscription) {
|
||||||
$subscriptionId = data_get($subscription, 'stripe_subscription_id');
|
$subscriptionId = data_get($subscription, 'stripe_subscription_id');
|
||||||
$stripe->subscriptions->cancel($subscriptionId, []);
|
$stripe->subscriptions->cancel($subscriptionId, []);
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
'stripe_invoice_paid' => false,
|
'stripe_invoice_paid' => false,
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
send_internal_notification("Early fraud warning created Refunded, subscription canceled. Charge: {$charge}, id: {$id}, pi: {$pi}");
|
send_internal_notification("Early fraud warning created Refunded, subscription canceled. Charge: {$charge}, id: {$id}, pi: {$pi}");
|
||||||
|
} else {
|
||||||
|
send_internal_notification("Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}");
|
||||||
|
|
||||||
|
return response("Early fraud warning: subscription not found. Charge: {$charge}, id: {$id}, pi: {$pi}", 400);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'checkout.session.completed':
|
case 'checkout.session.completed':
|
||||||
$clientReferenceId = data_get($data, 'client_reference_id');
|
$clientReferenceId = data_get($data, 'client_reference_id');
|
||||||
@@ -95,7 +90,8 @@ class Stripe extends Controller
|
|||||||
$found = $team->members->where('id', $userId)->first();
|
$found = $team->members->where('id', $userId)->first();
|
||||||
if (! $found->isAdmin()) {
|
if (! $found->isAdmin()) {
|
||||||
send_internal_notification("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}, subscriptionid: {$subscriptionId}.");
|
send_internal_notification("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}, subscriptionid: {$subscriptionId}.");
|
||||||
throw new Exception("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}, subscriptionid: {$subscriptionId}.");
|
|
||||||
|
return response("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}, subscriptionid: {$subscriptionId}.", 400);
|
||||||
}
|
}
|
||||||
$subscription = Subscription::where('team_id', $teamId)->first();
|
$subscription = Subscription::where('team_id', $teamId)->first();
|
||||||
if ($subscription) {
|
if ($subscription) {
|
||||||
@@ -123,13 +119,13 @@ class Stripe extends Controller
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
if (! $subscription) {
|
if ($subscription) {
|
||||||
Sleep::for(5)->seconds();
|
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
|
||||||
}
|
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
'stripe_invoice_paid' => true,
|
'stripe_invoice_paid' => true,
|
||||||
]);
|
]);
|
||||||
|
} else {
|
||||||
|
return response("No subscription found for customer: {$customerId}", 400);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'invoice.payment_failed':
|
case 'invoice.payment_failed':
|
||||||
$customerId = data_get($data, 'customer');
|
$customerId = data_get($data, 'customer');
|
||||||
@@ -167,7 +163,42 @@ class Stripe extends Controller
|
|||||||
}
|
}
|
||||||
send_internal_notification('Subscription payment failed for customer: '.$customerId);
|
send_internal_notification('Subscription payment failed for customer: '.$customerId);
|
||||||
break;
|
break;
|
||||||
|
case 'customer.subscription.created':
|
||||||
|
$customerId = data_get($data, 'customer');
|
||||||
|
$subscriptionId = data_get($data, 'id');
|
||||||
|
$teamId = data_get($data, 'metadata.team_id');
|
||||||
|
$userId = data_get($data, 'metadata.user_id');
|
||||||
|
if (! $teamId || ! $userId) {
|
||||||
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
|
if ($subscription) {
|
||||||
|
return response("Subscription already exists for customer: {$customerId}", 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response('No team id or user id found', 400);
|
||||||
|
}
|
||||||
|
$team = Team::find($teamId);
|
||||||
|
$found = $team->members->where('id', $userId)->first();
|
||||||
|
if (! $found->isAdmin()) {
|
||||||
|
send_internal_notification("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.");
|
||||||
|
|
||||||
|
return response("User {$userId} is not an admin or owner of team {$team->id}, customerid: {$customerId}.", 400);
|
||||||
|
}
|
||||||
|
$subscription = Subscription::where('team_id', $teamId)->first();
|
||||||
|
if ($subscription) {
|
||||||
|
return response("Subscription already exists for team: {$teamId}", 200);
|
||||||
|
} else {
|
||||||
|
Subscription::create([
|
||||||
|
'team_id' => $teamId,
|
||||||
|
'stripe_subscription_id' => $subscriptionId,
|
||||||
|
'stripe_customer_id' => $customerId,
|
||||||
|
'stripe_invoice_paid' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return response('Subscription created');
|
||||||
|
}
|
||||||
case 'customer.subscription.updated':
|
case 'customer.subscription.updated':
|
||||||
|
$teamId = data_get($data, 'metadata.team_id');
|
||||||
|
$userId = data_get($data, 'metadata.user_id');
|
||||||
$customerId = data_get($data, 'customer');
|
$customerId = data_get($data, 'customer');
|
||||||
$status = data_get($data, 'status');
|
$status = data_get($data, 'status');
|
||||||
$subscriptionId = data_get($data, 'items.data.0.subscription');
|
$subscriptionId = data_get($data, 'items.data.0.subscription');
|
||||||
@@ -177,32 +208,27 @@ class Stripe extends Controller
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
||||||
if (! $subscription) {
|
|
||||||
Sleep::for(5)->seconds();
|
|
||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->first();
|
|
||||||
}
|
|
||||||
if (! $subscription) {
|
if (! $subscription) {
|
||||||
if ($status === 'incomplete_expired') {
|
if ($status === 'incomplete_expired') {
|
||||||
// send_internal_notification('Subscription incomplete expired for customer: '.$customerId);
|
|
||||||
|
|
||||||
return response('Subscription incomplete expired', 200);
|
return response('Subscription incomplete expired', 200);
|
||||||
}
|
}
|
||||||
// send_internal_notification('No subscription found for: '.$customerId);
|
if ($teamId) {
|
||||||
|
$subscription = Subscription::create([
|
||||||
return response('No subscription found', 400);
|
'team_id' => $teamId,
|
||||||
|
'stripe_subscription_id' => $subscriptionId,
|
||||||
|
'stripe_customer_id' => $customerId,
|
||||||
|
'stripe_invoice_paid' => false,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return response('No subscription and team id found', 400);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$trialEndedAlready = data_get($subscription, 'stripe_trial_already_ended');
|
|
||||||
$cancelAtPeriodEnd = data_get($data, 'cancel_at_period_end');
|
$cancelAtPeriodEnd = data_get($data, 'cancel_at_period_end');
|
||||||
$alreadyCancelAtPeriodEnd = data_get($subscription, 'stripe_cancel_at_period_end');
|
|
||||||
$feedback = data_get($data, 'cancellation_details.feedback');
|
$feedback = data_get($data, 'cancellation_details.feedback');
|
||||||
$comment = data_get($data, 'cancellation_details.comment');
|
$comment = data_get($data, 'cancellation_details.comment');
|
||||||
$lookup_key = data_get($data, 'items.data.0.price.lookup_key');
|
$lookup_key = data_get($data, 'items.data.0.price.lookup_key');
|
||||||
if (str($lookup_key)->contains('ultimate') || str($lookup_key)->contains('dynamic')) {
|
|
||||||
if (str($lookup_key)->contains('dynamic')) {
|
if (str($lookup_key)->contains('dynamic')) {
|
||||||
$quantity = data_get($data, 'items.data.0.quantity', 2);
|
$quantity = data_get($data, 'items.data.0.quantity', 2);
|
||||||
} else {
|
|
||||||
$quantity = data_get($data, 'items.data.0.quantity', 10);
|
|
||||||
}
|
|
||||||
$team = data_get($subscription, 'team');
|
$team = data_get($subscription, 'team');
|
||||||
if ($team) {
|
if ($team) {
|
||||||
$team->update([
|
$team->update([
|
||||||
@@ -221,28 +247,12 @@ class Stripe extends Controller
|
|||||||
$subscription->update([
|
$subscription->update([
|
||||||
'stripe_invoice_paid' => false,
|
'stripe_invoice_paid' => false,
|
||||||
]);
|
]);
|
||||||
// send_internal_notification('Subscription paused or incomplete for customer: '.$customerId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trial ended but subscribed, reactive servers
|
|
||||||
if ($trialEndedAlready && $status === 'active') {
|
|
||||||
$team = data_get($subscription, 'team');
|
|
||||||
$team->trialEndedButSubscribed();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($feedback) {
|
if ($feedback) {
|
||||||
$reason = "Cancellation feedback for {$customerId}: '".$feedback."'";
|
$reason = "Cancellation feedback for {$customerId}: '".$feedback."'";
|
||||||
if ($comment) {
|
if ($comment) {
|
||||||
$reason .= ' with comment: \''.$comment."'";
|
$reason .= ' with comment: \''.$comment."'";
|
||||||
}
|
}
|
||||||
// send_internal_notification($reason);
|
|
||||||
}
|
|
||||||
if ($alreadyCancelAtPeriodEnd !== $cancelAtPeriodEnd) {
|
|
||||||
if ($cancelAtPeriodEnd) {
|
|
||||||
// send_internal_notification('Subscription cancelled at period end for team: ' . $subscription->team->id);
|
|
||||||
} else {
|
|
||||||
// send_internal_notification('customer.subscription.updated for customer: '.$customerId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'customer.subscription.deleted':
|
case 'customer.subscription.deleted':
|
||||||
@@ -268,7 +278,7 @@ class Stripe extends Controller
|
|||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
||||||
$team = data_get($subscription, 'team');
|
$team = data_get($subscription, 'team');
|
||||||
if (! $team) {
|
if (! $team) {
|
||||||
throw new Exception('No team found for subscription: '.$subscription->id);
|
return response('No team found for subscription: '.$subscription->id, 400);
|
||||||
}
|
}
|
||||||
SubscriptionTrialEndsSoonJob::dispatch($team);
|
SubscriptionTrialEndsSoonJob::dispatch($team);
|
||||||
break;
|
break;
|
||||||
@@ -277,7 +287,7 @@ class Stripe extends Controller
|
|||||||
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
$subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail();
|
||||||
$team = data_get($subscription, 'team');
|
$team = data_get($subscription, 'team');
|
||||||
if (! $team) {
|
if (! $team) {
|
||||||
throw new Exception('No team found for subscription: '.$subscription->id);
|
return response('No team found for subscription: '.$subscription->id, 400);
|
||||||
}
|
}
|
||||||
$team->trialEnded();
|
$team->trialEnded();
|
||||||
$subscription->update([
|
$subscription->update([
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class CheckHelperImageJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$settings->update(['helper_version' => $latest_version]);
|
$settings->update(['helper_version' => $latest_version]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('CheckHelperImageJob failed with: '.$e->getMessage());
|
send_internal_notification('CheckHelperImageJob failed with: '.$e->getMessage());
|
||||||
throw $e;
|
throw $e;
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->postgres_password) {
|
if ($this->postgres_password) {
|
||||||
$this->postgres_password = str($this->postgres_password)->after('POSTGRES_PASSWORD=')->value();
|
$this->postgres_password = str($this->postgres_password)->after('POSTGRES_PASSWORD=')->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
} elseif (str($databaseType)->contains('mysql')) {
|
} elseif (str($databaseType)->contains('mysql')) {
|
||||||
$this->container_name = "{$this->database->name}-$serviceUuid";
|
$this->container_name = "{$this->database->name}-$serviceUuid";
|
||||||
$this->directory_name = $serviceName.'-'.$this->container_name;
|
$this->directory_name = $serviceName.'-'.$this->container_name;
|
||||||
|
|||||||
@@ -167,7 +167,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->foundServiceDatabaseIds->push($subId);
|
$this->foundServiceDatabaseIds->push($subId);
|
||||||
$this->updateServiceSubStatus($serviceId, $subType, $subId, $containerStatus);
|
$this->updateServiceSubStatus($serviceId, $subType, $subId, $containerStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$uuid = $labels->get('com.docker.compose.service');
|
$uuid = $labels->get('com.docker.compose.service');
|
||||||
$type = $labels->get('coolify.type');
|
$type = $labels->get('coolify.type');
|
||||||
@@ -265,7 +264,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
|
instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateDatabaseStatus(string $databaseUuid, string $containerStatus, bool $tcpProxy = false)
|
private function updateDatabaseStatus(string $databaseUuid, string $containerStatus, bool $tcpProxy = false)
|
||||||
|
|||||||
@@ -54,13 +54,9 @@ class ScheduledTaskJob implements ShouldQueue
|
|||||||
private function getServerTimezone(): string
|
private function getServerTimezone(): string
|
||||||
{
|
{
|
||||||
if ($this->resource instanceof Application) {
|
if ($this->resource instanceof Application) {
|
||||||
$timezone = $this->resource->destination->server->settings->server_timezone;
|
return $this->resource->destination->server->settings->server_timezone;
|
||||||
|
|
||||||
return $timezone;
|
|
||||||
} elseif ($this->resource instanceof Service) {
|
} elseif ($this->resource instanceof Service) {
|
||||||
$timezone = $this->resource->server->settings->server_timezone;
|
return $this->resource->server->settings->server_timezone;
|
||||||
|
|
||||||
return $timezone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'UTC';
|
return 'UTC';
|
||||||
@@ -68,7 +64,6 @@ class ScheduledTaskJob implements ShouldQueue
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->task_log = ScheduledTaskExecution::create([
|
$this->task_log = ScheduledTaskExecution::create([
|
||||||
'scheduled_task_id' => $this->task->id,
|
'scheduled_task_id' => $this->task->id,
|
||||||
@@ -76,14 +71,14 @@ class ScheduledTaskJob implements ShouldQueue
|
|||||||
|
|
||||||
$this->server = $this->resource->destination->server;
|
$this->server = $this->resource->destination->server;
|
||||||
|
|
||||||
if ($this->resource->type() == 'application') {
|
if ($this->resource->type() === 'application') {
|
||||||
$containers = getCurrentApplicationContainerStatus($this->server, $this->resource->id, 0);
|
$containers = getCurrentApplicationContainerStatus($this->server, $this->resource->id, 0);
|
||||||
if ($containers->count() > 0) {
|
if ($containers->count() > 0) {
|
||||||
$containers->each(function ($container) {
|
$containers->each(function ($container) {
|
||||||
$this->containers[] = str_replace('/', '', $container['Names']);
|
$this->containers[] = str_replace('/', '', $container['Names']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} elseif ($this->resource->type() == 'service') {
|
} elseif ($this->resource->type() === 'service') {
|
||||||
$this->resource->applications()->get()->each(function ($application) {
|
$this->resource->applications()->get()->each(function ($application) {
|
||||||
if (str(data_get($application, 'status'))->contains('running')) {
|
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');
|
||||||
|
|||||||
@@ -94,11 +94,9 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkLogDrainContainer()
|
private function checkLogDrainContainer()
|
||||||
|
|||||||
@@ -33,10 +33,8 @@ class ServerCleanupMux implements ShouldBeEncrypted, ShouldQueue
|
|||||||
return 'Server is not reachable or not ready.';
|
return 'Server is not reachable or not ready.';
|
||||||
}
|
}
|
||||||
SshMultiplexingHelper::removeMuxFile($this->server);
|
SshMultiplexingHelper::removeMuxFile($this->server);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,8 @@ class ServerStorageCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
} else {
|
} else {
|
||||||
RateLimiter::hit('high-disk-usage:'.$this->server->id, 600);
|
RateLimiter::hit('high-disk-usage:'.$this->server->id, 600);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class UpdateCoolifyJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
$settings->update(['new_version_available' => false]);
|
$settings->update(['new_version_available' => false]);
|
||||||
Log::info('Coolify update completed successfully.');
|
Log::info('Coolify update completed successfully.');
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Log::error('UpdateCoolifyJob failed: '.$e->getMessage());
|
Log::error('UpdateCoolifyJob failed: '.$e->getMessage());
|
||||||
// Consider implementing a notification to administrators
|
// Consider implementing a notification to administrators
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
use App\Enums\ProcessStatus;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
use Spatie\Activitylog\Models\Activity;
|
use Spatie\Activitylog\Models\Activity;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Discord extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->team->discord_enabled = false;
|
$this->team->discord_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Telegram extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->team->telegram_enabled = false;
|
$this->team->telegram_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class Show extends Component
|
|||||||
{
|
{
|
||||||
$this->dispatch('deploymentFinished');
|
$this->dispatch('deploymentFinished');
|
||||||
$this->application_deployment_queue->refresh();
|
$this->application_deployment_queue->refresh();
|
||||||
if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
|
if (data_get($this->application_deployment_queue, 'status') === 'finished' || data_get($this->application_deployment_queue, 'status') === 'failed') {
|
||||||
$this->isKeepAliveOn = false;
|
$this->isKeepAliveOn = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Form extends Component
|
|||||||
$url = Url::fromString($firstFqdn);
|
$url = Url::fromString($firstFqdn);
|
||||||
$host = $url->getHost();
|
$host = $url->getHost();
|
||||||
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
|
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$this->dispatch('error', 'Invalid FQDN.');
|
$this->dispatch('error', 'Invalid FQDN.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Livewire\Project\Application;
|
|||||||
use App\Actions\Docker\GetContainersStatus;
|
use App\Actions\Docker\GetContainersStatus;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationPreview;
|
use App\Models\ApplicationPreview;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Process\InvokedProcess;
|
use Illuminate\Process\InvokedProcess;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
@@ -239,7 +240,7 @@ class Previews extends Component
|
|||||||
$processes[$containerName] = $this->stopContainer($containerName, $timeout);
|
$processes[$containerName] = $this->stopContainer($containerName, $timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
$startTime = time();
|
$startTime = Carbon::now()->getTimestamp();
|
||||||
while (count($processes) > 0) {
|
while (count($processes) > 0) {
|
||||||
$finishedProcesses = array_filter($processes, function ($process) {
|
$finishedProcesses = array_filter($processes, function ($process) {
|
||||||
return ! $process->running();
|
return ! $process->running();
|
||||||
@@ -249,7 +250,7 @@ class Previews extends Component
|
|||||||
$this->removeContainer($containerName, $server);
|
$this->removeContainer($containerName, $server);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (time() - $startTime >= $timeout) {
|
if (Carbon::now()->getTimestamp() - $startTime >= $timeout) {
|
||||||
$this->forceStopRemainingContainers(array_keys($processes), $server);
|
$this->forceStopRemainingContainers(array_keys($processes), $server);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class BackupEdit extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->custom_validate();
|
$this->custom_validate();
|
||||||
if ($this->backup->databases_to_backup == '' || $this->backup->databases_to_backup === null) {
|
if ($this->backup->databases_to_backup === '' || $this->backup->databases_to_backup === null) {
|
||||||
$this->backup->databases_to_backup = null;
|
$this->backup->databases_to_backup = null;
|
||||||
}
|
}
|
||||||
$this->backup->save();
|
$this->backup->save();
|
||||||
|
|||||||
@@ -119,9 +119,8 @@ class BackupExecutions extends Component
|
|||||||
if (! $server) {
|
if (! $server) {
|
||||||
return 'UTC';
|
return 'UTC';
|
||||||
}
|
}
|
||||||
$serverTimezone = $server->settings->server_timezone;
|
|
||||||
|
|
||||||
return $serverTimezone;
|
return $server->settings->server_timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function formatDateInServerTimezone($date)
|
public function formatDateInServerTimezone($date)
|
||||||
@@ -130,7 +129,7 @@ class BackupExecutions extends Component
|
|||||||
$dateObj = new \DateTime($date);
|
$dateObj = new \DateTime($date);
|
||||||
try {
|
try {
|
||||||
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,10 @@ class Import extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneRedis::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneRedis::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneKeydb::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneKeydb::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneDragonfly::class ||
|
$this->resource->getMorphClass() === \App\Models\StandaloneDragonfly::class ||
|
||||||
$this->resource->getMorphClass() == \App\Models\StandaloneClickhouse::class
|
$this->resource->getMorphClass() === \App\Models\StandaloneClickhouse::class
|
||||||
) {
|
) {
|
||||||
$this->unsupported = true;
|
$this->unsupported = true;
|
||||||
}
|
}
|
||||||
@@ -88,8 +88,7 @@ class Import extends Component
|
|||||||
|
|
||||||
public function runImport()
|
public function runImport()
|
||||||
{
|
{
|
||||||
|
if ($this->filename === '') {
|
||||||
if ($this->filename == '') {
|
|
||||||
$this->dispatch('error', 'Please select a file to import.');
|
$this->dispatch('error', 'Please select a file to import.');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ class General extends Component
|
|||||||
$this->db_url = $this->database->internal_db_url;
|
$this->db_url = $this->database->internal_db_url;
|
||||||
$this->db_url_public = $this->database->external_db_url;
|
$this->db_url_public = $this->database->external_db_url;
|
||||||
$this->server = data_get($this->database, 'destination.server');
|
$this->server = data_get($this->database, 'destination.server');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instantSaveAdvanced()
|
public function instantSaveAdvanced()
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ class General extends Component
|
|||||||
$this->db_url = $this->database->internal_db_url;
|
$this->db_url = $this->database->internal_db_url;
|
||||||
$this->db_url_public = $this->database->external_db_url;
|
$this->db_url_public = $this->database->external_db_url;
|
||||||
$this->server = data_get($this->database, 'destination.server');
|
$this->server = data_get($this->database, 'destination.server');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instantSaveAdvanced()
|
public function instantSaveAdvanced()
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class General extends Component
|
|||||||
$this->db_url = $this->database->internal_db_url;
|
$this->db_url = $this->database->internal_db_url;
|
||||||
$this->db_url_public = $this->database->external_db_url;
|
$this->db_url_public = $this->database->external_db_url;
|
||||||
$this->server = data_get($this->database, 'destination.server');
|
$this->server = data_get($this->database, 'destination.server');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instantSaveAdvanced()
|
public function instantSaveAdvanced()
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class GithubPrivateRepositoryDeployKey extends Component
|
|||||||
$this->git_host = $this->repository_url_parsed->getHost();
|
$this->git_host = $this->repository_url_parsed->getHost();
|
||||||
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
$this->git_repository = $this->repository_url_parsed->getSegment(1).'/'.$this->repository_url_parsed->getSegment(2);
|
||||||
|
|
||||||
if ($this->git_host == 'github.com') {
|
if ($this->git_host === 'github.com') {
|
||||||
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ class PublicGitRepository extends Component
|
|||||||
$this->base_directory = '/'.$this->base_directory;
|
$this->base_directory = '/'.$this->base_directory;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedDockerComposeLocation()
|
public function updatedDockerComposeLocation()
|
||||||
@@ -174,7 +173,7 @@ class PublicGitRepository extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! $this->branchFound && $this->git_branch == 'main') {
|
if (! $this->branchFound && $this->git_branch === 'main') {
|
||||||
try {
|
try {
|
||||||
$this->git_branch = 'master';
|
$this->git_branch = 'master';
|
||||||
$this->getBranch();
|
$this->getBranch();
|
||||||
@@ -197,7 +196,7 @@ class PublicGitRepository extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->git_branch = 'main';
|
$this->git_branch = 'main';
|
||||||
}
|
}
|
||||||
if ($this->git_host == 'github.com') {
|
if ($this->git_host === 'github.com') {
|
||||||
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
$this->git_source = GithubApp::where('name', 'Public GitHub')->first();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ class Create extends Component
|
|||||||
'is_preview' => false,
|
'is_preview' => false,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
$service->parse(isNew: true);
|
$service->parse(isNew: true);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class Database extends Component
|
|||||||
$this->database->save();
|
$this->database->save();
|
||||||
updateCompose($this->database);
|
updateCompose($this->database);
|
||||||
$this->dispatch('success', 'Database saved.');
|
$this->dispatch('success', 'Database saved.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
} finally {
|
} finally {
|
||||||
$this->dispatch('generateDockerCompose');
|
$this->dispatch('generateDockerCompose');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ class Index extends Component
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateDockerCompose()
|
public function generateDockerCompose()
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Navbar extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->isDeploymentProgress = false;
|
$this->isDeploymentProgress = false;
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->isDeploymentProgress = false;
|
$this->isDeploymentProgress = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,32 +62,21 @@ class Danger extends Component
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($this->resource->type()) {
|
$this->resourceName = match ($this->resource->type()) {
|
||||||
case 'application':
|
'application' => $this->resource->name ?? 'Application',
|
||||||
$this->resourceName = $this->resource->name ?? 'Application';
|
'standalone-postgresql',
|
||||||
break;
|
'standalone-redis',
|
||||||
case 'standalone-postgresql':
|
'standalone-mongodb',
|
||||||
case 'standalone-redis':
|
'standalone-mysql',
|
||||||
case 'standalone-mongodb':
|
'standalone-mariadb',
|
||||||
case 'standalone-mysql':
|
'standalone-keydb',
|
||||||
case 'standalone-mariadb':
|
'standalone-dragonfly',
|
||||||
case 'standalone-keydb':
|
'standalone-clickhouse' => $this->resource->name ?? 'Database',
|
||||||
case 'standalone-dragonfly':
|
'service' => $this->resource->name ?? 'Service',
|
||||||
case 'standalone-clickhouse':
|
'service-application' => $this->resource->name ?? 'Service Application',
|
||||||
$this->resourceName = $this->resource->name ?? 'Database';
|
'service-database' => $this->resource->name ?? 'Service Database',
|
||||||
break;
|
default => 'Unknown Resource',
|
||||||
case 'service':
|
};
|
||||||
$this->resourceName = $this->resource->name ?? 'Service';
|
|
||||||
break;
|
|
||||||
case 'service-application':
|
|
||||||
$this->resourceName = $this->resource->name ?? 'Service Application';
|
|
||||||
break;
|
|
||||||
case 'service-database':
|
|
||||||
$this->resourceName = $this->resource->name ?? 'Service Database';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$this->resourceName = 'Unknown Resource';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($password)
|
public function delete($password)
|
||||||
|
|||||||
@@ -132,7 +132,6 @@ class ExecuteContainerCommand extends Component
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($this->containers->count() > 0) {
|
if ($this->containers->count() > 0) {
|
||||||
$this->container = $this->containers->first();
|
$this->container = $this->containers->first();
|
||||||
@@ -155,7 +154,6 @@ class ExecuteContainerCommand extends Component
|
|||||||
data_get($this->server, 'name'),
|
data_get($this->server, 'name'),
|
||||||
data_get($this->server, 'uuid')
|
data_get($this->server, 'uuid')
|
||||||
);
|
);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
@@ -185,7 +183,6 @@ class ExecuteContainerCommand extends Component
|
|||||||
data_get($container, 'container.Names'),
|
data_get($container, 'container.Names'),
|
||||||
data_get($container, 'server.uuid')
|
data_get($container, 'server.uuid')
|
||||||
);
|
);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,9 +109,7 @@ class Logs extends Component
|
|||||||
$this->containers = $this->containers->filter(function ($container) {
|
$this->containers = $this->containers->filter(function ($container) {
|
||||||
return str_contains($container, $this->query['pull_request_id']);
|
return str_contains($container, $this->query['pull_request_id']);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ class ResourceOperations extends Component
|
|||||||
|
|
||||||
return redirect()->to($route);
|
return redirect()->to($route);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveTo($environment_id)
|
public function moveTo($environment_id)
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class Add extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (empty($this->container) || $this->container == 'null') {
|
if (empty($this->container) || $this->container === 'null') {
|
||||||
if ($this->type == 'service') {
|
if ($this->type === 'service') {
|
||||||
$this->container = $this->subServiceName;
|
$this->container = $this->subServiceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,10 @@ class All extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
if ($this->resource->type() == 'service') {
|
if ($this->resource->type() === 'service') {
|
||||||
$this->containerNames = $this->resource->applications()->pluck('name');
|
$this->containerNames = $this->resource->applications()->pluck('name');
|
||||||
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
$this->containerNames = $this->containerNames->merge($this->resource->databases()->pluck('name'));
|
||||||
} elseif ($this->resource->type() == 'application') {
|
} elseif ($this->resource->type() === 'application') {
|
||||||
if ($this->resource->build_pack === 'dockercompose') {
|
if ($this->resource->build_pack === 'dockercompose') {
|
||||||
$parsed = $this->resource->parse();
|
$parsed = $this->resource->parse();
|
||||||
$containers = collect(data_get($parsed, 'services'))->keys();
|
$containers = collect(data_get($parsed, 'services'))->keys();
|
||||||
|
|||||||
@@ -54,9 +54,8 @@ class Executions extends Component
|
|||||||
if (! $server) {
|
if (! $server) {
|
||||||
return 'UTC';
|
return 'UTC';
|
||||||
}
|
}
|
||||||
$serverTimezone = $server->settings->server_timezone;
|
|
||||||
|
|
||||||
return $serverTimezone;
|
return $server->settings->server_timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function formatDateInServerTimezone($date)
|
public function formatDateInServerTimezone($date)
|
||||||
@@ -65,7 +64,7 @@ class Executions extends Component
|
|||||||
$dateObj = new \DateTime($date);
|
$dateObj = new \DateTime($date);
|
||||||
try {
|
try {
|
||||||
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class Show extends Component
|
|||||||
try {
|
try {
|
||||||
$this->task->delete();
|
$this->task->delete();
|
||||||
|
|
||||||
if ($this->type == 'application') {
|
if ($this->type === 'application') {
|
||||||
return redirect()->route('project.application.configuration', $this->parameters, $this->scheduledTaskName);
|
return redirect()->route('project.application.configuration', $this->parameters, $this->scheduledTaskName);
|
||||||
} else {
|
} else {
|
||||||
return redirect()->route('project.service.configuration', $this->parameters, $this->scheduledTaskName);
|
return redirect()->route('project.service.configuration', $this->parameters, $this->scheduledTaskName);
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ class Add extends Component
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitFileStorageDirectory()
|
public function submitFileStorageDirectory()
|
||||||
@@ -127,7 +126,6 @@ class Add extends Component
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitPersistentVolume()
|
public function submitPersistentVolume()
|
||||||
@@ -144,7 +142,6 @@ class Add extends Component
|
|||||||
'mount_path' => $this->mount_path,
|
'mount_path' => $this->mount_path,
|
||||||
'host_path' => $this->host_path,
|
'host_path' => $this->host_path,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ class Terminal extends Component
|
|||||||
#[On('send-terminal-command')]
|
#[On('send-terminal-command')]
|
||||||
public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
|
public function sendTerminalCommand($isContainer, $identifier, $serverUuid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail();
|
$server = Server::ownedByCurrentTeam()->whereUuid($serverUuid)->firstOrFail();
|
||||||
|
|
||||||
if ($isContainer) {
|
if ($isContainer) {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class UploadConfig extends Component
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Show extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
|
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Advanced extends Component
|
|||||||
$this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
|
$this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
$this->syncData();
|
$this->syncData();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return redirect()->route('server.show');
|
return redirect()->route('server.show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ class Charts extends Component
|
|||||||
$this->dispatch("refreshChartData-{$this->chartId}-memory", [
|
$this->dispatch("refreshChartData-{$this->chartId}-memory", [
|
||||||
'seriesData' => $memoryMetrics,
|
'seriesData' => $memoryMetrics,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ class Form extends Component
|
|||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray();
|
$this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray();
|
||||||
$this->wildcard_domain = $this->server->settings->wildcard_domain;
|
$this->wildcard_domain = $this->server->settings->wildcard_domain;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkSyncStatus()
|
public function checkSyncStatus()
|
||||||
@@ -169,7 +168,6 @@ class Form extends Component
|
|||||||
public function instantSave()
|
public function instantSave()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->validate();
|
$this->validate();
|
||||||
refresh_server_connection($this->server->privateKey);
|
refresh_server_connection($this->server->privateKey);
|
||||||
$this->validateServer(false);
|
$this->validateServer(false);
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ class LogDrains extends Component
|
|||||||
|
|
||||||
public function syncData(bool $toModel = false)
|
public function syncData(bool $toModel = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($toModel) {
|
if ($toModel) {
|
||||||
$this->validate();
|
$this->validate();
|
||||||
$this->server->settings->is_logdrain_newrelic_enabled = $this->isLogDrainNewRelicEnabled;
|
$this->server->settings->is_logdrain_newrelic_enabled = $this->isLogDrainNewRelicEnabled;
|
||||||
@@ -78,7 +77,6 @@ class LogDrains extends Component
|
|||||||
$this->logDrainCustomConfig = $this->server->settings->logdrain_custom_config;
|
$this->logDrainCustomConfig = $this->server->settings->logdrain_custom_config;
|
||||||
$this->logDrainCustomConfigParser = $this->server->settings->logdrain_custom_config_parser;
|
$this->logDrainCustomConfigParser = $this->server->settings->logdrain_custom_config_parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function instantSave()
|
public function instantSave()
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ class Proxy extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->dispatch('traefikDashboardAvailable', false);
|
$this->dispatch('traefikDashboardAvailable', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Actions\Proxy\CheckProxy;
|
|||||||
use App\Actions\Proxy\StartProxy;
|
use App\Actions\Proxy\StartProxy;
|
||||||
use App\Events\ProxyStatusChanged;
|
use App\Events\ProxyStatusChanged;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Process\InvokedProcess;
|
use Illuminate\Process\InvokedProcess;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@@ -102,9 +103,9 @@ class Deploy extends Component
|
|||||||
|
|
||||||
$process = $this->stopContainer($containerName, $timeout);
|
$process = $this->stopContainer($containerName, $timeout);
|
||||||
|
|
||||||
$startTime = time();
|
$startTime = Carbon::now()->getTimestamp();
|
||||||
while ($process->running()) {
|
while ($process->running()) {
|
||||||
if (time() - $startTime >= $timeout) {
|
if (Carbon::now()->getTimestamp() - $startTime >= $timeout) {
|
||||||
$this->forceStopContainer($containerName);
|
$this->forceStopContainer($containerName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ class SettingsEmail extends Component
|
|||||||
} else {
|
} else {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submitFromFields()
|
public function submitFromFields()
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ namespace App\Livewire\Source\Github;
|
|||||||
|
|
||||||
use App\Jobs\GithubAppPermissionJob;
|
use App\Jobs\GithubAppPermissionJob;
|
||||||
use App\Models\GithubApp;
|
use App\Models\GithubApp;
|
||||||
use Illuminate\Support\Facades\Http;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Change extends Component
|
class Change extends Component
|
||||||
@@ -141,7 +140,6 @@ class Change extends Component
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function submit()
|
public function submit()
|
||||||
|
|||||||
@@ -8,49 +8,16 @@ use Stripe\Stripe;
|
|||||||
|
|
||||||
class PricingPlans extends Component
|
class PricingPlans extends Component
|
||||||
{
|
{
|
||||||
public bool $isTrial = false;
|
|
||||||
|
|
||||||
public function mount()
|
|
||||||
{
|
|
||||||
$this->isTrial = ! data_get(currentTeam(), 'subscription.stripe_trial_already_ended');
|
|
||||||
if (config('constants.limits.trial_period') == 0) {
|
|
||||||
$this->isTrial = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function subscribeStripe($type)
|
public function subscribeStripe($type)
|
||||||
{
|
{
|
||||||
$team = currentTeam();
|
|
||||||
Stripe::setApiKey(config('subscription.stripe_api_key'));
|
Stripe::setApiKey(config('subscription.stripe_api_key'));
|
||||||
switch ($type) {
|
|
||||||
case 'basic-monthly':
|
$priceId = match ($type) {
|
||||||
$priceId = config('subscription.stripe_price_id_basic_monthly');
|
'dynamic-monthly' => config('subscription.stripe_price_id_dynamic_monthly'),
|
||||||
break;
|
'dynamic-yearly' => config('subscription.stripe_price_id_dynamic_yearly'),
|
||||||
case 'basic-yearly':
|
default => config('subscription.stripe_price_id_dynamic_monthly'),
|
||||||
$priceId = config('subscription.stripe_price_id_basic_yearly');
|
};
|
||||||
break;
|
|
||||||
case 'pro-monthly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_pro_monthly');
|
|
||||||
break;
|
|
||||||
case 'pro-yearly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_pro_yearly');
|
|
||||||
break;
|
|
||||||
case 'ultimate-monthly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_ultimate_monthly');
|
|
||||||
break;
|
|
||||||
case 'ultimate-yearly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_ultimate_yearly');
|
|
||||||
break;
|
|
||||||
case 'dynamic-monthly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_dynamic_monthly');
|
|
||||||
break;
|
|
||||||
case 'dynamic-yearly':
|
|
||||||
$priceId = config('subscription.stripe_price_id_dynamic_yearly');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$priceId = config('subscription.stripe_price_id_basic_monthly');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (! $priceId) {
|
if (! $priceId) {
|
||||||
$this->dispatch('error', 'Price ID not found! Please contact the administrator.');
|
$this->dispatch('error', 'Price ID not found! Please contact the administrator.');
|
||||||
|
|
||||||
@@ -62,7 +29,11 @@ class PricingPlans extends Component
|
|||||||
'client_reference_id' => auth()->user()->id.':'.currentTeam()->id,
|
'client_reference_id' => auth()->user()->id.':'.currentTeam()->id,
|
||||||
'line_items' => [[
|
'line_items' => [[
|
||||||
'price' => $priceId,
|
'price' => $priceId,
|
||||||
'quantity' => 1,
|
'adjustable_quantity' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'minimum' => 2,
|
||||||
|
],
|
||||||
|
'quantity' => 2,
|
||||||
]],
|
]],
|
||||||
'tax_id_collection' => [
|
'tax_id_collection' => [
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
@@ -70,39 +41,18 @@ class PricingPlans extends Component
|
|||||||
'automatic_tax' => [
|
'automatic_tax' => [
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
],
|
],
|
||||||
|
'subscription_data' => [
|
||||||
|
'metadata' => [
|
||||||
|
'user_id' => auth()->user()->id,
|
||||||
|
'team_id' => currentTeam()->id,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'payment_method_collection' => 'if_required',
|
||||||
'mode' => 'subscription',
|
'mode' => 'subscription',
|
||||||
'success_url' => route('dashboard', ['success' => true]),
|
'success_url' => route('dashboard', ['success' => true]),
|
||||||
'cancel_url' => route('subscription.index', ['cancelled' => true]),
|
'cancel_url' => route('subscription.index', ['cancelled' => true]),
|
||||||
];
|
];
|
||||||
if (str($type)->contains('ultimate')) {
|
|
||||||
$payload['line_items'][0]['adjustable_quantity'] = [
|
|
||||||
'enabled' => true,
|
|
||||||
'minimum' => 10,
|
|
||||||
];
|
|
||||||
$payload['line_items'][0]['quantity'] = 10;
|
|
||||||
}
|
|
||||||
if (str($type)->contains('dynamic')) {
|
|
||||||
$payload['line_items'][0]['adjustable_quantity'] = [
|
|
||||||
'enabled' => true,
|
|
||||||
'minimum' => 2,
|
|
||||||
];
|
|
||||||
$payload['line_items'][0]['quantity'] = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! data_get($team, 'subscription.stripe_trial_already_ended')) {
|
|
||||||
if (config('constants.limits.trial_period') > 0) {
|
|
||||||
$payload['subscription_data'] = [
|
|
||||||
'trial_period_days' => config('constants.limits.trial_period'),
|
|
||||||
'trial_settings' => [
|
|
||||||
'end_behavior' => [
|
|
||||||
'missing_payment_method' => 'cancel',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$payload['payment_method_collection'] = 'if_required';
|
|
||||||
}
|
|
||||||
$customer = currentTeam()->subscription?->stripe_customer_id ?? null;
|
$customer = currentTeam()->subscription?->stripe_customer_id ?? null;
|
||||||
if ($customer) {
|
if ($customer) {
|
||||||
$payload['customer'] = $customer;
|
$payload['customer'] = $customer;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public function tagUpdated()
|
public function tagUpdated()
|
||||||
{
|
{
|
||||||
if ($this->tag == '') {
|
if ($this->tag === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$sanitizedTag = htmlspecialchars($this->tag, ENT_QUOTES, 'UTF-8');
|
$sanitizedTag = htmlspecialchars($this->tag, ENT_QUOTES, 'UTF-8');
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Invitations extends Component
|
|||||||
$initiation_found->delete();
|
$initiation_found->delete();
|
||||||
$this->refreshInvitations();
|
$this->refreshInvitations();
|
||||||
$this->dispatch('success', 'Invitation revoked.');
|
$this->dispatch('success', 'Invitation revoked.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return $this->dispatch('error', 'Invitation not found.');
|
return $this->dispatch('error', 'Invitation not found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,9 @@ class Upgrade extends Component
|
|||||||
try {
|
try {
|
||||||
$this->latestVersion = get_latest_version_of_coolify();
|
$this->latestVersion = get_latest_version_of_coolify();
|
||||||
$this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false);
|
$this->isUpgradeAvailable = data_get(InstanceSettings::get(), 'new_version_available', false);
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function upgrade()
|
public function upgrade()
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ class VerifyEmail extends Component
|
|||||||
$this->rateLimit(1, 300);
|
$this->rateLimit(1, 300);
|
||||||
auth()->user()->sendVerificationEmail();
|
auth()->user()->sendVerificationEmail();
|
||||||
$this->dispatch('success', 'Email verification link sent!');
|
$this->dispatch('success', 'Email verification link sent!');
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class Application extends BaseModel
|
|||||||
protected static function booted()
|
protected static function booted()
|
||||||
{
|
{
|
||||||
static::saving(function ($application) {
|
static::saving(function ($application) {
|
||||||
if ($application->fqdn == '') {
|
if ($application->fqdn === '') {
|
||||||
$application->fqdn = null;
|
$application->fqdn = null;
|
||||||
}
|
}
|
||||||
$application->forceFill([
|
$application->forceFill([
|
||||||
@@ -936,7 +936,7 @@ class Application extends BaseModel
|
|||||||
$source_html_url_host = $url['host'];
|
$source_html_url_host = $url['host'];
|
||||||
$source_html_url_scheme = $url['scheme'];
|
$source_html_url_scheme = $url['scheme'];
|
||||||
|
|
||||||
if ($this->source->getMorphClass() == \App\Models\GithubApp::class) {
|
if ($this->source->getMorphClass() === \App\Models\GithubApp::class) {
|
||||||
if ($this->source->is_public) {
|
if ($this->source->is_public) {
|
||||||
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
$fullRepoUrl = "{$this->source->html_url}/{$customRepository}";
|
||||||
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$customRepository} {$baseDir}";
|
||||||
@@ -1407,7 +1407,7 @@ class Application extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -1431,7 +1431,7 @@ class Application extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ class Environment extends Model
|
|||||||
foreach ($shared_variables as $shared_variable) {
|
foreach ($shared_variables as $shared_variable) {
|
||||||
$shared_variable->delete();
|
$shared_variable->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,13 +156,12 @@ class EnvironmentVariable extends Model
|
|||||||
|
|
||||||
private function get_real_environment_variables(?string $environment_variable = null, $resource = null)
|
private function get_real_environment_variables(?string $environment_variable = null, $resource = null)
|
||||||
{
|
{
|
||||||
if ((is_null($environment_variable) && $environment_variable == '') || is_null($resource)) {
|
if ((is_null($environment_variable) && $environment_variable === '') || is_null($resource)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$environment_variable = trim($environment_variable);
|
$environment_variable = trim($environment_variable);
|
||||||
$sharedEnvsFound = str($environment_variable)->matchAll('/{{(.*?)}}/');
|
$sharedEnvsFound = str($environment_variable)->matchAll('/{{(.*?)}}/');
|
||||||
if ($sharedEnvsFound->isEmpty()) {
|
if ($sharedEnvsFound->isEmpty()) {
|
||||||
|
|
||||||
return $environment_variable;
|
return $environment_variable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +201,7 @@ class EnvironmentVariable extends Model
|
|||||||
|
|
||||||
private function set_environment_variables(?string $environment_variable = null): ?string
|
private function set_environment_variables(?string $environment_variable = null): ?string
|
||||||
{
|
{
|
||||||
if (is_null($environment_variable) && $environment_variable == '') {
|
if (is_null($environment_variable) && $environment_variable === '') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$environment_variable = trim($environment_variable);
|
$environment_variable = trim($environment_variable);
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class InstanceSettings extends Model implements SendsEmail
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fqdn(): Attribute
|
public function fqdn(): Attribute
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ class LocalFileVolume extends BaseModel
|
|||||||
if ($path && $path != '/' && $path != '.' && $path != '..') {
|
if ($path && $path != '/' && $path != '.' && $path != '..') {
|
||||||
if ($isFile === 'OK') {
|
if ($isFile === 'OK') {
|
||||||
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
|
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
|
||||||
|
|
||||||
} elseif ($isDir === 'OK') {
|
} elseif ($isDir === 'OK') {
|
||||||
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
|
$commands->push("rm -rf $path > /dev/null 2>&1 || true");
|
||||||
$commands->push("rmdir $path > /dev/null 2>&1 || true");
|
$commands->push("rmdir $path > /dev/null 2>&1 || true");
|
||||||
@@ -113,15 +112,15 @@ class LocalFileVolume extends BaseModel
|
|||||||
}
|
}
|
||||||
$isFile = instant_remote_process(["test -f $path && echo OK || echo NOK"], $server);
|
$isFile = instant_remote_process(["test -f $path && echo OK || echo NOK"], $server);
|
||||||
$isDir = instant_remote_process(["test -d $path && echo OK || echo NOK"], $server);
|
$isDir = instant_remote_process(["test -d $path && echo OK || echo NOK"], $server);
|
||||||
if ($isFile == 'OK' && $this->is_directory) {
|
if ($isFile === 'OK' && $this->is_directory) {
|
||||||
$content = instant_remote_process(["cat $path"], $server, false);
|
$content = instant_remote_process(["cat $path"], $server, false);
|
||||||
$this->is_directory = false;
|
$this->is_directory = false;
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
$this->save();
|
$this->save();
|
||||||
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
||||||
throw new \Exception('The following file is a file on the server, but you are trying to mark it as a directory. Please delete the file on the server or mark it as directory.');
|
throw new \Exception('The following file is a file on the server, but you are trying to mark it as a directory. Please delete the file on the server or mark it as directory.');
|
||||||
} elseif ($isDir == 'OK' && ! $this->is_directory) {
|
} elseif ($isDir === 'OK' && ! $this->is_directory) {
|
||||||
if ($path == '/' || $path == '.' || $path == '..' || $path == '' || str($path)->isEmpty() || is_null($path)) {
|
if ($path === '/' || $path === '.' || $path === '..' || $path === '' || str($path)->isEmpty() || is_null($path)) {
|
||||||
$this->is_directory = true;
|
$this->is_directory = true;
|
||||||
$this->save();
|
$this->save();
|
||||||
throw new \Exception('The following file is a directory on the server, but you are trying to mark it as a file. <br><br>Please delete the directory on the server or mark it as directory.');
|
throw new \Exception('The following file is a directory on the server, but you are trying to mark it as a file. <br><br>Please delete the directory on the server or mark it as directory.');
|
||||||
@@ -132,7 +131,7 @@ class LocalFileVolume extends BaseModel
|
|||||||
], $server, false);
|
], $server, false);
|
||||||
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
FileStorageChanged::dispatch(data_get($server, 'team_id'));
|
||||||
}
|
}
|
||||||
if ($isDir == 'NOK' && ! $this->is_directory) {
|
if ($isDir === 'NOK' && ! $this->is_directory) {
|
||||||
$chmod = data_get($this, 'chmod');
|
$chmod = data_get($this, 'chmod');
|
||||||
$chown = data_get($this, 'chown');
|
$chown = data_get($this, 'chown');
|
||||||
if ($content) {
|
if ($content) {
|
||||||
@@ -148,7 +147,7 @@ class LocalFileVolume extends BaseModel
|
|||||||
if ($chmod) {
|
if ($chmod) {
|
||||||
$commands->push("chmod $chmod $path");
|
$commands->push("chmod $chmod $path");
|
||||||
}
|
}
|
||||||
} elseif ($isDir == 'NOK' && $this->is_directory) {
|
} elseif ($isDir === 'NOK' && $this->is_directory) {
|
||||||
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
$commands->push("mkdir -p $path > /dev/null 2>&1 || true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,21 +34,15 @@ class ScheduledTask extends BaseModel
|
|||||||
{
|
{
|
||||||
if ($this->application) {
|
if ($this->application) {
|
||||||
if ($this->application->destination && $this->application->destination->server) {
|
if ($this->application->destination && $this->application->destination->server) {
|
||||||
$server = $this->application->destination->server;
|
return $this->application->destination->server;
|
||||||
|
|
||||||
return $server;
|
|
||||||
}
|
}
|
||||||
} elseif ($this->service) {
|
} elseif ($this->service) {
|
||||||
if ($this->service->destination && $this->service->destination->server) {
|
if ($this->service->destination && $this->service->destination->server) {
|
||||||
$server = $this->service->destination->server;
|
return $this->service->destination->server;
|
||||||
|
|
||||||
return $server;
|
|
||||||
}
|
}
|
||||||
} elseif ($this->database) {
|
} elseif ($this->database) {
|
||||||
if ($this->database->destination && $this->database->destination->server) {
|
if ($this->database->destination && $this->database->destination->server) {
|
||||||
$server = $this->database->destination->server;
|
return $this->database->destination->server;
|
||||||
|
|
||||||
return $server;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Process;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Stringable;
|
use Illuminate\Support\Stringable;
|
||||||
use OpenApi\Attributes as OA;
|
use OpenApi\Attributes as OA;
|
||||||
@@ -416,7 +415,7 @@ class Server extends BaseModel
|
|||||||
"echo '$base64' | base64 -d | tee $file > /dev/null",
|
"echo '$base64' | base64 -d | tee $file > /dev/null",
|
||||||
], $this);
|
], $this);
|
||||||
|
|
||||||
if (config('app.env') == 'local') {
|
if (config('app.env') === 'local') {
|
||||||
// ray($yaml);
|
// ray($yaml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,17 +591,16 @@ $schema://$host {
|
|||||||
if (str($cpu)->contains('error')) {
|
if (str($cpu)->contains('error')) {
|
||||||
$error = json_decode($cpu, true);
|
$error = json_decode($cpu, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
}
|
}
|
||||||
$cpu = json_decode($cpu, true);
|
$cpu = json_decode($cpu, true);
|
||||||
$parsedCollection = collect($cpu)->map(function ($metric) {
|
|
||||||
|
return collect($cpu)->map(function ($metric) {
|
||||||
return [(int) $metric['time'], (float) $metric['percent']];
|
return [(int) $metric['time'], (float) $metric['percent']];
|
||||||
});
|
});
|
||||||
|
|
||||||
return $parsedCollection;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +612,7 @@ $schema://$host {
|
|||||||
if (str($memory)->contains('error')) {
|
if (str($memory)->contains('error')) {
|
||||||
$error = json_decode($memory, true);
|
$error = json_decode($memory, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -833,9 +831,7 @@ $schema://$host {
|
|||||||
{
|
{
|
||||||
return Attribute::make(
|
return Attribute::make(
|
||||||
get: function ($value) {
|
get: function ($value) {
|
||||||
$sanitizedValue = preg_replace('/[^A-Za-z0-9\-_]/', '', $value);
|
return preg_replace('/[^A-Za-z0-9\-_]/', '', $value);
|
||||||
|
|
||||||
return $sanitizedValue;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1092,9 +1088,7 @@ $schema://$host {
|
|||||||
|
|
||||||
public function installDocker()
|
public function installDocker()
|
||||||
{
|
{
|
||||||
$activity = InstallDocker::run($this);
|
return InstallDocker::run($this);
|
||||||
|
|
||||||
return $activity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateDockerEngine($throwError = false)
|
public function validateDockerEngine($throwError = false)
|
||||||
|
|||||||
@@ -1095,7 +1095,6 @@ class Service extends BaseModel
|
|||||||
}
|
}
|
||||||
$fields->put('MariaDB', $data->toArray());
|
$fields->put('MariaDB', $data->toArray());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1304,14 +1303,11 @@ class Service extends BaseModel
|
|||||||
} else {
|
} else {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function networks()
|
public function networks()
|
||||||
{
|
{
|
||||||
$networks = getTopLevelNetworks($this);
|
return getTopLevelNetworks($this);
|
||||||
|
|
||||||
return $networks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isDeployable(): Attribute
|
protected function isDeployable(): Attribute
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class StandaloneClickhouse extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneClickhouse extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class StandaloneDragonfly extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneDragonfly extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class StandaloneKeydb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneKeydb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -297,7 +297,7 @@ class StandaloneMariadb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ class StandaloneMongodb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -317,7 +317,7 @@ class StandaloneMongodb extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ class StandaloneMysql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -298,7 +298,7 @@ class StandaloneMysql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ class StandalonePostgresql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -303,7 +303,7 @@ class StandalonePostgresql extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ class StandaloneRedis extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
@@ -308,7 +308,7 @@ class StandaloneRedis extends BaseModel
|
|||||||
if (str($metrics)->contains('error')) {
|
if (str($metrics)->contains('error')) {
|
||||||
$error = json_decode($metrics, true);
|
$error = json_decode($metrics, true);
|
||||||
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
$error = data_get($error, 'error', 'Something is not okay, are you okay?');
|
||||||
if ($error == 'Unauthorized') {
|
if ($error === 'Unauthorized') {
|
||||||
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
$error = 'Unauthorized, please check your metrics token or restart Sentinel to set a new token.';
|
||||||
}
|
}
|
||||||
throw new \Exception($error);
|
throw new \Exception($error);
|
||||||
|
|||||||
@@ -131,9 +131,7 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
|||||||
{
|
{
|
||||||
$recipients = data_get($notification, 'emails', null);
|
$recipients = data_get($notification, 'emails', null);
|
||||||
if (is_null($recipients)) {
|
if (is_null($recipients)) {
|
||||||
$recipients = $this->members()->pluck('email')->toArray();
|
return $this->members()->pluck('email')->toArray();
|
||||||
|
|
||||||
return $recipients;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return explode(',', $recipients);
|
return explode(',', $recipients);
|
||||||
@@ -251,9 +249,8 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
|||||||
$sources = collect([]);
|
$sources = collect([]);
|
||||||
$github_apps = $this->hasMany(GithubApp::class)->whereisPublic(false)->get();
|
$github_apps = $this->hasMany(GithubApp::class)->whereisPublic(false)->get();
|
||||||
$gitlab_apps = $this->hasMany(GitlabApp::class)->whereisPublic(false)->get();
|
$gitlab_apps = $this->hasMany(GitlabApp::class)->whereisPublic(false)->get();
|
||||||
$sources = $sources->merge($github_apps)->merge($gitlab_apps);
|
|
||||||
|
|
||||||
return $sources;
|
return $sources->merge($github_apps)->merge($gitlab_apps);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function s3s()
|
public function s3s()
|
||||||
|
|||||||
@@ -58,14 +58,12 @@ class StatusChanged extends Notification implements ShouldQueue
|
|||||||
|
|
||||||
public function toDiscord(): DiscordMessage
|
public function toDiscord(): DiscordMessage
|
||||||
{
|
{
|
||||||
$message = new DiscordMessage(
|
return new DiscordMessage(
|
||||||
title: ':cross_mark: Application stopped',
|
title: ':cross_mark: Application stopped',
|
||||||
description: '[Open Application in Coolify]('.$this->resource_url.')',
|
description: '[Open Application in Coolify]('.$this->resource_url.')',
|
||||||
color: DiscordMessage::errorColor(),
|
color: DiscordMessage::errorColor(),
|
||||||
isCritical: true,
|
isCritical: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $message;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toTelegram(): array
|
public function toTelegram(): array
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ class TaskFailed extends Notification implements ShouldQueue
|
|||||||
|
|
||||||
public function via(object $notifiable): array
|
public function via(object $notifiable): array
|
||||||
{
|
{
|
||||||
|
|
||||||
return setNotificationChannels($notifiable, 'scheduled_tasks');
|
return setNotificationChannels($notifiable, 'scheduled_tasks');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ function invalidTokenResponse()
|
|||||||
function serializeApiResponse($data)
|
function serializeApiResponse($data)
|
||||||
{
|
{
|
||||||
if ($data instanceof Collection) {
|
if ($data instanceof Collection) {
|
||||||
$data = $data->map(function ($d) {
|
return $data->map(function ($d) {
|
||||||
$d = collect($d)->sortKeys();
|
$d = collect($d)->sortKeys();
|
||||||
$created_at = data_get($d, 'created_at');
|
$created_at = data_get($d, 'created_at');
|
||||||
$updated_at = data_get($d, 'updated_at');
|
$updated_at = data_get($d, 'updated_at');
|
||||||
if ($created_at) {
|
if ($created_at) {
|
||||||
unset($d['created_at']);
|
unset($d['created_at']);
|
||||||
$d['created_at'] = $created_at;
|
$d['created_at'] = $created_at;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($updated_at) {
|
if ($updated_at) {
|
||||||
unset($d['updated_at']);
|
unset($d['updated_at']);
|
||||||
@@ -50,8 +49,6 @@ function serializeApiResponse($data)
|
|||||||
|
|
||||||
return $d;
|
return $d;
|
||||||
});
|
});
|
||||||
|
|
||||||
return $data;
|
|
||||||
} else {
|
} else {
|
||||||
$d = collect($data)->sortKeys();
|
$d = collect($data)->sortKeys();
|
||||||
$created_at = data_get($d, 'created_at');
|
$created_at = data_get($d, 'created_at');
|
||||||
@@ -59,7 +56,6 @@ function serializeApiResponse($data)
|
|||||||
if ($created_at) {
|
if ($created_at) {
|
||||||
unset($d['created_at']);
|
unset($d['created_at']);
|
||||||
$d['created_at'] = $created_at;
|
$d['created_at'] = $created_at;
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($updated_at) {
|
if ($updated_at) {
|
||||||
unset($d['updated_at']);
|
unset($d['updated_at']);
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ function getCurrentApplicationContainerStatus(Server $server, int $id, ?int $pul
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
$containers = $containers->filter();
|
|
||||||
|
|
||||||
return $containers;
|
return $containers->filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $containers;
|
return $containers;
|
||||||
@@ -46,9 +45,8 @@ function getCurrentServiceContainerStatus(Server $server, int $id): Collection
|
|||||||
if (! $server->isSwarm()) {
|
if (! $server->isSwarm()) {
|
||||||
$containers = instant_remote_process(["docker ps -a --filter='label=coolify.serviceId={$id}' --format '{{json .}}' "], $server);
|
$containers = instant_remote_process(["docker ps -a --filter='label=coolify.serviceId={$id}' --format '{{json .}}' "], $server);
|
||||||
$containers = format_docker_command_output_to_json($containers);
|
$containers = format_docker_command_output_to_json($containers);
|
||||||
$containers = $containers->filter();
|
|
||||||
|
|
||||||
return $containers;
|
return $containers->filter();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $containers;
|
return $containers;
|
||||||
@@ -67,7 +65,7 @@ function format_docker_command_output_to_json($rawOutput): Collection
|
|||||||
return $outputLines
|
return $outputLines
|
||||||
->reject(fn ($line) => empty($line))
|
->reject(fn ($line) => empty($line))
|
||||||
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +102,7 @@ function format_docker_envs_to_json($rawOutput)
|
|||||||
|
|
||||||
return [$env[0] => $env[1]];
|
return [$env[0] => $env[1]];
|
||||||
});
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,7 +508,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -581,7 +579,6 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
|
|||||||
redirect_direction: $application->redirect
|
redirect_direction: $application->redirect
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (data_get($preview, 'fqdn')) {
|
if (data_get($preview, 'fqdn')) {
|
||||||
@@ -633,7 +630,6 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
|
|||||||
is_stripprefix_enabled: $application->isStripprefixEnabled()
|
is_stripprefix_enabled: $application->isStripprefixEnabled()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $labels->all();
|
return $labels->all();
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
use App\Models\GithubApp;
|
use App\Models\GithubApp;
|
||||||
use App\Models\GitlabApp;
|
use App\Models\GitlabApp;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Lcobucci\JWT\Encoding\ChainedFormatter;
|
use Lcobucci\JWT\Encoding\ChainedFormatter;
|
||||||
@@ -16,7 +17,7 @@ function generate_github_installation_token(GithubApp $source)
|
|||||||
$signingKey = InMemory::plainText($source->privateKey->private_key);
|
$signingKey = InMemory::plainText($source->privateKey->private_key);
|
||||||
$algorithm = new Sha256;
|
$algorithm = new Sha256;
|
||||||
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
||||||
$now = new DateTimeImmutable;
|
$now = CarbonImmutable::now();
|
||||||
$now = $now->setTime($now->format('H'), $now->format('i'));
|
$now = $now->setTime($now->format('H'), $now->format('i'));
|
||||||
$issuedToken = $tokenBuilder
|
$issuedToken = $tokenBuilder
|
||||||
->issuedBy($source->app_id)
|
->issuedBy($source->app_id)
|
||||||
@@ -40,16 +41,15 @@ function generate_github_jwt_token(GithubApp $source)
|
|||||||
$signingKey = InMemory::plainText($source->privateKey->private_key);
|
$signingKey = InMemory::plainText($source->privateKey->private_key);
|
||||||
$algorithm = new Sha256;
|
$algorithm = new Sha256;
|
||||||
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
||||||
$now = new DateTimeImmutable;
|
$now = CarbonImmutable::now();
|
||||||
$now = $now->setTime($now->format('H'), $now->format('i'));
|
$now = $now->setTime($now->format('H'), $now->format('i'));
|
||||||
$issuedToken = $tokenBuilder
|
|
||||||
|
return $tokenBuilder
|
||||||
->issuedBy($source->app_id)
|
->issuedBy($source->app_id)
|
||||||
->issuedAt($now->modify('-1 minute'))
|
->issuedAt($now->modify('-1 minute'))
|
||||||
->expiresAt($now->modify('+10 minutes'))
|
->expiresAt($now->modify('+10 minutes'))
|
||||||
->getToken($algorithm, $signingKey)
|
->getToken($algorithm, $signingKey)
|
||||||
->toString();
|
->toString();
|
||||||
|
|
||||||
return $issuedToken;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $method = 'get', ?array $data = null, bool $throwError = true)
|
function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $method = 'get', ?array $data = null, bool $throwError = true)
|
||||||
@@ -57,7 +57,7 @@ function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $m
|
|||||||
if (is_null($source)) {
|
if (is_null($source)) {
|
||||||
throw new \Exception('Not implemented yet.');
|
throw new \Exception('Not implemented yet.');
|
||||||
}
|
}
|
||||||
if ($source->getMorphClass() == \App\Models\GithubApp::class) {
|
if ($source->getMorphClass() === \App\Models\GithubApp::class) {
|
||||||
if ($source->is_public) {
|
if ($source->is_public) {
|
||||||
$response = Http::github($source->api_url)->$method($endpoint);
|
$response = Http::github($source->api_url)->$method($endpoint);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ function collectProxyDockerNetworksByServer(Server $server)
|
|||||||
return collect();
|
return collect();
|
||||||
}
|
}
|
||||||
$networks = instant_remote_process(['docker inspect --format="{{json .NetworkSettings.Networks }}" coolify-proxy'], $server, false);
|
$networks = instant_remote_process(['docker inspect --format="{{json .NetworkSettings.Networks }}" coolify-proxy'], $server, false);
|
||||||
$networks = collect($networks)->map(function ($network) {
|
|
||||||
|
return collect($networks)->map(function ($network) {
|
||||||
return collect(json_decode($network))->keys();
|
return collect(json_decode($network))->keys();
|
||||||
})->flatten()->unique();
|
})->flatten()->unique();
|
||||||
|
|
||||||
return $networks;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function collectDockerNetworksByServer(Server $server)
|
function collectDockerNetworksByServer(Server $server)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d
|
|||||||
associative: true,
|
associative: true,
|
||||||
flags: JSON_THROW_ON_ERROR
|
flags: JSON_THROW_ON_ERROR
|
||||||
);
|
);
|
||||||
} catch (\JsonException $exception) {
|
} catch (\JsonException) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
$seenCommands = collect();
|
$seenCommands = collect();
|
||||||
@@ -204,7 +204,7 @@ function checkRequiredCommands(Server $server)
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'apt update && apt install -y {$command}'"], $server);
|
instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'apt update && apt install -y {$command}'"], $server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$commandFound = instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'command -v {$command}'"], $server, false);
|
$commandFound = instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'command -v {$command}'"], $server, false);
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
// Exists and is a directory
|
// Exists and is a directory
|
||||||
$isDir = instant_remote_process(["test -d $fileLocation && echo OK || echo NOK"], $server);
|
$isDir = instant_remote_process(["test -d $fileLocation && echo OK || echo NOK"], $server);
|
||||||
|
|
||||||
if ($isFile == 'OK') {
|
if ($isFile === 'OK') {
|
||||||
// If its a file & exists
|
// If its a file & exists
|
||||||
$filesystemContent = instant_remote_process(["cat $fileLocation"], $server);
|
$filesystemContent = instant_remote_process(["cat $fileLocation"], $server);
|
||||||
if ($fileVolume->is_based_on_git) {
|
if ($fileVolume->is_based_on_git) {
|
||||||
@@ -59,12 +59,12 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
}
|
}
|
||||||
$fileVolume->is_directory = false;
|
$fileVolume->is_directory = false;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
} elseif ($isDir == 'OK') {
|
} elseif ($isDir === 'OK') {
|
||||||
// If its a directory & exists
|
// If its a directory & exists
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && ! $fileVolume->is_directory && $isInit && $content) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && ! $fileVolume->is_directory && $isInit && $content) {
|
||||||
// Does not exists (no dir or file), not flagged as directory, is init, has content
|
// Does not exists (no dir or file), not flagged as directory, is init, has content
|
||||||
$fileVolume->content = $content;
|
$fileVolume->content = $content;
|
||||||
$fileVolume->is_directory = false;
|
$fileVolume->is_directory = false;
|
||||||
@@ -75,13 +75,13 @@ function getFilesystemVolumesFromServer(ServiceApplication|ServiceDatabase|Appli
|
|||||||
"mkdir -p $dir",
|
"mkdir -p $dir",
|
||||||
"echo '$content' | base64 -d | tee $fileLocation",
|
"echo '$content' | base64 -d | tee $fileLocation",
|
||||||
], $server);
|
], $server);
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && $fileVolume->is_directory && $isInit) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && $fileVolume->is_directory && $isInit) {
|
||||||
// Does not exists (no dir or file), flagged as directory, is init
|
// Does not exists (no dir or file), flagged as directory, is init
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
$fileVolume->save();
|
$fileVolume->save();
|
||||||
instant_remote_process(["mkdir -p $fileLocation"], $server);
|
instant_remote_process(["mkdir -p $fileLocation"], $server);
|
||||||
} elseif ($isFile == 'NOK' && $isDir == 'NOK' && ! $fileVolume->is_directory && $isInit && is_null($content)) {
|
} elseif ($isFile === 'NOK' && $isDir === 'NOK' && ! $fileVolume->is_directory && $isInit && is_null($content)) {
|
||||||
// Does not exists (no dir or file), not flagged as directory, is init, has no content => create directory
|
// Does not exists (no dir or file), not flagged as directory, is init, has no content => create directory
|
||||||
$fileVolume->content = null;
|
$fileVolume->content = null;
|
||||||
$fileVolume->is_directory = true;
|
$fileVolume->is_directory = true;
|
||||||
@@ -245,8 +245,5 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
|
|||||||
}
|
}
|
||||||
function serviceKeys()
|
function serviceKeys()
|
||||||
{
|
{
|
||||||
$services = get_service_templates();
|
return get_service_templates()->keys();
|
||||||
$serviceKeys = $services->keys();
|
|
||||||
|
|
||||||
return $serviceKeys;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ use App\Notifications\Channels\DiscordChannel;
|
|||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\TelegramChannel;
|
use App\Notifications\Channels\TelegramChannel;
|
||||||
use App\Notifications\Internal\GeneralNotification;
|
use App\Notifications\Internal\GeneralNotification;
|
||||||
|
use Carbon\CarbonImmutable;
|
||||||
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
|
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
|
||||||
use Illuminate\Database\UniqueConstraintViolationException;
|
use Illuminate\Database\UniqueConstraintViolationException;
|
||||||
use Illuminate\Mail\Message;
|
use Illuminate\Mail\Message;
|
||||||
@@ -172,7 +173,7 @@ function get_latest_sentinel_version(): string
|
|||||||
$versions = $response->json();
|
$versions = $response->json();
|
||||||
|
|
||||||
return data_get($versions, 'coolify.sentinel.version');
|
return data_get($versions, 'coolify.sentinel.version');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return '0.0.0';
|
return '0.0.0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +302,7 @@ function getFqdnWithoutPort(string $fqdn)
|
|||||||
$path = $url->getPath();
|
$path = $url->getPath();
|
||||||
|
|
||||||
return "$scheme://$host$path";
|
return "$scheme://$host$path";
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return $fqdn;
|
return $fqdn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -500,9 +501,8 @@ function generateFqdn(Server $server, string $random, bool $forceHttps = false):
|
|||||||
if ($forceHttps) {
|
if ($forceHttps) {
|
||||||
$scheme = 'https';
|
$scheme = 'https';
|
||||||
}
|
}
|
||||||
$finalFqdn = "$scheme://{$random}.$host$path";
|
|
||||||
|
|
||||||
return $finalFqdn;
|
return "$scheme://{$random}.$host$path";
|
||||||
}
|
}
|
||||||
function sslip(Server $server)
|
function sslip(Server $server)
|
||||||
{
|
{
|
||||||
@@ -540,7 +540,7 @@ function get_service_templates(bool $force = false): Collection
|
|||||||
$services = $response->json();
|
$services = $response->json();
|
||||||
|
|
||||||
return collect($services);
|
return collect($services);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$services = File::get(base_path('templates/service-templates.json'));
|
$services = File::get(base_path('templates/service-templates.json'));
|
||||||
|
|
||||||
return collect(json_decode($services))->sortKeys();
|
return collect(json_decode($services))->sortKeys();
|
||||||
@@ -652,9 +652,8 @@ function generateTagDeployWebhook($tag_name)
|
|||||||
$baseUrl = base_url();
|
$baseUrl = base_url();
|
||||||
$api = Url::fromString($baseUrl).'/api/v1';
|
$api = Url::fromString($baseUrl).'/api/v1';
|
||||||
$endpoint = "/deploy?tag=$tag_name";
|
$endpoint = "/deploy?tag=$tag_name";
|
||||||
$url = $api.$endpoint;
|
|
||||||
|
|
||||||
return $url;
|
return $api.$endpoint;
|
||||||
}
|
}
|
||||||
function generateDeployWebhook($resource)
|
function generateDeployWebhook($resource)
|
||||||
{
|
{
|
||||||
@@ -662,9 +661,8 @@ function generateDeployWebhook($resource)
|
|||||||
$api = Url::fromString($baseUrl).'/api/v1';
|
$api = Url::fromString($baseUrl).'/api/v1';
|
||||||
$endpoint = '/deploy';
|
$endpoint = '/deploy';
|
||||||
$uuid = data_get($resource, 'uuid');
|
$uuid = data_get($resource, 'uuid');
|
||||||
$url = $api.$endpoint."?uuid=$uuid&force=false";
|
|
||||||
|
|
||||||
return $url;
|
return $api.$endpoint."?uuid=$uuid&force=false";
|
||||||
}
|
}
|
||||||
function generateGitManualWebhook($resource, $type)
|
function generateGitManualWebhook($resource, $type)
|
||||||
{
|
{
|
||||||
@@ -673,9 +671,8 @@ function generateGitManualWebhook($resource, $type)
|
|||||||
}
|
}
|
||||||
if ($resource->getMorphClass() === \App\Models\Application::class) {
|
if ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||||
$baseUrl = base_url();
|
$baseUrl = base_url();
|
||||||
$api = Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
|
||||||
|
|
||||||
return $api;
|
return Url::fromString($baseUrl)."/webhooks/source/$type/events/manual";
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -949,7 +946,7 @@ function generateEnvValue(string $command, Service|Application|null $service = n
|
|||||||
$key = InMemory::plainText($signingKey);
|
$key = InMemory::plainText($signingKey);
|
||||||
$algorithm = new Sha256;
|
$algorithm = new Sha256;
|
||||||
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
||||||
$now = new DateTimeImmutable;
|
$now = CarbonImmutable::now();
|
||||||
$now = $now->setTime($now->format('H'), $now->format('i'));
|
$now = $now->setTime($now->format('H'), $now->format('i'));
|
||||||
$token = $tokenBuilder
|
$token = $tokenBuilder
|
||||||
->issuedBy('supabase')
|
->issuedBy('supabase')
|
||||||
@@ -969,7 +966,7 @@ function generateEnvValue(string $command, Service|Application|null $service = n
|
|||||||
$key = InMemory::plainText($signingKey);
|
$key = InMemory::plainText($signingKey);
|
||||||
$algorithm = new Sha256;
|
$algorithm = new Sha256;
|
||||||
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
|
||||||
$now = new DateTimeImmutable;
|
$now = CarbonImmutable::now();
|
||||||
$now = $now->setTime($now->format('H'), $now->format('i'));
|
$now = $now->setTime($now->format('H'), $now->format('i'));
|
||||||
$token = $tokenBuilder
|
$token = $tokenBuilder
|
||||||
->issuedBy('supabase')
|
->issuedBy('supabase')
|
||||||
@@ -1052,7 +1049,7 @@ function validate_dns_entry(string $fqdn, Server $server)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray("Found match: $found_matching_ip");
|
ray("Found match: $found_matching_ip");
|
||||||
@@ -2213,7 +2210,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$server = $resource->destination->server;
|
$server = $resource->destination->server;
|
||||||
@@ -2959,7 +2956,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($compose);
|
$yaml = Yaml::parse($compose);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3187,7 +3184,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
'is_build_time' => false,
|
'is_build_time' => false,
|
||||||
'is_preview' => false,
|
'is_preview' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$value = generateEnvValue($command, $resource);
|
$value = generateEnvValue($command, $resource);
|
||||||
$resource->environment_variables()->where('key', $key->value())->where($nameOfId, $resource->id)->firstOrCreate([
|
$resource->environment_variables()->where('key', $key->value())->where($nameOfId, $resource->id)->firstOrCreate([
|
||||||
@@ -3615,7 +3611,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
'is_required' => $isRequired,
|
'is_required' => $isRequired,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($isApplication) {
|
if ($isApplication) {
|
||||||
@@ -3979,7 +3974,6 @@ function convertComposeEnvironmentToArray($environment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $convertedServiceVariables;
|
return $convertedServiceVariables;
|
||||||
|
|
||||||
}
|
}
|
||||||
function instanceSettings()
|
function instanceSettings()
|
||||||
{
|
{
|
||||||
@@ -3988,7 +3982,6 @@ function instanceSettings()
|
|||||||
|
|
||||||
function loadConfigFromGit(string $repository, string $branch, string $base_directory, int $server_id, int $team_id)
|
function loadConfigFromGit(string $repository, string $branch, string $base_directory, int $server_id, int $team_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
$server = Server::find($server_id)->where('team_id', $team_id)->first();
|
$server = Server::find($server_id)->where('team_id', $team_id)->first();
|
||||||
if (! $server) {
|
if (! $server) {
|
||||||
return;
|
return;
|
||||||
@@ -4010,7 +4003,7 @@ function loadConfigFromGit(string $repository, string $branch, string $base_dire
|
|||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
return instant_remote_process($commands, $server);
|
return instant_remote_process($commands, $server);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ function get_socialite_provider(string $provider)
|
|||||||
{
|
{
|
||||||
$oauth_setting = OauthSetting::firstWhere('provider', $provider);
|
$oauth_setting = OauthSetting::firstWhere('provider', $provider);
|
||||||
|
|
||||||
if ($provider == 'azure') {
|
if ($provider === 'azure') {
|
||||||
$azure_config = new \SocialiteProviders\Manager\Config(
|
$azure_config = new \SocialiteProviders\Manager\Config(
|
||||||
$oauth_setting->client_id,
|
$oauth_setting->client_id,
|
||||||
$oauth_setting->client_secret,
|
$oauth_setting->client_secret,
|
||||||
|
|||||||
@@ -55,12 +55,11 @@ function getStripeCustomerPortalSession(Team $team)
|
|||||||
if (! $stripe_customer_id) {
|
if (! $stripe_customer_id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$session = \Stripe\BillingPortal\Session::create([
|
|
||||||
|
return \Stripe\BillingPortal\Session::create([
|
||||||
'customer' => $stripe_customer_id,
|
'customer' => $stripe_customer_id,
|
||||||
'return_url' => $return_url,
|
'return_url' => $return_url,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $session;
|
|
||||||
}
|
}
|
||||||
function allowedPathsForUnsubscribedAccounts()
|
function allowedPathsForUnsubscribedAccounts()
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user