Refactor PushServerUpdateJob to handle container restart notifications
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Models\ApplicationPreview;
|
|||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Models\ServiceApplication;
|
use App\Models\ServiceApplication;
|
||||||
use App\Models\ServiceDatabase;
|
use App\Models\ServiceDatabase;
|
||||||
|
use App\Notifications\Container\ContainerRestarted;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
@@ -280,6 +281,7 @@ class PushServerUpdateJob implements ShouldQueue
|
|||||||
try {
|
try {
|
||||||
if (CheckProxy::run($this->server)) {
|
if (CheckProxy::run($this->server)) {
|
||||||
StartProxy::run($this->server, false);
|
StartProxy::run($this->server, false);
|
||||||
|
$this->server->team?->notify(new ContainerRestarted('coolify-proxy', $this->server));
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
}
|
}
|
||||||
@@ -307,6 +309,7 @@ class PushServerUpdateJob implements ShouldQueue
|
|||||||
if (! $tcpProxyContainerFound) {
|
if (! $tcpProxyContainerFound) {
|
||||||
ray('Starting TCP proxy for database', ['database_uuid' => $databaseUuid]);
|
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));
|
||||||
} else {
|
} else {
|
||||||
ray('TCP proxy for database found in containers', ['database_uuid' => $databaseUuid]);
|
ray('TCP proxy for database found in containers', ['database_uuid' => $databaseUuid]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user