diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 508164afe..a0195d1b9 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -12,6 +12,7 @@ use App\Models\ApplicationPreview; use App\Models\EnvironmentVariable; use App\Models\GithubApp; use App\Models\GitlabApp; +use App\Models\InstanceSettings; use App\Models\Server; use App\Models\StandaloneDocker; use App\Models\SwarmDocker; @@ -1293,7 +1294,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue private function prepare_builder_image() { + $settings = InstanceSettings::get(); $helperImage = config('coolify.helper_image'); + $helperImage = "{$helperImage}:{$settings->helper_version}"; // Get user home directory $this->serverUserHomeDir = instant_remote_process(['echo $HOME'], $this->server); $this->dockerConfigFileExists = instant_remote_process(["test -f {$this->serverUserHomeDir}/.docker/config.json && echo 'OK' || echo 'NOK'"], $this->server); diff --git a/app/Jobs/CheckLogDrainContainerJob.php b/app/Jobs/CheckLogDrainContainerJob.php deleted file mode 100644 index 16ef85192..000000000 --- a/app/Jobs/CheckLogDrainContainerJob.php +++ /dev/null @@ -1,93 +0,0 @@ -server->id))->dontRelease()]; - } - - public function uniqueId(): int - { - return $this->server->id; - } - - public function healthcheck() - { - $status = instant_remote_process(["docker inspect --format='{{json .State.Status}}' coolify-log-drain"], $this->server, false); - if (str($status)->contains('running')) { - return true; - } else { - return false; - } - } - - public function handle() - { - // ray("checking log drain statuses for {$this->server->id}"); - try { - if (! $this->server->isFunctional()) { - return; - } - $containers = instant_remote_process(['docker container ls -q'], $this->server, false); - if (! $containers) { - return; - } - $containers = instant_remote_process(["docker container inspect $(docker container ls -q) --format '{{json .}}'"], $this->server); - $containers = format_docker_command_output_to_json($containers); - - $foundLogDrainContainer = $containers->filter(function ($value, $key) { - return data_get($value, 'Name') === '/coolify-log-drain'; - })->first(); - if (! $foundLogDrainContainer || ! $this->healthcheck()) { - ray('Log drain container not found or unhealthy. Restarting...'); - InstallLogDrain::run($this->server); - Sleep::for(10)->seconds(); - if ($this->healthcheck()) { - if ($this->server->log_drain_notification_sent) { - $this->server->team?->notify(new ContainerRestarted('Coolify Log Drainer', $this->server)); - $this->server->update(['log_drain_notification_sent' => false]); - } - - return; - } - if (! $this->server->log_drain_notification_sent) { - ray('Log drain container still unhealthy. Sending notification...'); - // $this->server->team?->notify(new ContainerStopped('Coolify Log Drainer', $this->server, null)); - $this->server->update(['log_drain_notification_sent' => true]); - } - } else { - if ($this->server->log_drain_notification_sent) { - $this->server->team?->notify(new ContainerRestarted('Coolify Log Drainer', $this->server)); - $this->server->update(['log_drain_notification_sent' => false]); - } - } - } catch (\Throwable $e) { - if (! isCloud()) { - send_internal_notification("CheckLogDrainContainerJob failed on ({$this->server->id}) with: ".$e->getMessage()); - } - ray($e->getMessage()); - - return handleError($e); - } - } -} diff --git a/app/Jobs/PullHelperImageJob.php b/app/Jobs/PullHelperImageJob.php index e1afec4b0..420119069 100644 --- a/app/Jobs/PullHelperImageJob.php +++ b/app/Jobs/PullHelperImageJob.php @@ -12,7 +12,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Http; -use Illuminate\Support\Facades\Log; class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue { @@ -41,16 +40,11 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue $settings = InstanceSettings::get(); $latest_version = data_get($versions, 'coolify.helper.version'); $current_version = $settings->helper_version; - Log::info('Latest version', $latest_version); - Log::info('Current version', $current_version); if (version_compare($latest_version, $current_version, '>')) { // New version available - Log::info('New version available', $latest_version); $helperImage = config('coolify.helper_image'); - // REMOVE -next - instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}-next"], $this->server); + instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}"], $this->server); $settings->update(['helper_version' => $latest_version]); - Log::info('Pulled helper image', $helperImage, $latest_version); } }