fix: proxy connections

This commit is contained in:
Andras Bacsai 2023-09-22 08:52:07 +02:00
parent ebfc0bd1e1
commit 4ae7e46e81
4 changed files with 6 additions and 5 deletions

View File

@ -78,7 +78,7 @@ class StandaloneDocker extends Component
private function createNetworkAndAttachToProxy() private function createNetworkAndAttachToProxy()
{ {
instant_remote_process(['docker network create --attachable ' . $this->network], $this->server, throwError: false); $connectProxyToDockerNetworks = connectProxyToNetworks($this->server);
instant_remote_process(["docker network connect $this->network coolify-proxy"], $this->server, throwError: false); instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
} }
} }

View File

@ -90,7 +90,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
$this->server->proxy->status = data_get($foundProxyContainer, 'State.Status'); $this->server->proxy->status = data_get($foundProxyContainer, 'State.Status');
$this->server->save(); $this->server->save();
$connectProxyToDockerNetworks = connectProxyToNetworks($this->server); $connectProxyToDockerNetworks = connectProxyToNetworks($this->server);
instant_remote_process([$connectProxyToDockerNetworks], $this->server, false); instant_remote_process($connectProxyToDockerNetworks, $this->server, false);
} }
$foundApplications = []; $foundApplications = [];
$foundApplicationPreviews = []; $foundApplicationPreviews = [];

View File

@ -20,11 +20,10 @@ function connectProxyToNetworks(Server $server) {
$commands = $networks->map(function ($network) { $commands = $networks->map(function ($network) {
return [ return [
"echo '####### Connecting coolify-proxy to $network network...'", "echo '####### Connecting coolify-proxy to $network network...'",
"docker network ls --format '{{.Name}}' | grep '^$network$' >/dev/null 2>&1 || docker network create --attachable $network > /dev/null 2>&1", "docker network ls --format '{{.Name}}' | grep '^$network$' || docker network create --attachable $network",
"docker network connect $network coolify-proxy >/dev/null 2>&1 || true", "docker network connect $network coolify-proxy >/dev/null 2>&1 || true",
]; ];
}); });
return $commands->flatten(); return $commands->flatten();
} }
function generate_default_proxy_configuration(Server $server) function generate_default_proxy_configuration(Server $server)

View File

@ -83,6 +83,7 @@ function refreshSession(?Team $team = null): void
function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null) function handleError(?Throwable $error = null, ?Livewire\Component $livewire = null, ?string $customErrorMessage = null)
{ {
ray('handleError'); ray('handleError');
ray($error);
if ($error instanceof Throwable) { if ($error instanceof Throwable) {
$message = $error->getMessage(); $message = $error->getMessage();
} else { } else {
@ -100,6 +101,7 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n
if (isset($livewire)) { if (isset($livewire)) {
return $livewire->emit('error', $message); return $livewire->emit('error', $message);
} }
throw new RuntimeException($message); throw new RuntimeException($message);
} }
function general_error_handler(Throwable $err, Livewire\Component $that = null, $isJson = false, $customErrorMessage = null): mixed function general_error_handler(Throwable $err, Livewire\Component $that = null, $isJson = false, $customErrorMessage = null): mixed