Remove all ray() calls
This commit is contained in:
@@ -11,8 +11,6 @@ class GenerateConfig
|
|||||||
|
|
||||||
public function handle(Application $application, bool $is_json = false)
|
public function handle(Application $application, bool $is_json = false)
|
||||||
{
|
{
|
||||||
ray()->clearAll();
|
|
||||||
|
|
||||||
return $application->generateConfig(is_json: $is_json);
|
return $application->generateConfig(is_json: $is_json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,6 @@ class StopApplication
|
|||||||
if (! $server->isFunctional()) {
|
if (! $server->isFunctional()) {
|
||||||
return 'Server is not functional';
|
return 'Server is not functional';
|
||||||
}
|
}
|
||||||
ray('Stopping application: '.$application->name);
|
|
||||||
|
|
||||||
if ($server->isSwarm()) {
|
if ($server->isSwarm()) {
|
||||||
instant_remote_process(["docker stack rm {$application->uuid}"], $server);
|
instant_remote_process(["docker stack rm {$application->uuid}"], $server);
|
||||||
@@ -36,8 +35,6 @@ class StopApplication
|
|||||||
CleanupDocker::dispatch($server, true);
|
CleanupDocker::dispatch($server, true);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,8 +32,6 @@ class StopApplicationOneServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,6 @@ class PrepareCoolifyTask
|
|||||||
call_event_data: $this->remoteProcessArgs->call_event_data,
|
call_event_data: $this->remoteProcessArgs->call_event_data,
|
||||||
);
|
);
|
||||||
if ($this->remoteProcessArgs->type === ActivityTypes::COMMAND->value) {
|
if ($this->remoteProcessArgs->type === ActivityTypes::COMMAND->value) {
|
||||||
ray('Dispatching a high priority job');
|
|
||||||
dispatch($job)->onQueue('high');
|
dispatch($job)->onQueue('high');
|
||||||
} else {
|
} else {
|
||||||
dispatch($job);
|
dispatch($job);
|
||||||
|
@@ -125,7 +125,6 @@ class RunRemoteProcess
|
|||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,8 +25,6 @@ class CheckResaleLicense
|
|||||||
// }
|
// }
|
||||||
$base_url = config('coolify.license_url');
|
$base_url = config('coolify.license_url');
|
||||||
$instance_id = config('app.id');
|
$instance_id = config('app.id');
|
||||||
|
|
||||||
ray("Checking license key against $base_url/lemon/validate");
|
|
||||||
$data = Http::withHeaders([
|
$data = Http::withHeaders([
|
||||||
'Accept' => 'application/json',
|
'Accept' => 'application/json',
|
||||||
])->get("$base_url/lemon/validate", [
|
])->get("$base_url/lemon/validate", [
|
||||||
@@ -34,7 +32,6 @@ class CheckResaleLicense
|
|||||||
'instance_id' => $instance_id,
|
'instance_id' => $instance_id,
|
||||||
])->json();
|
])->json();
|
||||||
if (data_get($data, 'valid') === true && data_get($data, 'license_key.status') === 'active') {
|
if (data_get($data, 'valid') === true && data_get($data, 'license_key.status') === 'active') {
|
||||||
ray('Valid & active license key');
|
|
||||||
$settings->update([
|
$settings->update([
|
||||||
'is_resale_license_active' => true,
|
'is_resale_license_active' => true,
|
||||||
]);
|
]);
|
||||||
@@ -48,7 +45,6 @@ class CheckResaleLicense
|
|||||||
'instance_id' => $instance_id,
|
'instance_id' => $instance_id,
|
||||||
])->json();
|
])->json();
|
||||||
if (data_get($data, 'activated') === true) {
|
if (data_get($data, 'activated') === true) {
|
||||||
ray('Activated license key');
|
|
||||||
$settings->update([
|
$settings->update([
|
||||||
'is_resale_license_active' => true,
|
'is_resale_license_active' => true,
|
||||||
]);
|
]);
|
||||||
@@ -60,7 +56,6 @@ class CheckResaleLicense
|
|||||||
}
|
}
|
||||||
throw new \Exception('Cannot activate license key.');
|
throw new \Exception('Cannot activate license key.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
$settings->update([
|
$settings->update([
|
||||||
'resale_license' => null,
|
'resale_license' => null,
|
||||||
'is_resale_license_active' => false,
|
'is_resale_license_active' => false,
|
||||||
|
@@ -88,7 +88,6 @@ class CheckProxy
|
|||||||
$portsToCheck = [];
|
$portsToCheck = [];
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
if (count($portsToCheck) === 0) {
|
if (count($portsToCheck) === 0) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -72,7 +72,6 @@ class StartProxy
|
|||||||
return 'OK';
|
return 'OK';
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,6 @@ class ConfigureCloudflared
|
|||||||
]);
|
]);
|
||||||
instant_remote_process($commands, $server);
|
instant_remote_process($commands, $server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
$server->settings->is_cloudflare_tunnel = false;
|
$server->settings->is_cloudflare_tunnel = false;
|
||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@@ -16,7 +16,6 @@ class InstallDocker
|
|||||||
if (! $supported_os_type) {
|
if (! $supported_os_type) {
|
||||||
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
|
throw new \Exception('Server OS type is not supported for automated installation. Please install Docker manually before continuing: <a target="_blank" class="underline" href="https://coolify.io/docs/installation#manually">documentation</a>.');
|
||||||
}
|
}
|
||||||
ray('Installing Docker on server: '.$server->name.' ('.$server->ip.')'.' with OS type: '.$supported_os_type);
|
|
||||||
$dockerVersion = '26.0';
|
$dockerVersion = '26.0';
|
||||||
$config = base64_encode('{
|
$config = base64_encode('{
|
||||||
"log-driver": "json-file",
|
"log-driver": "json-file",
|
||||||
|
@@ -40,7 +40,6 @@ class DeleteService
|
|||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
$result = instant_remote_process([$command], $server, false);
|
$result = instant_remote_process([$command], $server, false);
|
||||||
if ($result !== 0) {
|
if ($result !== 0) {
|
||||||
ray("Failed to execute: $command");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,6 @@ class StartService
|
|||||||
|
|
||||||
public function handle(Service $service)
|
public function handle(Service $service)
|
||||||
{
|
{
|
||||||
ray('Starting service: '.$service->name);
|
|
||||||
$service->saveComposeConfigs();
|
$service->saveComposeConfigs();
|
||||||
$commands[] = 'cd '.$service->workdir();
|
$commands[] = 'cd '.$service->workdir();
|
||||||
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
|
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
|
||||||
|
@@ -28,8 +28,6 @@ class StopService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return $e->getMessage();
|
return $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,6 @@ class CleanupStuckedResources extends Command
|
|||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
ray('Running cleanup stucked resources.');
|
|
||||||
echo "Running cleanup stucked resources.\n";
|
echo "Running cleanup stucked resources.\n";
|
||||||
$this->cleanup_stucked_resources();
|
$this->cleanup_stucked_resources();
|
||||||
}
|
}
|
||||||
|
@@ -19,7 +19,6 @@ class CloudCleanupSubscriptions extends Command
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ray()->clearAll();
|
|
||||||
$this->info('Cleaning up subcriptions teams');
|
$this->info('Cleaning up subcriptions teams');
|
||||||
$stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key'));
|
$stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key'));
|
||||||
|
|
||||||
|
@@ -124,7 +124,6 @@ class Emails extends Command
|
|||||||
$applications = Application::all();
|
$applications = Application::all();
|
||||||
foreach ($applications as $application) {
|
foreach ($applications as $application) {
|
||||||
$deployments = $application->get_last_days_deployments();
|
$deployments = $application->get_last_days_deployments();
|
||||||
ray($deployments);
|
|
||||||
if ($deployments->isEmpty()) {
|
if ($deployments->isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -219,7 +219,6 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
$queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get();
|
$queued_inprogress_deployments = ApplicationDeploymentQueue::whereIn('status', [ApplicationDeploymentStatus::IN_PROGRESS->value, ApplicationDeploymentStatus::QUEUED->value])->get();
|
||||||
foreach ($queued_inprogress_deployments as $deployment) {
|
foreach ($queued_inprogress_deployments as $deployment) {
|
||||||
ray($deployment->id, $deployment->status);
|
|
||||||
echo "Cleaning up deployment: {$deployment->id}\n";
|
echo "Cleaning up deployment: {$deployment->id}\n";
|
||||||
$deployment->status = ApplicationDeploymentStatus::FAILED->value;
|
$deployment->status = ApplicationDeploymentStatus::FAILED->value;
|
||||||
$deployment->save();
|
$deployment->save();
|
||||||
|
@@ -36,8 +36,6 @@ class NotifyDemo extends Command
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ray($channel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function showHelp()
|
private function showHelp()
|
||||||
|
@@ -134,7 +134,6 @@ class Kernel extends ConsoleKernel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_null(data_get($scheduled_backup, 'database'))) {
|
if (is_null(data_get($scheduled_backup, 'database'))) {
|
||||||
ray('database not found');
|
|
||||||
$scheduled_backup->delete();
|
$scheduled_backup->delete();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -170,7 +169,6 @@ class Kernel extends ConsoleKernel
|
|||||||
$application = $scheduled_task->application;
|
$application = $scheduled_task->application;
|
||||||
|
|
||||||
if (! $application && ! $service) {
|
if (! $application && ! $service) {
|
||||||
ray('application/service attached to scheduled task does not exist');
|
|
||||||
$scheduled_task->delete();
|
$scheduled_task->delete();
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@@ -16,7 +16,6 @@ class FileStorageChanged implements ShouldBroadcast
|
|||||||
|
|
||||||
public function __construct($teamId = null)
|
public function __construct($teamId = null)
|
||||||
{
|
{
|
||||||
ray($teamId);
|
|
||||||
if (is_null($teamId)) {
|
if (is_null($teamId)) {
|
||||||
throw new \Exception('Team id is null');
|
throw new \Exception('Team id is null');
|
||||||
}
|
}
|
||||||
|
@@ -84,7 +84,6 @@ class Handler extends ExceptionHandler
|
|||||||
if (str($e->getMessage())->contains('No space left on device')) {
|
if (str($e->getMessage())->contains('No space left on device')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ray('reporting to sentry');
|
|
||||||
Integration::captureUnhandledException($e);
|
Integration::captureUnhandledException($e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -249,7 +249,6 @@ class ServersController extends Controller
|
|||||||
return $payload;
|
return $payload;
|
||||||
});
|
});
|
||||||
$server = $this->removeSensitiveData($server);
|
$server = $this->removeSensitiveData($server);
|
||||||
ray($server);
|
|
||||||
|
|
||||||
return response()->json(serializeApiResponse(data_get($server, 'resources')));
|
return response()->json(serializeApiResponse(data_get($server, 'resources')));
|
||||||
}
|
}
|
||||||
|
@@ -142,7 +142,6 @@ class Controller extends BaseController
|
|||||||
abort(401);
|
abort(401);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,8 +35,6 @@ class OauthController extends Controller
|
|||||||
|
|
||||||
return redirect('/');
|
return redirect('/');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
$errorCode = $e instanceof HttpException ? 'auth.failed' : 'auth.failed.callback';
|
$errorCode = $e instanceof HttpException ? 'auth.failed' : 'auth.failed.callback';
|
||||||
|
|
||||||
return redirect()->route('login')->withErrors([__($errorCode)]);
|
return redirect()->route('login')->withErrors([__($errorCode)]);
|
||||||
|
@@ -16,7 +16,6 @@ class Bitbucket extends Controller
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$data = [
|
$data = [
|
||||||
'attributes' => $request->attributes->all(),
|
'attributes' => $request->attributes->all(),
|
||||||
@@ -55,7 +54,6 @@ class Bitbucket extends Controller
|
|||||||
'message' => 'Nothing to do. No branch found in the request.',
|
'message' => 'Nothing to do. No branch found in the request.',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
ray('Manual webhook bitbucket push event with branch: '.$branch);
|
|
||||||
}
|
}
|
||||||
if ($x_bitbucket_event === 'pullrequest:created' || $x_bitbucket_event === 'pullrequest:rejected' || $x_bitbucket_event === 'pullrequest:fulfilled') {
|
if ($x_bitbucket_event === 'pullrequest:created' || $x_bitbucket_event === 'pullrequest:rejected' || $x_bitbucket_event === 'pullrequest:fulfilled') {
|
||||||
$branch = data_get($payload, 'pullrequest.destination.branch.name');
|
$branch = data_get($payload, 'pullrequest.destination.branch.name');
|
||||||
@@ -85,7 +83,6 @@ class Bitbucket extends Controller
|
|||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Invalid signature.',
|
'message' => 'Invalid signature.',
|
||||||
]);
|
]);
|
||||||
ray('Invalid signature');
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -96,13 +93,11 @@ class Bitbucket extends Controller
|
|||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Server is not functional.',
|
'message' => 'Server is not functional.',
|
||||||
]);
|
]);
|
||||||
ray('Server is not functional: '.$application->destination->server->name);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($x_bitbucket_event === 'repo:push') {
|
if ($x_bitbucket_event === 'repo:push') {
|
||||||
if ($application->isDeployable()) {
|
if ($application->isDeployable()) {
|
||||||
ray('Deploying '.$application->name.' with branch '.$branch);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
@@ -126,7 +121,6 @@ class Bitbucket extends Controller
|
|||||||
}
|
}
|
||||||
if ($x_bitbucket_event === 'pullrequest:created') {
|
if ($x_bitbucket_event === 'pullrequest:created') {
|
||||||
if ($application->isPRDeployable()) {
|
if ($application->isPRDeployable()) {
|
||||||
ray('Deploying preview for '.$application->name.' with branch '.$branch.' and base branch '.$base_branch.' and pull request id '.$pull_request_id);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
@@ -171,7 +165,6 @@ class Bitbucket extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($x_bitbucket_event === 'pullrequest:rejected' || $x_bitbucket_event === 'pullrequest:fulfilled') {
|
if ($x_bitbucket_event === 'pullrequest:rejected' || $x_bitbucket_event === 'pullrequest:fulfilled') {
|
||||||
ray('Pull request rejected');
|
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$found->delete();
|
$found->delete();
|
||||||
@@ -191,12 +184,9 @@ class Bitbucket extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray($return_payloads);
|
|
||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e);
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,15 +19,12 @@ class Gitea extends Controller
|
|||||||
$return_payloads = collect([]);
|
$return_payloads = collect([]);
|
||||||
$x_gitea_delivery = request()->header('X-Gitea-Delivery');
|
$x_gitea_delivery = request()->header('X-Gitea-Delivery');
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$files = Storage::disk('webhooks-during-maintenance')->files();
|
$files = Storage::disk('webhooks-during-maintenance')->files();
|
||||||
$gitea_delivery_found = collect($files)->filter(function ($file) use ($x_gitea_delivery) {
|
$gitea_delivery_found = collect($files)->filter(function ($file) use ($x_gitea_delivery) {
|
||||||
return Str::contains($file, $x_gitea_delivery);
|
return Str::contains($file, $x_gitea_delivery);
|
||||||
})->first();
|
})->first();
|
||||||
if ($gitea_delivery_found) {
|
if ($gitea_delivery_found) {
|
||||||
ray('Webhook already found');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
@@ -67,8 +64,6 @@ class Gitea extends Controller
|
|||||||
$removed_files = data_get($payload, 'commits.*.removed');
|
$removed_files = data_get($payload, 'commits.*.removed');
|
||||||
$modified_files = data_get($payload, 'commits.*.modified');
|
$modified_files = data_get($payload, 'commits.*.modified');
|
||||||
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
||||||
ray($changed_files);
|
|
||||||
ray('Manual Webhook Gitea Push Event with branch: '.$branch);
|
|
||||||
}
|
}
|
||||||
if ($x_gitea_event === 'pull_request') {
|
if ($x_gitea_event === 'pull_request') {
|
||||||
$action = data_get($payload, 'action');
|
$action = data_get($payload, 'action');
|
||||||
@@ -77,7 +72,6 @@ class Gitea extends Controller
|
|||||||
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
||||||
$branch = data_get($payload, 'pull_request.head.ref');
|
$branch = data_get($payload, 'pull_request.head.ref');
|
||||||
$base_branch = data_get($payload, 'pull_request.base.ref');
|
$base_branch = data_get($payload, 'pull_request.base.ref');
|
||||||
ray('Webhook Gitea Pull Request Event with branch: '.$branch.' and base branch: '.$base_branch.' and pull request id: '.$pull_request_id);
|
|
||||||
}
|
}
|
||||||
if (! $branch) {
|
if (! $branch) {
|
||||||
return response('Nothing to do. No branch found in the request.');
|
return response('Nothing to do. No branch found in the request.');
|
||||||
@@ -99,7 +93,6 @@ class Gitea extends Controller
|
|||||||
$webhook_secret = data_get($application, 'manual_webhook_secret_gitea');
|
$webhook_secret = data_get($application, 'manual_webhook_secret_gitea');
|
||||||
$hmac = hash_hmac('sha256', $request->getContent(), $webhook_secret);
|
$hmac = hash_hmac('sha256', $request->getContent(), $webhook_secret);
|
||||||
if (! hash_equals($x_hub_signature_256, $hmac) && ! isDev()) {
|
if (! hash_equals($x_hub_signature_256, $hmac) && ! isDev()) {
|
||||||
ray('Invalid signature');
|
|
||||||
$return_payloads->push([
|
$return_payloads->push([
|
||||||
'application' => $application->name,
|
'application' => $application->name,
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
@@ -122,7 +115,6 @@ class Gitea extends Controller
|
|||||||
if ($application->isDeployable()) {
|
if ($application->isDeployable()) {
|
||||||
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
||||||
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
||||||
ray('Deploying '.$application->name.' with branch '.$branch);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
@@ -228,12 +220,9 @@ class Gitea extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray($return_payloads);
|
|
||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,15 +25,12 @@ class Github extends Controller
|
|||||||
$return_payloads = collect([]);
|
$return_payloads = collect([]);
|
||||||
$x_github_delivery = request()->header('X-GitHub-Delivery');
|
$x_github_delivery = request()->header('X-GitHub-Delivery');
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$files = Storage::disk('webhooks-during-maintenance')->files();
|
$files = Storage::disk('webhooks-during-maintenance')->files();
|
||||||
$github_delivery_found = collect($files)->filter(function ($file) use ($x_github_delivery) {
|
$github_delivery_found = collect($files)->filter(function ($file) use ($x_github_delivery) {
|
||||||
return Str::contains($file, $x_github_delivery);
|
return Str::contains($file, $x_github_delivery);
|
||||||
})->first();
|
})->first();
|
||||||
if ($github_delivery_found) {
|
if ($github_delivery_found) {
|
||||||
ray('Webhook already found');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
@@ -73,7 +70,6 @@ class Github extends Controller
|
|||||||
$removed_files = data_get($payload, 'commits.*.removed');
|
$removed_files = data_get($payload, 'commits.*.removed');
|
||||||
$modified_files = data_get($payload, 'commits.*.modified');
|
$modified_files = data_get($payload, 'commits.*.modified');
|
||||||
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
||||||
ray('Manual Webhook GitHub Push Event with branch: '.$branch);
|
|
||||||
}
|
}
|
||||||
if ($x_github_event === 'pull_request') {
|
if ($x_github_event === 'pull_request') {
|
||||||
$action = data_get($payload, 'action');
|
$action = data_get($payload, 'action');
|
||||||
@@ -82,7 +78,6 @@ class Github extends Controller
|
|||||||
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
||||||
$branch = data_get($payload, 'pull_request.head.ref');
|
$branch = data_get($payload, 'pull_request.head.ref');
|
||||||
$base_branch = data_get($payload, 'pull_request.base.ref');
|
$base_branch = data_get($payload, 'pull_request.base.ref');
|
||||||
ray('Webhook GitHub Pull Request Event with branch: '.$branch.' and base branch: '.$base_branch.' and pull request id: '.$pull_request_id);
|
|
||||||
}
|
}
|
||||||
if (! $branch) {
|
if (! $branch) {
|
||||||
return response('Nothing to do. No branch found in the request.');
|
return response('Nothing to do. No branch found in the request.');
|
||||||
@@ -104,7 +99,6 @@ class Github extends Controller
|
|||||||
$webhook_secret = data_get($application, 'manual_webhook_secret_github');
|
$webhook_secret = data_get($application, 'manual_webhook_secret_github');
|
||||||
$hmac = hash_hmac('sha256', $request->getContent(), $webhook_secret);
|
$hmac = hash_hmac('sha256', $request->getContent(), $webhook_secret);
|
||||||
if (! hash_equals($x_hub_signature_256, $hmac) && ! isDev()) {
|
if (! hash_equals($x_hub_signature_256, $hmac) && ! isDev()) {
|
||||||
ray('Invalid signature');
|
|
||||||
$return_payloads->push([
|
$return_payloads->push([
|
||||||
'application' => $application->name,
|
'application' => $application->name,
|
||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
@@ -127,7 +121,6 @@ class Github extends Controller
|
|||||||
if ($application->isDeployable()) {
|
if ($application->isDeployable()) {
|
||||||
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
||||||
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
||||||
ray('Deploying '.$application->name.' with branch '.$branch);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
@@ -232,12 +225,9 @@ class Github extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray($return_payloads);
|
|
||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -249,15 +239,12 @@ class Github extends Controller
|
|||||||
$id = null;
|
$id = null;
|
||||||
$x_github_delivery = $request->header('X-GitHub-Delivery');
|
$x_github_delivery = $request->header('X-GitHub-Delivery');
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$files = Storage::disk('webhooks-during-maintenance')->files();
|
$files = Storage::disk('webhooks-during-maintenance')->files();
|
||||||
$github_delivery_found = collect($files)->filter(function ($file) use ($x_github_delivery) {
|
$github_delivery_found = collect($files)->filter(function ($file) use ($x_github_delivery) {
|
||||||
return Str::contains($file, $x_github_delivery);
|
return Str::contains($file, $x_github_delivery);
|
||||||
})->first();
|
})->first();
|
||||||
if ($github_delivery_found) {
|
if ($github_delivery_found) {
|
||||||
ray('Webhook already found');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$data = [
|
$data = [
|
||||||
@@ -313,7 +300,6 @@ class Github extends Controller
|
|||||||
$removed_files = data_get($payload, 'commits.*.removed');
|
$removed_files = data_get($payload, 'commits.*.removed');
|
||||||
$modified_files = data_get($payload, 'commits.*.modified');
|
$modified_files = data_get($payload, 'commits.*.modified');
|
||||||
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
||||||
ray('Webhook GitHub Push Event: '.$id.' with branch: '.$branch);
|
|
||||||
}
|
}
|
||||||
if ($x_github_event === 'pull_request') {
|
if ($x_github_event === 'pull_request') {
|
||||||
$action = data_get($payload, 'action');
|
$action = data_get($payload, 'action');
|
||||||
@@ -322,7 +308,6 @@ class Github extends Controller
|
|||||||
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
$pull_request_html_url = data_get($payload, 'pull_request.html_url');
|
||||||
$branch = data_get($payload, 'pull_request.head.ref');
|
$branch = data_get($payload, 'pull_request.head.ref');
|
||||||
$base_branch = data_get($payload, 'pull_request.base.ref');
|
$base_branch = data_get($payload, 'pull_request.base.ref');
|
||||||
ray('Webhook GitHub Pull Request Event: '.$id.' with branch: '.$branch.' and base branch: '.$base_branch.' and pull request id: '.$pull_request_id);
|
|
||||||
}
|
}
|
||||||
if (! $id || ! $branch) {
|
if (! $id || ! $branch) {
|
||||||
return response('Nothing to do. No id or branch found.');
|
return response('Nothing to do. No id or branch found.');
|
||||||
@@ -356,7 +341,6 @@ class Github extends Controller
|
|||||||
if ($application->isDeployable()) {
|
if ($application->isDeployable()) {
|
||||||
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
||||||
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
||||||
ray('Deploying '.$application->name.' with branch '.$branch);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
@@ -460,8 +444,6 @@ class Github extends Controller
|
|||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -505,7 +487,6 @@ class Github extends Controller
|
|||||||
try {
|
try {
|
||||||
$installation_id = $request->get('installation_id');
|
$installation_id = $request->get('installation_id');
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$data = [
|
$data = [
|
||||||
'attributes' => $request->attributes->all(),
|
'attributes' => $request->attributes->all(),
|
||||||
|
@@ -17,7 +17,6 @@ class Gitlab extends Controller
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$data = [
|
$data = [
|
||||||
'attributes' => $request->attributes->all(),
|
'attributes' => $request->attributes->all(),
|
||||||
@@ -67,7 +66,6 @@ class Gitlab extends Controller
|
|||||||
$removed_files = data_get($payload, 'commits.*.removed');
|
$removed_files = data_get($payload, 'commits.*.removed');
|
||||||
$modified_files = data_get($payload, 'commits.*.modified');
|
$modified_files = data_get($payload, 'commits.*.modified');
|
||||||
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
$changed_files = collect($added_files)->concat($removed_files)->concat($modified_files)->unique()->flatten();
|
||||||
ray('Manual Webhook GitLab Push Event with branch: '.$branch);
|
|
||||||
}
|
}
|
||||||
if ($x_gitlab_event === 'merge_request') {
|
if ($x_gitlab_event === 'merge_request') {
|
||||||
$action = data_get($payload, 'object_attributes.action');
|
$action = data_get($payload, 'object_attributes.action');
|
||||||
@@ -84,7 +82,6 @@ class Gitlab extends Controller
|
|||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
}
|
}
|
||||||
ray('Webhook GitHub Pull Request Event with branch: '.$branch.' and base branch: '.$base_branch.' and pull request id: '.$pull_request_id);
|
|
||||||
}
|
}
|
||||||
$applications = Application::where('git_repository', 'like', "%$full_name%");
|
$applications = Application::where('git_repository', 'like', "%$full_name%");
|
||||||
if ($x_gitlab_event === 'push') {
|
if ($x_gitlab_event === 'push') {
|
||||||
@@ -117,7 +114,6 @@ class Gitlab extends Controller
|
|||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Invalid signature.',
|
'message' => 'Invalid signature.',
|
||||||
]);
|
]);
|
||||||
ray('Invalid signature');
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -128,7 +124,6 @@ class Gitlab extends Controller
|
|||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Server is not functional',
|
'message' => 'Server is not functional',
|
||||||
]);
|
]);
|
||||||
ray('Server is not functional: '.$application->destination->server->name);
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -136,7 +131,6 @@ class Gitlab extends Controller
|
|||||||
if ($application->isDeployable()) {
|
if ($application->isDeployable()) {
|
||||||
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
$is_watch_path_triggered = $application->isWatchPathsTriggered($changed_files);
|
||||||
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
if ($is_watch_path_triggered || is_null($application->watch_paths)) {
|
||||||
ray('Deploying '.$application->name.' with branch '.$branch);
|
|
||||||
$deployment_uuid = new Cuid2;
|
$deployment_uuid = new Cuid2;
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
@@ -171,7 +165,6 @@ class Gitlab extends Controller
|
|||||||
'application_uuid' => $application->uuid,
|
'application_uuid' => $application->uuid,
|
||||||
'application_name' => $application->name,
|
'application_name' => $application->name,
|
||||||
]);
|
]);
|
||||||
ray('Deployments disabled for '.$application->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($x_gitlab_event === 'merge_request') {
|
if ($x_gitlab_event === 'merge_request') {
|
||||||
@@ -207,7 +200,6 @@ class Gitlab extends Controller
|
|||||||
is_webhook: true,
|
is_webhook: true,
|
||||||
git_type: 'gitlab'
|
git_type: 'gitlab'
|
||||||
);
|
);
|
||||||
ray('Deploying preview for '.$application->name.' with branch '.$branch.' and base branch '.$base_branch.' and pull request id '.$pull_request_id);
|
|
||||||
$return_payloads->push([
|
$return_payloads->push([
|
||||||
'application' => $application->name,
|
'application' => $application->name,
|
||||||
'status' => 'success',
|
'status' => 'success',
|
||||||
@@ -219,7 +211,6 @@ class Gitlab extends Controller
|
|||||||
'status' => 'failed',
|
'status' => 'failed',
|
||||||
'message' => 'Preview deployments disabled',
|
'message' => 'Preview deployments disabled',
|
||||||
]);
|
]);
|
||||||
ray('Preview deployments disabled for '.$application->name);
|
|
||||||
}
|
}
|
||||||
} elseif ($action === 'closed' || $action === 'close' || $action === 'merge') {
|
} elseif ($action === 'closed' || $action === 'close' || $action === 'merge') {
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
@@ -253,8 +244,6 @@ class Gitlab extends Controller
|
|||||||
|
|
||||||
return response($return_payloads);
|
return response($return_payloads);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ class Stripe extends Controller
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (app()->isDownForMaintenance()) {
|
if (app()->isDownForMaintenance()) {
|
||||||
ray('Maintenance mode is on');
|
|
||||||
$epoch = now()->valueOf();
|
$epoch = now()->valueOf();
|
||||||
$data = [
|
$data = [
|
||||||
'attributes' => $request->attributes->all(),
|
'attributes' => $request->attributes->all(),
|
||||||
|
@@ -13,7 +13,6 @@ class Waitlist extends Controller
|
|||||||
{
|
{
|
||||||
$email = request()->get('email');
|
$email = request()->get('email');
|
||||||
$confirmation_code = request()->get('confirmation_code');
|
$confirmation_code = request()->get('confirmation_code');
|
||||||
ray($email, $confirmation_code);
|
|
||||||
try {
|
try {
|
||||||
$found = ModelsWaitlist::where('uuid', $confirmation_code)->where('email', $email)->first();
|
$found = ModelsWaitlist::where('uuid', $confirmation_code)->where('email', $email)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
@@ -36,7 +35,6 @@ class Waitlist extends Controller
|
|||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
send_internal_notification('Waitlist confirmation failed: '.$e->getMessage());
|
send_internal_notification('Waitlist confirmation failed: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
@@ -58,7 +56,6 @@ class Waitlist extends Controller
|
|||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
send_internal_notification('Waitlist cancellation failed: '.$e->getMessage());
|
send_internal_notification('Waitlist cancellation failed: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,6 @@ class ApiAllowed
|
|||||||
{
|
{
|
||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
ray()->clearAll();
|
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
@@ -208,7 +208,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->container_name = "{$this->application->settings->custom_internal_name}-pr-{$this->pull_request_id}";
|
$this->container_name = "{$this->application->settings->custom_internal_name}-pr-{$this->pull_request_id}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray('New container name: ', $this->container_name)->green();
|
|
||||||
|
|
||||||
$this->saved_outputs = collect();
|
$this->saved_outputs = collect();
|
||||||
|
|
||||||
@@ -298,7 +297,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->pull_request_id !== 0 && $this->application->is_github_based()) {
|
if ($this->pull_request_id !== 0 && $this->application->is_github_based()) {
|
||||||
ApplicationPullRequestUpdateJob::dispatch(application: $this->application, preview: $this->preview, deployment_uuid: $this->deployment_uuid, status: ProcessStatus::ERROR);
|
ApplicationPullRequestUpdateJob::dispatch(application: $this->application, preview: $this->preview, deployment_uuid: $this->deployment_uuid, status: ProcessStatus::ERROR);
|
||||||
}
|
}
|
||||||
ray($e);
|
|
||||||
$this->fail($e);
|
$this->fail($e);
|
||||||
throw $e;
|
throw $e;
|
||||||
} finally {
|
} finally {
|
||||||
@@ -389,7 +387,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
} else {
|
} else {
|
||||||
$this->dockerImageTag = $this->application->docker_registry_image_tag;
|
$this->dockerImageTag = $this->application->docker_registry_image_tag;
|
||||||
}
|
}
|
||||||
ray("echo 'Starting deployment of {$this->dockerImage}:{$this->dockerImageTag} to {$this->server->name}.'");
|
|
||||||
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->dockerImage}:{$this->dockerImageTag} to {$this->server->name}.");
|
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->dockerImage}:{$this->dockerImageTag} to {$this->server->name}.");
|
||||||
$this->generate_image_names();
|
$this->generate_image_names();
|
||||||
$this->prepare_builder_image();
|
$this->prepare_builder_image();
|
||||||
@@ -712,38 +709,26 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
$forceFail = true;
|
$forceFail = true;
|
||||||
if (str($this->application->docker_registry_image_name)->isEmpty()) {
|
if (str($this->application->docker_registry_image_name)->isEmpty()) {
|
||||||
ray('empty docker_registry_image_name');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->restart_only) {
|
if ($this->restart_only) {
|
||||||
ray('restart_only');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->application->build_pack === 'dockerimage') {
|
if ($this->application->build_pack === 'dockerimage') {
|
||||||
ray('dockerimage');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->use_build_server) {
|
if ($this->use_build_server) {
|
||||||
ray('use_build_server');
|
|
||||||
$forceFail = true;
|
$forceFail = true;
|
||||||
}
|
}
|
||||||
if ($this->server->isSwarm() && $this->build_pack !== 'dockerimage') {
|
if ($this->server->isSwarm() && $this->build_pack !== 'dockerimage') {
|
||||||
ray('isSwarm');
|
|
||||||
$forceFail = true;
|
$forceFail = true;
|
||||||
}
|
}
|
||||||
if ($this->application->additional_servers->count() > 0) {
|
if ($this->application->additional_servers->count() > 0) {
|
||||||
ray('additional_servers');
|
|
||||||
$forceFail = true;
|
$forceFail = true;
|
||||||
}
|
}
|
||||||
if ($this->is_this_additional_server) {
|
if ($this->is_this_additional_server) {
|
||||||
ray('this is an additional_servers, no pushy pushy');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ray('push_to_docker_registry noww: '.$this->production_image_name);
|
|
||||||
try {
|
try {
|
||||||
instant_remote_process(["docker images --format '{{json .}}' {$this->production_image_name}"], $this->server);
|
instant_remote_process(["docker images --format '{{json .}}' {$this->production_image_name}"], $this->server);
|
||||||
$this->application_deployment_queue->addLogEntry('----------------------------------------');
|
$this->application_deployment_queue->addLogEntry('----------------------------------------');
|
||||||
@@ -775,7 +760,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($forceFail) {
|
if ($forceFail) {
|
||||||
throw new RuntimeException($e->getMessage(), 69420);
|
throw new RuntimeException($e->getMessage(), 69420);
|
||||||
}
|
}
|
||||||
ray($e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1386,8 +1370,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($destination_ids->contains($this->destination->id)) {
|
if ($destination_ids->contains($this->destination->id)) {
|
||||||
ray('Same destination found in additional destinations. Skipping.');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach ($destination_ids as $destination_id) {
|
foreach ($destination_ids as $destination_id) {
|
||||||
@@ -2449,7 +2431,6 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
|
|
||||||
if ($this->application->build_pack !== 'dockercompose') {
|
if ($this->application->build_pack !== 'dockercompose') {
|
||||||
$code = $exception->getCode();
|
$code = $exception->getCode();
|
||||||
ray($code);
|
|
||||||
if ($code !== 69420) {
|
if ($code !== 69420) {
|
||||||
// 69420 means failed to push the image to the registry, so we don't need to remove the new version as it is the currently running one
|
// 69420 means failed to push the image to the registry, so we don't need to remove the new version as it is the currently running one
|
||||||
if ($this->application->settings->is_consistent_container_name_enabled || str($this->application->settings->custom_internal_name)->isNotEmpty()) {
|
if ($this->application->settings->is_consistent_container_name_enabled || str($this->application->settings->custom_internal_name)->isNotEmpty()) {
|
||||||
|
@@ -31,8 +31,6 @@ class ApplicationPullRequestUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->application->is_public_repository()) {
|
if ($this->application->is_public_repository()) {
|
||||||
ray('Public repository. Skipping comment update.');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($this->status === ProcessStatus::CLOSED) {
|
if ($this->status === ProcessStatus::CLOSED) {
|
||||||
@@ -53,16 +51,12 @@ class ApplicationPullRequestUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
$this->body .= '[Open Build Logs]('.$this->build_logs_url.")\n\n\n";
|
$this->body .= '[Open Build Logs]('.$this->build_logs_url.")\n\n\n";
|
||||||
$this->body .= 'Last updated at: '.now()->toDateTimeString().' CET';
|
$this->body .= 'Last updated at: '.now()->toDateTimeString().' CET';
|
||||||
|
|
||||||
ray('Updating comment', $this->body);
|
|
||||||
if ($this->preview->pull_request_issue_comment_id) {
|
if ($this->preview->pull_request_issue_comment_id) {
|
||||||
$this->update_comment();
|
$this->update_comment();
|
||||||
} else {
|
} else {
|
||||||
$this->create_comment();
|
$this->create_comment();
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
|
|
||||||
return $e;
|
return $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -73,7 +67,6 @@ class ApplicationPullRequestUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
'body' => $this->body,
|
'body' => $this->body,
|
||||||
], throwError: false);
|
], throwError: false);
|
||||||
if (data_get($data, 'message') === 'Not Found') {
|
if (data_get($data, 'message') === 'Not Found') {
|
||||||
ray('Comment not found. Creating new one.');
|
|
||||||
$this->create_comment();
|
$this->create_comment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,6 @@ class CheckResaleLicenseJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
CheckResaleLicense::run();
|
CheckResaleLicense::run();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('CheckResaleLicenseJob failed with: '.$e->getMessage());
|
send_internal_notification('CheckResaleLicenseJob failed with: '.$e->getMessage());
|
||||||
ray($e);
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,18 +20,15 @@ class CleanupHelperContainersJob implements ShouldBeEncrypted, ShouldBeUnique, S
|
|||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
ray('Cleaning up helper containers on '.$this->server->name);
|
|
||||||
$containers = instant_remote_process(['docker container ps --format \'{{json .}}\' | jq -s \'map(select(.Image | contains("ghcr.io/coollabsio/coolify-helper")))\''], $this->server, false);
|
$containers = instant_remote_process(['docker container ps --format \'{{json .}}\' | jq -s \'map(select(.Image | contains("ghcr.io/coollabsio/coolify-helper")))\''], $this->server, false);
|
||||||
$containerIds = collect(json_decode($containers))->pluck('ID');
|
$containerIds = collect(json_decode($containers))->pluck('ID');
|
||||||
if ($containerIds->count() > 0) {
|
if ($containerIds->count() > 0) {
|
||||||
foreach ($containerIds as $containerId) {
|
foreach ($containerIds as $containerId) {
|
||||||
ray('Removing container '.$containerId);
|
|
||||||
instant_remote_process(['docker container rm -f '.$containerId], $this->server, false);
|
instant_remote_process(['docker container rm -f '.$containerId], $this->server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('CleanupHelperContainersJob failed with error: '.$e->getMessage());
|
send_internal_notification('CleanupHelperContainersJob failed with error: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,13 +29,11 @@ class CleanupInstanceStuffsJob implements ShouldBeEncrypted, ShouldBeUnique, Sho
|
|||||||
// $this->cleanup_waitlist();
|
// $this->cleanup_waitlist();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('CleanupInstanceStuffsJob failed with error: '.$e->getMessage());
|
send_internal_notification('CleanupInstanceStuffsJob failed with error: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$this->cleanup_invitation_link();
|
$this->cleanup_invitation_link();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('CleanupInstanceStuffsJob failed with error: '.$e->getMessage());
|
send_internal_notification('CleanupInstanceStuffsJob failed with error: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -92,8 +92,6 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
|
|
||||||
$status = str(data_get($this->database, 'status'));
|
$status = str(data_get($this->database, 'status'));
|
||||||
if (! $status->startsWith('running') && $this->database->id !== 0) {
|
if (! $status->startsWith('running') && $this->database->id !== 0) {
|
||||||
ray('database not running');
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
if (data_get($this->backup, 'database_type') === 'App\Models\ServiceDatabase') {
|
||||||
@@ -222,7 +220,6 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
// Format: db1:collection1,collection2|db2:collection3,collection4
|
// Format: db1:collection1,collection2|db2:collection3,collection4
|
||||||
$databasesToBackup = explode('|', $databasesToBackup);
|
$databasesToBackup = explode('|', $databasesToBackup);
|
||||||
$databasesToBackup = array_map('trim', $databasesToBackup);
|
$databasesToBackup = array_map('trim', $databasesToBackup);
|
||||||
ray($databasesToBackup);
|
|
||||||
} elseif (str($databaseType)->contains('mysql')) {
|
} elseif (str($databaseType)->contains('mysql')) {
|
||||||
// Format: db1,db2,db3
|
// Format: db1,db2,db3
|
||||||
$databasesToBackup = explode(',', $databasesToBackup);
|
$databasesToBackup = explode(',', $databasesToBackup);
|
||||||
@@ -244,7 +241,6 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
foreach ($databasesToBackup as $database) {
|
foreach ($databasesToBackup as $database) {
|
||||||
$size = 0;
|
$size = 0;
|
||||||
ray('Backing up '.$database);
|
|
||||||
try {
|
try {
|
||||||
if (str($databaseType)->contains('postgres')) {
|
if (str($databaseType)->contains('postgres')) {
|
||||||
$this->backup_file = "/pg-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
$this->backup_file = "/pg-dump-$database-".Carbon::now()->timestamp.'.dmp';
|
||||||
@@ -377,10 +373,8 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
$this->backup_output = null;
|
$this->backup_output = null;
|
||||||
}
|
}
|
||||||
ray('Backup done for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location);
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->add_to_backup_output($e->getMessage());
|
$this->add_to_backup_output($e->getMessage());
|
||||||
ray('Backup failed for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location.'\n\nError:'.$e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -400,16 +394,13 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
$commands[] = $backupCommand;
|
$commands[] = $backupCommand;
|
||||||
ray($commands);
|
|
||||||
$this->backup_output = instant_remote_process($commands, $this->server);
|
$this->backup_output = instant_remote_process($commands, $this->server);
|
||||||
$this->backup_output = trim($this->backup_output);
|
$this->backup_output = trim($this->backup_output);
|
||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
$this->backup_output = null;
|
$this->backup_output = null;
|
||||||
}
|
}
|
||||||
ray('Backup done for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location);
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->add_to_backup_output($e->getMessage());
|
$this->add_to_backup_output($e->getMessage());
|
||||||
ray('Backup failed for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location.'\n\nError:'.$e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -428,10 +419,8 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
$this->backup_output = null;
|
$this->backup_output = null;
|
||||||
}
|
}
|
||||||
ray('Backup done for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location);
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->add_to_backup_output($e->getMessage());
|
$this->add_to_backup_output($e->getMessage());
|
||||||
ray('Backup failed for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location.'\n\nError:'.$e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -445,16 +434,13 @@ class DatabaseBackupJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
} else {
|
} else {
|
||||||
$commands[] = "docker exec $this->container_name mariadb-dump -u root -p{$this->database->mariadb_root_password} $database > $this->backup_location";
|
$commands[] = "docker exec $this->container_name mariadb-dump -u root -p{$this->database->mariadb_root_password} $database > $this->backup_location";
|
||||||
}
|
}
|
||||||
ray($commands);
|
|
||||||
$this->backup_output = instant_remote_process($commands, $this->server);
|
$this->backup_output = instant_remote_process($commands, $this->server);
|
||||||
$this->backup_output = trim($this->backup_output);
|
$this->backup_output = trim($this->backup_output);
|
||||||
if ($this->backup_output === '') {
|
if ($this->backup_output === '') {
|
||||||
$this->backup_output = null;
|
$this->backup_output = null;
|
||||||
}
|
}
|
||||||
ray('Backup done for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location);
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->add_to_backup_output($e->getMessage());
|
$this->add_to_backup_output($e->getMessage());
|
||||||
ray('Backup failed for '.$this->container_name.' at '.$this->server->name.':'.$this->backup_location.'\n\nError:'.$e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,6 @@ class GithubAppPermissionJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
|
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('GithubAppPermissionJob failed with: '.$e->getMessage());
|
send_internal_notification('GithubAppPermissionJob failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -25,7 +25,6 @@ class PullTemplatesFromCDN implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if (isDev() || isCloud()) {
|
if (isDev() || isCloud()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ray('PullTemplatesAndVersions service-templates');
|
|
||||||
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
$services = $response->json();
|
$services = $response->json();
|
||||||
@@ -35,7 +34,6 @@ class PullTemplatesFromCDN implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('PullTemplatesAndVersions failed with: '.$e->getMessage());
|
send_internal_notification('PullTemplatesAndVersions failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ class PullVersionsFromCDN implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (! isDev() && ! isCloud()) {
|
if (! isDev() && ! isCloud()) {
|
||||||
ray('PullTemplatesAndVersions versions.json');
|
|
||||||
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
$response = Http::retry(3, 1000)->get('https://cdn.coollabs.io/coolify/versions.json');
|
||||||
if ($response->successful()) {
|
if ($response->successful()) {
|
||||||
$versions = $response->json();
|
$versions = $response->json();
|
||||||
|
@@ -129,8 +129,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ray('allServiceApplicationIds', ['allServiceApplicationIds' => $this->allServiceApplicationIds]);
|
|
||||||
|
|
||||||
foreach ($this->containers as $container) {
|
foreach ($this->containers as $container) {
|
||||||
$containerStatus = data_get($container, 'state', 'exited');
|
$containerStatus = data_get($container, 'state', 'exited');
|
||||||
$containerHealth = data_get($container, 'health_status', 'unhealthy');
|
$containerHealth = data_get($container, 'health_status', 'unhealthy');
|
||||||
@@ -158,7 +156,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->updateApplicationPreviewStatus($applicationId, $containerStatus);
|
$this->updateApplicationPreviewStatus($applicationId, $containerStatus);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray()->error($e);
|
|
||||||
}
|
}
|
||||||
} elseif ($labels->has('coolify.serviceId')) {
|
} elseif ($labels->has('coolify.serviceId')) {
|
||||||
$serviceId = $labels->get('coolify.serviceId');
|
$serviceId = $labels->get('coolify.serviceId');
|
||||||
@@ -178,7 +175,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
if ($name === 'coolify-proxy' && $this->isRunning($containerStatus)) {
|
if ($name === 'coolify-proxy' && $this->isRunning($containerStatus)) {
|
||||||
$this->foundProxy = true;
|
$this->foundProxy = true;
|
||||||
} elseif ($type === 'service' && $this->isRunning($containerStatus)) {
|
} elseif ($type === 'service' && $this->isRunning($containerStatus)) {
|
||||||
ray("Service: $uuid, $containerStatus");
|
|
||||||
} else {
|
} else {
|
||||||
if ($this->allDatabaseUuids->contains($uuid) && $this->isRunning($containerStatus)) {
|
if ($this->allDatabaseUuids->contains($uuid) && $this->isRunning($containerStatus)) {
|
||||||
$this->foundDatabaseUuids->push($uuid);
|
$this->foundDatabaseUuids->push($uuid);
|
||||||
@@ -218,7 +214,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
$application->status = $containerStatus;
|
$application->status = $containerStatus;
|
||||||
$application->save();
|
$application->save();
|
||||||
ray('Application updated', ['application_id' => $applicationId, 'status' => $containerStatus]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateApplicationPreviewStatus(string $applicationId, string $containerStatus)
|
private function updateApplicationPreviewStatus(string $applicationId, string $containerStatus)
|
||||||
@@ -229,21 +224,17 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
$application->status = $containerStatus;
|
$application->status = $containerStatus;
|
||||||
$application->save();
|
$application->save();
|
||||||
ray('Application preview updated', ['application_id' => $applicationId, 'status' => $containerStatus]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateNotFoundApplicationStatus()
|
private function updateNotFoundApplicationStatus()
|
||||||
{
|
{
|
||||||
$notFoundApplicationIds = $this->allApplicationIds->diff($this->foundApplicationIds);
|
$notFoundApplicationIds = $this->allApplicationIds->diff($this->foundApplicationIds);
|
||||||
if ($notFoundApplicationIds->isNotEmpty()) {
|
if ($notFoundApplicationIds->isNotEmpty()) {
|
||||||
ray('Not found application ids', ['application_ids' => $notFoundApplicationIds]);
|
|
||||||
$notFoundApplicationIds->each(function ($applicationId) {
|
$notFoundApplicationIds->each(function ($applicationId) {
|
||||||
ray('Updating application status', ['application_id' => $applicationId, 'status' => 'exited']);
|
|
||||||
$application = Application::find($applicationId);
|
$application = Application::find($applicationId);
|
||||||
if ($application) {
|
if ($application) {
|
||||||
$application->status = 'exited';
|
$application->status = 'exited';
|
||||||
$application->save();
|
$application->save();
|
||||||
ray('Application status updated', ['application_id' => $applicationId, 'status' => 'exited']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -253,14 +244,11 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
$notFoundApplicationPreviewsIds = $this->allApplicationPreviewsIds->diff($this->foundApplicationPreviewsIds);
|
$notFoundApplicationPreviewsIds = $this->allApplicationPreviewsIds->diff($this->foundApplicationPreviewsIds);
|
||||||
if ($notFoundApplicationPreviewsIds->isNotEmpty()) {
|
if ($notFoundApplicationPreviewsIds->isNotEmpty()) {
|
||||||
ray('Not found application previews ids', ['application_previews_ids' => $notFoundApplicationPreviewsIds]);
|
|
||||||
$notFoundApplicationPreviewsIds->each(function ($applicationPreviewId) {
|
$notFoundApplicationPreviewsIds->each(function ($applicationPreviewId) {
|
||||||
ray('Updating application preview status', ['application_preview_id' => $applicationPreviewId, 'status' => 'exited']);
|
|
||||||
$applicationPreview = ApplicationPreview::find($applicationPreviewId);
|
$applicationPreview = ApplicationPreview::find($applicationPreviewId);
|
||||||
if ($applicationPreview) {
|
if ($applicationPreview) {
|
||||||
$applicationPreview->status = 'exited';
|
$applicationPreview->status = 'exited';
|
||||||
$applicationPreview->save();
|
$applicationPreview->save();
|
||||||
ray('Application preview status updated', ['application_preview_id' => $applicationPreviewId, 'status' => 'exited']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -294,17 +282,14 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
$database->status = $containerStatus;
|
$database->status = $containerStatus;
|
||||||
$database->save();
|
$database->save();
|
||||||
ray('Database status updated', ['database_uuid' => $databaseUuid, 'status' => $containerStatus]);
|
|
||||||
if ($this->isRunning($containerStatus) && $tcpProxy) {
|
if ($this->isRunning($containerStatus) && $tcpProxy) {
|
||||||
$tcpProxyContainerFound = $this->containers->filter(function ($value, $key) use ($databaseUuid) {
|
$tcpProxyContainerFound = $this->containers->filter(function ($value, $key) use ($databaseUuid) {
|
||||||
return data_get($value, 'name') === "$databaseUuid-proxy" && data_get($value, 'state') === 'running';
|
return data_get($value, 'name') === "$databaseUuid-proxy" && data_get($value, 'state') === 'running';
|
||||||
})->first();
|
})->first();
|
||||||
if (! $tcpProxyContainerFound) {
|
if (! $tcpProxyContainerFound) {
|
||||||
ray('Starting TCP proxy for database', ['database_uuid' => $databaseUuid]);
|
|
||||||
StartDatabaseProxy::dispatch($database);
|
StartDatabaseProxy::dispatch($database);
|
||||||
$this->server->team?->notify(new ContainerRestarted("TCP Proxy for {$database->name}", $this->server));
|
$this->server->team?->notify(new ContainerRestarted("TCP Proxy for {$database->name}", $this->server));
|
||||||
} else {
|
} else {
|
||||||
ray('TCP proxy for database found in containers', ['database_uuid' => $databaseUuid]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,17 +298,12 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
{
|
{
|
||||||
$notFoundDatabaseUuids = $this->allDatabaseUuids->diff($this->foundDatabaseUuids);
|
$notFoundDatabaseUuids = $this->allDatabaseUuids->diff($this->foundDatabaseUuids);
|
||||||
if ($notFoundDatabaseUuids->isNotEmpty()) {
|
if ($notFoundDatabaseUuids->isNotEmpty()) {
|
||||||
ray('Not found database uuids', ['database_uuids' => $notFoundDatabaseUuids]);
|
|
||||||
$notFoundDatabaseUuids->each(function ($databaseUuid) {
|
$notFoundDatabaseUuids->each(function ($databaseUuid) {
|
||||||
ray('Updating database status', ['database_uuid' => $databaseUuid, 'status' => 'exited']);
|
|
||||||
$database = $this->databases->where('uuid', $databaseUuid)->first();
|
$database = $this->databases->where('uuid', $databaseUuid)->first();
|
||||||
if ($database) {
|
if ($database) {
|
||||||
$database->status = 'exited';
|
$database->status = 'exited';
|
||||||
$database->save();
|
$database->save();
|
||||||
ray('Database status updated', ['database_uuid' => $databaseUuid, 'status' => 'exited']);
|
|
||||||
ray('Database is public', ['database_uuid' => $databaseUuid, 'is_public' => $database->is_public]);
|
|
||||||
if ($database->is_public) {
|
if ($database->is_public) {
|
||||||
ray('Stopping TCP proxy for database', ['database_uuid' => $databaseUuid]);
|
|
||||||
StopDatabaseProxy::dispatch($database);
|
StopDatabaseProxy::dispatch($database);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,14 +321,11 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$application = $service->applications()->where('id', $subId)->first();
|
$application = $service->applications()->where('id', $subId)->first();
|
||||||
$application->status = $containerStatus;
|
$application->status = $containerStatus;
|
||||||
$application->save();
|
$application->save();
|
||||||
ray('Service application updated', ['service_id' => $serviceId, 'sub_type' => $subType, 'sub_id' => $subId, 'status' => $containerStatus]);
|
|
||||||
} elseif ($subType === 'database') {
|
} elseif ($subType === 'database') {
|
||||||
$database = $service->databases()->where('id', $subId)->first();
|
$database = $service->databases()->where('id', $subId)->first();
|
||||||
$database->status = $containerStatus;
|
$database->status = $containerStatus;
|
||||||
$database->save();
|
$database->save();
|
||||||
ray('Service database updated', ['service_id' => $serviceId, 'sub_type' => $subType, 'sub_id' => $subId, 'status' => $containerStatus]);
|
|
||||||
} else {
|
} else {
|
||||||
ray()->warning('Unknown sub type', ['service_id' => $serviceId, 'sub_type' => $subType, 'sub_id' => $subId, 'status' => $containerStatus]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,26 +334,20 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$notFoundServiceApplicationIds = $this->allServiceApplicationIds->diff($this->foundServiceApplicationIds);
|
$notFoundServiceApplicationIds = $this->allServiceApplicationIds->diff($this->foundServiceApplicationIds);
|
||||||
$notFoundServiceDatabaseIds = $this->allServiceDatabaseIds->diff($this->foundServiceDatabaseIds);
|
$notFoundServiceDatabaseIds = $this->allServiceDatabaseIds->diff($this->foundServiceDatabaseIds);
|
||||||
if ($notFoundServiceApplicationIds->isNotEmpty()) {
|
if ($notFoundServiceApplicationIds->isNotEmpty()) {
|
||||||
ray('Not found service application ids', ['service_application_ids' => $notFoundServiceApplicationIds]);
|
|
||||||
$notFoundServiceApplicationIds->each(function ($serviceApplicationId) {
|
$notFoundServiceApplicationIds->each(function ($serviceApplicationId) {
|
||||||
ray('Updating service application status', ['service_application_id' => $serviceApplicationId, 'status' => 'exited']);
|
|
||||||
$application = ServiceApplication::find($serviceApplicationId);
|
$application = ServiceApplication::find($serviceApplicationId);
|
||||||
if ($application) {
|
if ($application) {
|
||||||
$application->status = 'exited';
|
$application->status = 'exited';
|
||||||
$application->save();
|
$application->save();
|
||||||
ray('Service application status updated', ['service_application_id' => $serviceApplicationId, 'status' => 'exited']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ($notFoundServiceDatabaseIds->isNotEmpty()) {
|
if ($notFoundServiceDatabaseIds->isNotEmpty()) {
|
||||||
ray('Not found service database ids', ['service_database_ids' => $notFoundServiceDatabaseIds]);
|
|
||||||
$notFoundServiceDatabaseIds->each(function ($serviceDatabaseId) {
|
$notFoundServiceDatabaseIds->each(function ($serviceDatabaseId) {
|
||||||
ray('Updating service database status', ['service_database_id' => $serviceDatabaseId, 'status' => 'exited']);
|
|
||||||
$database = ServiceDatabase::find($serviceDatabaseId);
|
$database = ServiceDatabase::find($serviceDatabaseId);
|
||||||
if ($database) {
|
if ($database) {
|
||||||
$database->status = 'exited';
|
$database->status = 'exited';
|
||||||
$database->save();
|
$database->save();
|
||||||
ray('Service database status updated', ['service_database_id' => $serviceDatabaseId, 'status' => 'exited']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -385,7 +356,6 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
private function updateAdditionalServersStatus()
|
private function updateAdditionalServersStatus()
|
||||||
{
|
{
|
||||||
$this->allApplicationsWithAdditionalServers->each(function ($application) {
|
$this->allApplicationsWithAdditionalServers->each(function ($application) {
|
||||||
ray('Updating additional servers status for application', ['application_id' => $application->id]);
|
|
||||||
ComplexStatusCheck::run($application);
|
ComplexStatusCheck::run($application);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,6 @@ class SendConfirmationForWaitlistJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
send_user_an_email($mail, $this->email);
|
send_user_an_email($mail, $this->email);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification("SendConfirmationForWaitlistJob failed for {$this->email} with error: ".$e->getMessage());
|
send_internal_notification("SendConfirmationForWaitlistJob failed for {$this->email} with error: ".$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -85,7 +85,6 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$this->server->team?->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
$this->server->team?->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->server->proxy->status = data_get($foundProxyContainer, 'State.Status');
|
$this->server->proxy->status = data_get($foundProxyContainer, 'State.Status');
|
||||||
@@ -97,8 +96,6 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,9 +32,7 @@ class ServerLimitCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
$servers_count = $servers->count();
|
$servers_count = $servers->count();
|
||||||
$limit = data_get($this->team->limits, 'serverLimit', 2);
|
$limit = data_get($this->team->limits, 'serverLimit', 2);
|
||||||
$number_of_servers_to_disable = $servers_count - $limit;
|
$number_of_servers_to_disable = $servers_count - $limit;
|
||||||
ray('ServerLimitCheckJob', $this->team->uuid, $servers_count, $limit, $number_of_servers_to_disable);
|
|
||||||
if ($number_of_servers_to_disable > 0) {
|
if ($number_of_servers_to_disable > 0) {
|
||||||
ray('Disabling servers');
|
|
||||||
$servers = $servers->sortbyDesc('created_at');
|
$servers = $servers->sortbyDesc('created_at');
|
||||||
$servers_to_disable = $servers->take($number_of_servers_to_disable);
|
$servers_to_disable = $servers->take($number_of_servers_to_disable);
|
||||||
$servers_to_disable->each(function ($server) {
|
$servers_to_disable->each(function ($server) {
|
||||||
@@ -51,7 +49,6 @@ class ServerLimitCheckJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('ServerLimitCheckJob failed with: '.$e->getMessage());
|
send_internal_notification('ServerLimitCheckJob failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return handleError($e);
|
return handleError($e);
|
||||||
}
|
}
|
||||||
|
@@ -27,14 +27,12 @@ class SubscriptionInvoiceFailedJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
]);
|
]);
|
||||||
$mail->subject('Your last payment was failed for Coolify Cloud.');
|
$mail->subject('Your last payment was failed for Coolify Cloud.');
|
||||||
$this->team->members()->each(function ($member) use ($mail) {
|
$this->team->members()->each(function ($member) use ($mail) {
|
||||||
ray($member);
|
|
||||||
if ($member->isAdmin()) {
|
if ($member->isAdmin()) {
|
||||||
send_user_an_email($mail, $member->email);
|
send_user_an_email($mail, $member->email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('SubscriptionInvoiceFailedJob failed with: '.$e->getMessage());
|
send_internal_notification('SubscriptionInvoiceFailedJob failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,14 +30,12 @@ class SubscriptionTrialEndedJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
]);
|
]);
|
||||||
$this->team->members()->each(function ($member) use ($mail) {
|
$this->team->members()->each(function ($member) use ($mail) {
|
||||||
if ($member->isAdmin()) {
|
if ($member->isAdmin()) {
|
||||||
ray('Sending trial ended email to '.$member->email);
|
|
||||||
send_user_an_email($mail, $member->email);
|
send_user_an_email($mail, $member->email);
|
||||||
send_internal_notification('Trial reminder email sent to '.$member->email);
|
send_internal_notification('Trial reminder email sent to '.$member->email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('SubscriptionTrialEndsSoonJob failed with: '.$e->getMessage());
|
send_internal_notification('SubscriptionTrialEndsSoonJob failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,14 +30,12 @@ class SubscriptionTrialEndsSoonJob implements ShouldBeEncrypted, ShouldQueue
|
|||||||
]);
|
]);
|
||||||
$this->team->members()->each(function ($member) use ($mail) {
|
$this->team->members()->each(function ($member) use ($mail) {
|
||||||
if ($member->isAdmin()) {
|
if ($member->isAdmin()) {
|
||||||
ray('Sending trial ending email to '.$member->email);
|
|
||||||
send_user_an_email($mail, $member->email);
|
send_user_an_email($mail, $member->email);
|
||||||
send_internal_notification('Trial reminder email sent to '.$member->email);
|
send_internal_notification('Trial reminder email sent to '.$member->email);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
send_internal_notification('SubscriptionTrialEndsSoonJob failed with: '.$e->getMessage());
|
send_internal_notification('SubscriptionTrialEndsSoonJob failed with: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@ class MaintenanceModeDisabledNotification
|
|||||||
|
|
||||||
public function handle(EventsMaintenanceModeDisabled $event): void
|
public function handle(EventsMaintenanceModeDisabled $event): void
|
||||||
{
|
{
|
||||||
ray('Maintenance mode disabled!');
|
|
||||||
$files = Storage::disk('webhooks-during-maintenance')->files();
|
$files = Storage::disk('webhooks-during-maintenance')->files();
|
||||||
$files = collect($files);
|
$files = collect($files);
|
||||||
$files = $files->sort();
|
$files = $files->sort();
|
||||||
@@ -41,7 +40,6 @@ class MaintenanceModeDisabledNotification
|
|||||||
$instance = new $class;
|
$instance = new $class;
|
||||||
$instance->$method($request);
|
$instance->$method($request);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
ray($th);
|
|
||||||
} finally {
|
} finally {
|
||||||
Storage::disk('webhooks-during-maintenance')->delete($file);
|
Storage::disk('webhooks-during-maintenance')->delete($file);
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,5 @@ class MaintenanceModeEnabledNotification
|
|||||||
/**
|
/**
|
||||||
* Handle the event.
|
* Handle the event.
|
||||||
*/
|
*/
|
||||||
public function handle(EventsMaintenanceModeEnabled $event): void
|
public function handle(EventsMaintenanceModeEnabled $event): void {}
|
||||||
{
|
|
||||||
ray('Maintenance mode enabled!');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -68,7 +68,6 @@ class NewActivityMonitor extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->dispatch($this->eventToDispatch);
|
$this->dispatch($this->eventToDispatch);
|
||||||
}
|
}
|
||||||
ray('Dispatched event: '.$this->eventToDispatch.' with data: '.$this->eventData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,6 @@ class Discord extends Component
|
|||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
$this->team->discord_enabled = false;
|
$this->team->discord_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,6 @@ class Telegram extends Component
|
|||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e->getMessage());
|
|
||||||
$this->team->telegram_enabled = false;
|
$this->team->telegram_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
@@ -46,8 +46,6 @@ class DeploymentNavbar extends Component
|
|||||||
try {
|
try {
|
||||||
force_start_deployment($this->application_deployment_queue);
|
force_start_deployment($this->application_deployment_queue);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
|
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,8 +79,6 @@ class DeploymentNavbar extends Component
|
|||||||
}
|
}
|
||||||
instant_remote_process([$kill_command], $server);
|
instant_remote_process([$kill_command], $server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
|
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
} finally {
|
} finally {
|
||||||
$this->application_deployment_queue->update([
|
$this->application_deployment_queue->update([
|
||||||
|
@@ -46,7 +46,6 @@ class DockerImage extends Component
|
|||||||
|
|
||||||
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
$project = Project::where('uuid', $this->parameters['project_uuid'])->first();
|
||||||
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
$environment = $project->load(['environments'])->environments->where('name', $this->parameters['environment_name'])->first();
|
||||||
ray($image, $tag);
|
|
||||||
$application = Application::create([
|
$application = Application::create([
|
||||||
'name' => 'docker-image-'.new Cuid2,
|
'name' => 'docker-image-'.new Cuid2,
|
||||||
'repository_project_id' => 0,
|
'repository_project_id' => 0,
|
||||||
|
@@ -153,7 +153,6 @@ class GithubPrivateRepository extends Component
|
|||||||
|
|
||||||
protected function loadBranchByPage()
|
protected function loadBranchByPage()
|
||||||
{
|
{
|
||||||
ray('Loading page '.$this->page);
|
|
||||||
$response = Http::withToken($this->token)->get("{$this->github_app->api_url}/repos/{$this->selected_repository_owner}/{$this->selected_repository_repo}/branches?per_page=100&page={$this->page}");
|
$response = Http::withToken($this->token)->get("{$this->github_app->api_url}/repos/{$this->selected_repository_owner}/{$this->selected_repository_repo}/branches?per_page=100&page={$this->page}");
|
||||||
$json = $response->json();
|
$json = $response->json();
|
||||||
if ($response->status() !== 200) {
|
if ($response->status() !== 200) {
|
||||||
|
@@ -96,7 +96,6 @@ class Database extends Component
|
|||||||
updateCompose($this->database);
|
updateCompose($this->database);
|
||||||
$this->dispatch('success', 'Database saved.');
|
$this->dispatch('success', 'Database saved.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
ray($e);
|
|
||||||
} finally {
|
} finally {
|
||||||
$this->dispatch('generateDockerCompose');
|
$this->dispatch('generateDockerCompose');
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,6 @@ class Navbar extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
if (str($this->service->status())->contains('running') && is_null($this->service->config_hash)) {
|
if (str($this->service->status())->contains('running') && is_null($this->service->config_hash)) {
|
||||||
ray('isConfigurationChanged init');
|
|
||||||
$this->service->isConfigurationChanged(true);
|
$this->service->isConfigurationChanged(true);
|
||||||
$this->dispatch('configurationChanged');
|
$this->dispatch('configurationChanged');
|
||||||
}
|
}
|
||||||
|
@@ -109,7 +109,6 @@ 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']);
|
||||||
});
|
});
|
||||||
ray($this->containers);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,6 @@ class License extends Component
|
|||||||
$this->dispatch('reloadWindow');
|
$this->dispatch('reloadWindow');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
session()->flash('error', 'Something went wrong. Please contact support. <br>Error: '.$e->getMessage());
|
session()->flash('error', 'Something went wrong. Please contact support. <br>Error: '.$e->getMessage());
|
||||||
ray($e->getMessage());
|
|
||||||
|
|
||||||
return redirect()->route('settings.license');
|
return redirect()->route('settings.license');
|
||||||
}
|
}
|
||||||
|
@@ -59,20 +59,16 @@ class AdminView extends Component
|
|||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
$resources = $server->definedResources();
|
$resources = $server->definedResources();
|
||||||
foreach ($resources as $resource) {
|
foreach ($resources as $resource) {
|
||||||
ray('Deleting resource: '.$resource->name);
|
|
||||||
$resource->forceDelete();
|
$resource->forceDelete();
|
||||||
}
|
}
|
||||||
ray('Deleting server: '.$server->name);
|
|
||||||
$server->forceDelete();
|
$server->forceDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$projects = $team->projects;
|
$projects = $team->projects;
|
||||||
foreach ($projects as $project) {
|
foreach ($projects as $project) {
|
||||||
ray('Deleting project: '.$project->name);
|
|
||||||
$project->forceDelete();
|
$project->forceDelete();
|
||||||
}
|
}
|
||||||
$team->members()->detach($user->id);
|
$team->members()->detach($user->id);
|
||||||
ray('Deleting team: '.$team->name);
|
|
||||||
$team->delete();
|
$team->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,29 +87,23 @@ class AdminView extends Component
|
|||||||
$user = User::find($id);
|
$user = User::find($id);
|
||||||
$teams = $user->teams;
|
$teams = $user->teams;
|
||||||
foreach ($teams as $team) {
|
foreach ($teams as $team) {
|
||||||
ray($team->name);
|
|
||||||
$user_alone_in_team = $team->members->count() === 1;
|
$user_alone_in_team = $team->members->count() === 1;
|
||||||
if ($team->id === 0) {
|
if ($team->id === 0) {
|
||||||
if ($user_alone_in_team) {
|
if ($user_alone_in_team) {
|
||||||
ray('user is alone in the root team, do nothing');
|
|
||||||
|
|
||||||
return $this->dispatch('error', 'User is alone in the root team, cannot delete');
|
return $this->dispatch('error', 'User is alone in the root team, cannot delete');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($user_alone_in_team) {
|
if ($user_alone_in_team) {
|
||||||
ray('user is alone in the team');
|
|
||||||
$this->finalizeDeletion($user, $team);
|
$this->finalizeDeletion($user, $team);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ray('user is not alone in the team');
|
|
||||||
if ($user->isOwner()) {
|
if ($user->isOwner()) {
|
||||||
$found_other_owner_or_admin = $team->members->filter(function ($member) {
|
$found_other_owner_or_admin = $team->members->filter(function ($member) {
|
||||||
return $member->pivot->role === 'owner' || $member->pivot->role === 'admin';
|
return $member->pivot->role === 'owner' || $member->pivot->role === 'admin';
|
||||||
})->where('id', '!=', $user->id)->first();
|
})->where('id', '!=', $user->id)->first();
|
||||||
|
|
||||||
if ($found_other_owner_or_admin) {
|
if ($found_other_owner_or_admin) {
|
||||||
ray('found other owner or admin');
|
|
||||||
$team->members()->detach($user->id);
|
$team->members()->detach($user->id);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -122,24 +112,19 @@ class AdminView extends Component
|
|||||||
return $member->pivot->role === 'member';
|
return $member->pivot->role === 'member';
|
||||||
})->first();
|
})->first();
|
||||||
if ($found_other_member_who_is_not_owner) {
|
if ($found_other_member_who_is_not_owner) {
|
||||||
ray('found other member who is not owner');
|
|
||||||
$found_other_member_who_is_not_owner->pivot->role = 'owner';
|
$found_other_member_who_is_not_owner->pivot->role = 'owner';
|
||||||
$found_other_member_who_is_not_owner->pivot->save();
|
$found_other_member_who_is_not_owner->pivot->save();
|
||||||
$team->members()->detach($user->id);
|
$team->members()->detach($user->id);
|
||||||
} else {
|
} else {
|
||||||
// This should never happen as if the user is the only member in the team, the team should be deleted already.
|
|
||||||
ray('found no other member who is not owner');
|
|
||||||
$this->finalizeDeletion($user, $team);
|
$this->finalizeDeletion($user, $team);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ray('user is not owner');
|
|
||||||
$team->members()->detach($user->id);
|
$team->members()->detach($user->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray('Deleting user: '.$user->name);
|
|
||||||
$user->delete();
|
$user->delete();
|
||||||
$this->getUsers();
|
$this->getUsers();
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,6 @@ class VerifyEmail extends Component
|
|||||||
$this->dispatch('success', 'Email verification link sent!');
|
$this->dispatch('success', 'Email verification link sent!');
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
ray($e);
|
|
||||||
|
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -221,7 +221,6 @@ class Application extends BaseModel
|
|||||||
{
|
{
|
||||||
if ($this->build_pack === 'dockercompose') {
|
if ($this->build_pack === 'dockercompose') {
|
||||||
$server = data_get($this, 'destination.server');
|
$server = data_get($this, 'destination.server');
|
||||||
ray('Deleting volumes');
|
|
||||||
instant_remote_process(["cd {$this->dirOnServer()} && docker compose down -v"], $server, false);
|
instant_remote_process(["cd {$this->dirOnServer()} && docker compose down -v"], $server, false);
|
||||||
} else {
|
} else {
|
||||||
if ($persistentStorages->count() === 0) {
|
if ($persistentStorages->count() === 0) {
|
||||||
@@ -1246,13 +1245,11 @@ class Application extends BaseModel
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (base64_encode(base64_decode($customLabels, true)) !== $customLabels) {
|
if (base64_encode(base64_decode($customLabels, true)) !== $customLabels) {
|
||||||
ray('custom_labels is not base64 encoded');
|
|
||||||
$this->custom_labels = str($customLabels)->replace(',', "\n");
|
$this->custom_labels = str($customLabels)->replace(',', "\n");
|
||||||
$this->custom_labels = base64_encode($customLabels);
|
$this->custom_labels = base64_encode($customLabels);
|
||||||
}
|
}
|
||||||
$customLabels = base64_decode($this->custom_labels);
|
$customLabels = base64_decode($this->custom_labels);
|
||||||
if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
|
if (mb_detect_encoding($customLabels, 'ASCII', true) === false) {
|
||||||
ray('custom_labels contains non-ascii characters');
|
|
||||||
$customLabels = str(implode('|coolify|', generateLabelsApplication($this, $preview)))->replace('|coolify|', "\n");
|
$customLabels = str(implode('|coolify|', generateLabelsApplication($this, $preview)))->replace('|coolify|', "\n");
|
||||||
}
|
}
|
||||||
$this->custom_labels = base64_encode($customLabels);
|
$this->custom_labels = base64_encode($customLabels);
|
||||||
@@ -1478,7 +1475,7 @@ class Application extends BaseModel
|
|||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setConfig($config)
|
public function setConfig($config)
|
||||||
{
|
{
|
||||||
$validator = Validator::make(['config' => $config], [
|
$validator = Validator::make(['config' => $config], [
|
||||||
|
@@ -27,7 +27,6 @@ class Environment extends Model
|
|||||||
static::deleting(function ($environment) {
|
static::deleting(function ($environment) {
|
||||||
$shared_variables = $environment->environment_variables();
|
$shared_variables = $environment->environment_variables();
|
||||||
foreach ($shared_variables as $shared_variable) {
|
foreach ($shared_variables as $shared_variable) {
|
||||||
ray('Deleting environment shared variable: '.$shared_variable->name);
|
|
||||||
$shared_variable->delete();
|
$shared_variable->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,6 @@ class Project extends BaseModel
|
|||||||
$project->settings()->delete();
|
$project->settings()->delete();
|
||||||
$shared_variables = $project->environment_variables();
|
$shared_variables = $project->environment_variables();
|
||||||
foreach ($shared_variables as $shared_variable) {
|
foreach ($shared_variables as $shared_variable) {
|
||||||
ray('Deleting project shared variable: '.$shared_variable->name);
|
|
||||||
$shared_variable->delete();
|
$shared_variable->delete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -366,7 +366,6 @@ class Service extends BaseModel
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_LANGFUSE')->first();
|
$password = $this->environment_variables()->where('key', 'SERVICE_PASSWORD_LANGFUSE')->first();
|
||||||
ray('password', $password);
|
|
||||||
if ($password) {
|
if ($password) {
|
||||||
$data = $data->merge([
|
$data = $data->merge([
|
||||||
'Admin Password' => [
|
'Admin Password' => [
|
||||||
@@ -1108,7 +1107,6 @@ class Service extends BaseModel
|
|||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
$key = data_get($field, 'key');
|
$key = data_get($field, 'key');
|
||||||
$value = data_get($field, 'value');
|
$value = data_get($field, 'value');
|
||||||
ray($key, $value);
|
|
||||||
$found = $this->environment_variables()->where('key', $key)->first();
|
$found = $this->environment_variables()->where('key', $key)->first();
|
||||||
if ($found) {
|
if ($found) {
|
||||||
$found->value = $value;
|
$found->value = $value;
|
||||||
|
@@ -71,7 +71,6 @@ class StandalonePostgresql extends BaseModel
|
|||||||
}
|
}
|
||||||
$server = data_get($this, 'destination.server');
|
$server = data_get($this, 'destination.server');
|
||||||
foreach ($persistentStorages as $storage) {
|
foreach ($persistentStorages as $storage) {
|
||||||
ray('Deleting volume: '.$storage->name);
|
|
||||||
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
|
instant_remote_process(["docker volume rm -f $storage->name"], $server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -93,27 +93,22 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
|||||||
static::deleting(function ($team) {
|
static::deleting(function ($team) {
|
||||||
$keys = $team->privateKeys;
|
$keys = $team->privateKeys;
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
ray('Deleting key: '.$key->name);
|
|
||||||
$key->delete();
|
$key->delete();
|
||||||
}
|
}
|
||||||
$sources = $team->sources();
|
$sources = $team->sources();
|
||||||
foreach ($sources as $source) {
|
foreach ($sources as $source) {
|
||||||
ray('Deleting source: '.$source->name);
|
|
||||||
$source->delete();
|
$source->delete();
|
||||||
}
|
}
|
||||||
$tags = Tag::whereTeamId($team->id)->get();
|
$tags = Tag::whereTeamId($team->id)->get();
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
ray('Deleting tag: '.$tag->name);
|
|
||||||
$tag->delete();
|
$tag->delete();
|
||||||
}
|
}
|
||||||
$shared_variables = $team->environment_variables();
|
$shared_variables = $team->environment_variables();
|
||||||
foreach ($shared_variables as $shared_variable) {
|
foreach ($shared_variables as $shared_variable) {
|
||||||
ray('Deleting team shared variable: '.$shared_variable->name);
|
|
||||||
$shared_variable->delete();
|
$shared_variable->delete();
|
||||||
}
|
}
|
||||||
$s3s = $team->s3s;
|
$s3s = $team->s3s;
|
||||||
foreach ($s3s as $s3) {
|
foreach ($s3s as $s3) {
|
||||||
ray('Deleting s3: '.$s3->name);
|
|
||||||
$s3->delete();
|
$s3->delete();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -32,7 +32,6 @@ class EmailChannel
|
|||||||
if ($error === 'No email settings found.') {
|
if ($error === 'No email settings found.') {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
ray($e->getMessage());
|
|
||||||
$message = "EmailChannel error: {$e->getMessage()}. Failed to send email to:";
|
$message = "EmailChannel error: {$e->getMessage()}. Failed to send email to:";
|
||||||
if (isset($recipients)) {
|
if (isset($recipients)) {
|
||||||
$message .= implode(', ', $recipients);
|
$message .= implode(', ', $recipients);
|
||||||
|
@@ -61,7 +61,6 @@ class BackupSuccess extends Notification implements ShouldQueue
|
|||||||
public function toTelegram(): array
|
public function toTelegram(): array
|
||||||
{
|
{
|
||||||
$message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was successful.";
|
$message = "Coolify: Database backup for {$this->name} (db:{$this->database_name}) with frequency of {$this->frequency} was successful.";
|
||||||
ray($message);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
|
@@ -33,7 +33,6 @@ class PopulateSshKeysDirectorySeeder extends Seeder
|
|||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
echo "Error: {$e->getMessage()}\n";
|
echo "Error: {$e->getMessage()}\n";
|
||||||
ray($e->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -245,7 +245,6 @@ Route::middleware(['auth'])->group(function () {
|
|||||||
Route::post('/upload/backup/{databaseUuid}', [UploadController::class, 'upload'])->name('upload.backup');
|
Route::post('/upload/backup/{databaseUuid}', [UploadController::class, 'upload'])->name('upload.backup');
|
||||||
Route::get('/download/backup/{executionId}', function () {
|
Route::get('/download/backup/{executionId}', function () {
|
||||||
try {
|
try {
|
||||||
ray()->clearAll();
|
|
||||||
$team = auth()->user()->currentTeam();
|
$team = auth()->user()->currentTeam();
|
||||||
if (is_null($team)) {
|
if (is_null($team)) {
|
||||||
return response()->json(['message' => 'Team not found.'], 404);
|
return response()->json(['message' => 'Team not found.'], 404);
|
||||||
|
@@ -172,9 +172,6 @@ afterEach(function () {
|
|||||||
test('ServiceComposeParseNew', function () {
|
test('ServiceComposeParseNew', function () {
|
||||||
$output = newParser($this->service);
|
$output = newParser($this->service);
|
||||||
$this->service->saveComposeConfigs();
|
$this->service->saveComposeConfigs();
|
||||||
// ray('New parser');
|
|
||||||
// ray($output->toArray());
|
|
||||||
ray($this->service->environment_variables->pluck('value', 'key')->toArray());
|
|
||||||
expect($output)->toBeInstanceOf(Collection::class);
|
expect($output)->toBeInstanceOf(Collection::class);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user