An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
ignore command center errors
Andras Bacsai6e084db3d971
diff --git a/app/Actions/CoolifyTask/PrepareCoolifyTask.php b/app/Actions/CoolifyTask/PrepareCoolifyTask.phpindex c67a8bcb32..263cd329e1 100644--- a/app/Actions/CoolifyTask/PrepareCoolifyTask.php+++ b/app/Actions/CoolifyTask/PrepareCoolifyTask.php@@ -14,9 +14,11 @@ use Spatie\Activitylog\Models\Activity;class PrepareCoolifyTask{protected Activity $activity;-+ protected CoolifyTaskArgs $remoteProcessArgs;public function __construct(CoolifyTaskArgs $remoteProcessArgs){+ $this->remoteProcessArgs = $remoteProcessArgs;+if ($remoteProcessArgs->model) {$properties = $remoteProcessArgs->toArray();unset($properties['model']);@@ -36,7 +38,7 @@ class PrepareCoolifyTaskpublic function __invoke(): Activity{- $job = new CoolifyTask($this->activity);+ $job = new CoolifyTask($this->activity, ignore_errors: $this->remoteProcessArgs->ignore_errors);dispatch($job);$this->activity->refresh();return $this->activity;diff --git a/app/Actions/CoolifyTask/RunRemoteProcess.php b/app/Actions/CoolifyTask/RunRemoteProcess.phpindex 45040b7178..70b40b48bb 100644--- a/app/Actions/CoolifyTask/RunRemoteProcess.php+++ b/app/Actions/CoolifyTask/RunRemoteProcess.php@@ -17,26 +17,26 @@ class RunRemoteProcess{public Activity $activity;- public bool $hideFromOutput;+ public bool $hide_from_output;- public bool $isFinished;+ public bool $is_finished;- public bool $ignoreErrors;+ public bool $ignore_errors;- protected $timeStart;+ protected $time_start;- protected $currentTime;+ protected $current_time;- protected $lastWriteAt = 0;+ protected $last_write_at = 0;- protected $throttleIntervalMS = 500;+ protected $throttle_interval_ms = 500;protected int $counter = 1;/*** Create a new job instance.*/- public function __construct(Activity $activity, bool $hideFromOutput = false, bool $isFinished = false, bool $ignoreErrors = false)+ public function __construct(Activity $activity, bool $hide_from_output = false, bool $is_finished = false, bool $ignore_errors = false){if ($activity->getExtraProperty('type') !== ActivityTypes::INLINE->value && $activity->getExtraProperty('type') !== ActivityTypes::DEPLOYMENT->value) {@@ -44,14 +44,14 @@ class RunRemoteProcess}$this->activity = $activity;- $this->hideFromOutput = $hideFromOutput;- $this->isFinished = $isFinished;- $this->ignoreErrors = $ignoreErrors;+ $this->hide_from_output = $hide_from_output;+ $this->is_finished = $is_finished;+ $this->ignore_errors = $ignore_errors;}public function __invoke(): ProcessResult{- $this->timeStart = hrtime(true);+ $this->time_start = hrtime(true);$status = ProcessStatus::IN_PROGRESS;@@ -60,10 +60,10 @@ class RunRemoteProcessif ($this->activity->properties->get('status') === ProcessStatus::ERROR->value) {$status = ProcessStatus::ERROR;} else {- if (($processResult->exitCode() == 0 && $this->isFinished) || $this->activity->properties->get('status') === ProcessStatus::FINISHED->value) {+ if (($processResult->exitCode() == 0 && $this->is_finished) || $this->activity->properties->get('status') === ProcessStatus::FINISHED->value) {$status = ProcessStatus::FINISHED;}- if ($processResult->exitCode() != 0 && !$this->ignoreErrors) {+ if ($processResult->exitCode() != 0 && !$this->ignore_errors) {$status = ProcessStatus::ERROR;}}@@ -76,7 +76,7 @@ class RunRemoteProcess]);$this->activity->save();- if ($processResult->exitCode() != 0 && !$this->ignoreErrors) {+ if ($processResult->exitCode() != 0 && !$this->ignore_errors) {throw new \RuntimeException($processResult->errorOutput());}@@ -105,17 +105,17 @@ class RunRemoteProcessprotected function handleOutput(string $type, string $output){- if ($this->hideFromOutput) {+ if ($this->hide_from_output) {return;}- $this->currentTime = $this->elapsedTime();+ $this->current_time = $this->elapsedTime();$this->activity->description = $this->encodeOutput($type, $output);if ($this->isAfterLastThrottle()) {// Let's write to database.DB::transaction(function () {$this->activity->save();- $this->lastWriteAt = $this->currentTime;+ $this->last_write_at = $this->current_time;});}}@@ -165,16 +165,16 @@ class RunRemoteProcessprotected function isAfterLastThrottle(){// If DB was never written, then we immediately decide we have to write.- if ($this->lastWriteAt === 0) {+ if ($this->last_write_at === 0) {return true;}- return ($this->currentTime - $this->throttleIntervalMS) > $this->lastWriteAt;+ return ($this->current_time - $this->throttle_interval_ms) > $this->last_write_at;}protected function elapsedTime(): int{- $timeMs = (hrtime(true) - $this->timeStart) / 1_000_000;+ $timeMs = (hrtime(true) - $this->time_start) / 1_000_000;return intval($timeMs);}diff --git a/app/Data/CoolifyTaskArgs.php b/app/Data/CoolifyTaskArgs.phpindex 2a8865b24b..1b30126f08 100644--- a/app/Data/CoolifyTaskArgs.php+++ b/app/Data/CoolifyTaskArgs.php@@ -21,6 +21,7 @@ class CoolifyTaskArgs extends Datapublic ?string $type_uuid = null,public ?Model $model = null,public string $status = ProcessStatus::QUEUED->value,+ public bool $ignore_errors = false,) {}}diff --git a/app/Http/Livewire/RunCommand.php b/app/Http/Livewire/RunCommand.phpindex 474e91cdce..ea5d5596e6 100755--- a/app/Http/Livewire/RunCommand.php+++ b/app/Http/Livewire/RunCommand.php@@ -26,7 +26,7 @@ class RunCommand extends Component{try {$this->validate();- $activity = remote_process([$this->command], Server::where('uuid', $this->server)->first());+ $activity = remote_process([$this->command], Server::where('uuid', $this->server)->first(), ignore_errors: true);$this->emit('newMonitorActivity', $activity->id);} catch (\Exception $e) {return general_error_handler($e);diff --git a/app/Jobs/CoolifyTask.php b/app/Jobs/CoolifyTask.phpindex df4b0e8cc8..56914a2163 100755--- a/app/Jobs/CoolifyTask.php+++ b/app/Jobs/CoolifyTask.php@@ -19,6 +19,7 @@ class CoolifyTask implements ShouldQueue*/public function __construct(public Activity $activity,+ public bool $ignore_errors = false,) {}@@ -27,8 +28,10 @@ class CoolifyTask implements ShouldQueue*/public function handle(): void{+$remote_process = resolve(RunRemoteProcess::class, ['activity' => $this->activity,+ 'ignore_errors' => $this->ignore_errors,]);$remote_process();diff --git a/bootstrap/helpers/remoteProcess.php b/bootstrap/helpers/remoteProcess.phpindex 62bb325f00..9c63aa4384 100644--- a/bootstrap/helpers/remoteProcess.php+++ b/bootstrap/helpers/remoteProcess.php@@ -21,6 +21,7 @@ function remote_process(string $type = ActivityTypes::INLINE->value,?string $type_uuid = null,?Model $model = null,+ bool $ignore_errors = false): Activity {$command_string = implode("\n", $command);@@ -42,6 +43,7 @@ function remote_process(type: $type,type_uuid: $type_uuid,model: $model,+ ignore_errors: $ignore_errors),])();}