This commit is contained in:
Andras Bacsai
2023-06-20 20:19:31 +02:00
parent 9f0ca1cc2e
commit 3bdea4c931
15 changed files with 50 additions and 46 deletions

View File

@@ -3,8 +3,6 @@
namespace App\Jobs;
use App\Enums\ProxyTypes;
use App\Models\Application;
use App\Models\ApplicationPreview;
use App\Models\Server;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
@@ -12,8 +10,8 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Str;
use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Support\Str;
class ProxyContainerStatusJob implements ShouldQueue, ShouldBeUnique
{
@@ -39,13 +37,13 @@ class ProxyContainerStatusJob implements ShouldQueue, ShouldBeUnique
try {
$container = get_container_status(server: $this->server, all_data: true, container_id: 'coolify-proxy', throwError: true);
$status = $container['State']['Status'];
if ($this->server->extra_attributes->proxy_status !== $status) {
$this->server->extra_attributes->proxy_status = $status;
if ($this->server->extra_attributes->proxy_status === 'running') {
if ($this->server->proxy->status !== $status) {
$this->server->proxy->status = $status;
if ($this->server->proxy->status === 'running') {
$traefik = $container['Config']['Labels']['org.opencontainers.image.title'];
$version = $container['Config']['Labels']['org.opencontainers.image.version'];
if (isset($version) && isset($traefik) && $traefik === 'Traefik' && Str::of($version)->startsWith('v2')) {
$this->server->extra_attributes->proxy_type = ProxyTypes::TRAEFIK_V2->value;
$this->server->proxy->type = ProxyTypes::TRAEFIK_V2->value;
}
}
$this->server->save();