fix: proxy status
fix: start proxy in case any dns set somewhere
This commit is contained in:
@@ -107,7 +107,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
ray()->measure();
|
||||
// ray()->measure();
|
||||
$this->application_deployment_queue->update([
|
||||
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
||||
]);
|
||||
@@ -117,6 +117,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
||||
} else {
|
||||
$this->deploy();
|
||||
}
|
||||
if ($this->application->fqdn) dispatch(new ProxyCheckJob($this->server));
|
||||
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
||||
} catch (\Exception $e) {
|
||||
ray($e);
|
||||
@@ -131,7 +132,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
||||
"hidden" => true,
|
||||
]
|
||||
);
|
||||
ray()->measure();
|
||||
// ray()->measure();
|
||||
}
|
||||
}
|
||||
public function failed(Throwable $exception): void
|
||||
@@ -647,4 +648,4 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
||||
);
|
||||
$this->commit = $this->saved_outputs->get('git_commit_sha');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,30 +15,33 @@ class ProxyCheckJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
public function __construct(protected Server|null $server)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$container_name = 'coolify-proxy';
|
||||
$servers = Server::whereRelation('settings', 'is_usable', true)->where('proxy->type', ProxyTypes::TRAEFIK_V2)->get();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
$status = get_container_status(server: $server, container_id: $container_name);
|
||||
if ($this->server) {
|
||||
ray('Checking proxy for server: ' . $this->server->name);
|
||||
$status = get_container_status(server: $this->server, container_id: $container_name);
|
||||
if ($status === 'running') {
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
resolve(InstallProxy::class)($this->server);
|
||||
} else {
|
||||
$servers = Server::whereRelation('settings', 'is_usable', true)->get();
|
||||
|
||||
foreach ($servers as $server) {
|
||||
$status = get_container_status(server: $server, container_id: $container_name);
|
||||
if ($status === 'running') {
|
||||
continue;
|
||||
}
|
||||
resolve(InstallProxy::class)($server);
|
||||
}
|
||||
resolve(InstallProxy::class)($server);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
ray($th->getMessage());
|
||||
//throw $th;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,10 @@ class ProxyContainerStatusJob implements ShouldQueue, ShouldBeUnique
|
||||
$this->server->save();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
ray($e->getMessage());
|
||||
if ($e->getCode() === 1) {
|
||||
$this->server->proxy->status = 'exited';
|
||||
$this->server->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user