An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Fix: Traefik proxy startup issues - handle null versions and filter predefined networks
Andras Bacsaicb0f2301f520
diff --git a/app/Livewire/Server/Navbar.php b/app/Livewire/Server/Navbar.phpindex 4e34819126..6725e5d0ac 100644--- a/app/Livewire/Server/Navbar.php+++ b/app/Livewire/Server/Navbar.php@@ -10,6 +10,7 @@ use App\Jobs\CheckTraefikVersionForServerJob;use App\Models\Server;use App\Services\ProxyDashboardCacheService;use Illuminate\Foundation\Auth\Access\AuthorizesRequests;+use Illuminate\Support\Facades\Log;use Livewire\Component;class Navbar extends Component@@ -72,7 +73,15 @@ class Navbar extends Component// Check Traefik version after restart to provide immediate feedbackif ($this->server->proxyType() === ProxyTypes::TRAEFIK->value) {- CheckTraefikVersionForServerJob::dispatch($this->server, get_traefik_versions());+ $traefikVersions = get_traefik_versions();+ if ($traefikVersions !== null) {+ CheckTraefikVersionForServerJob::dispatch($this->server, $traefikVersions);+ } else {+ Log::warning('Traefik version check skipped: versions.json data unavailable', [+ 'server_id' => $this->server->id,+ 'server_name' => $this->server->name,+ ]);+ }}} catch (\Throwable $e) {return handleError($e, $this);diff --git a/app/Livewire/Server/Proxy.php b/app/Livewire/Server/Proxy.phpindex 49d8722104..bd0590d5e1 100644--- a/app/Livewire/Server/Proxy.php+++ b/app/Livewire/Server/Proxy.php@@ -79,12 +79,11 @@ class Proxy extends Component// Load from global cached helper (Redis + filesystem)$versionsData = get_versions_data();- $this->cachedVersionsFile = $versionsData;-if (! $versionsData) {return null;}+ $this->cachedVersionsFile = $versionsData;$traefikVersions = data_get($versionsData, 'traefik');return is_array($traefikVersions) ? $traefikVersions : null;diff --git a/bootstrap/helpers/proxy.php b/bootstrap/helpers/proxy.phpindex 6672f8b6f2..ac52c0af8c 100644--- a/bootstrap/helpers/proxy.php+++ b/bootstrap/helpers/proxy.php@@ -6,6 +6,20 @@ use App\Models\Application;use App\Models\Server;use Symfony\Component\Yaml\Yaml;+/**+ * Check if a network name is a Docker predefined system network.+ * These networks cannot be created, modified, or managed by docker network commands.+ *+ * @param string $network Network name to check+ * @return bool True if it's a predefined network that should be skipped+ */+function isDockerPredefinedNetwork(string $network): bool+{+ // Only filter 'default' and 'host' to match existing codebase patterns+ // See: bootstrap/helpers/parsers.php:891, bootstrap/helpers/shared.php:689,748+ return in_array($network, ['default', 'host'], true);+}+function collectProxyDockerNetworksByServer(Server $server){if (! $server->isFunctional()) {@@ -66,8 +80,12 @@ function collectDockerNetworksByServer(Server $server)$networks->push($network);$allNetworks->push($network);}- $networks = collect($networks)->flatten()->unique();- $allNetworks = $allNetworks->flatten()->unique();+ $networks = collect($networks)->flatten()->unique()->filter(function ($network) {+ return ! isDockerPredefinedNetwork($network);+ });+ $allNetworks = $allNetworks->flatten()->unique()->filter(function ($network) {+ return ! isDockerPredefinedNetwork($network);+ });if ($server->isSwarm()) {if ($networks->count() === 0) {$networks = collect(['coolify-overlay']);@@ -219,8 +237,8 @@ function generateDefaultProxyConfiguration(Server $server, array $custom_command$array_of_networks = collect([]);$filtered_networks = collect([]);$networks->map(function ($network) use ($array_of_networks, $filtered_networks) {- if ($network === 'host') {- return; // network-scoped alias is supported only for containers in user defined networks+ if (isDockerPredefinedNetwork($network)) {+ return; // Predefined networks cannot be used in network configuration}$array_of_networks[$network] = [diff --git a/tests/Unit/ProxyHelperTest.php b/tests/Unit/ProxyHelperTest.phpindex 563d9df1bf..3d5da695cb 100644--- a/tests/Unit/ProxyHelperTest.php+++ b/tests/Unit/ProxyHelperTest.php@@ -153,3 +153,39 @@ it('compares branches for minor upgrades', function () {expect($result)->toBeTrue();});++it('identifies default as predefined network', function () {+ expect(isDockerPredefinedNetwork('default'))->toBeTrue();+});++it('identifies host as predefined network', function () {+ expect(isDockerPredefinedNetwork('host'))->toBeTrue();+});++it('identifies coolify as not predefined network', function () {+ expect(isDockerPredefinedNetwork('coolify'))->toBeFalse();+});++it('identifies coolify-overlay as not predefined network', function () {+ expect(isDockerPredefinedNetwork('coolify-overlay'))->toBeFalse();+});++it('identifies custom networks as not predefined', function () {+ $customNetworks = ['my-network', 'app-network', 'custom-123'];++ foreach ($customNetworks as $network) {+ expect(isDockerPredefinedNetwork($network))->toBeFalse();+ }+});++it('identifies bridge as not predefined (per codebase pattern)', function () {+ // 'bridge' is technically a Docker predefined network, but existing codebase+ // only filters 'default' and 'host', so we maintain consistency+ expect(isDockerPredefinedNetwork('bridge'))->toBeFalse();+});++it('identifies none as not predefined (per codebase pattern)', function () {+ // 'none' is technically a Docker predefined network, but existing codebase+ // only filters 'default' and 'host', so we maintain consistency+ expect(isDockerPredefinedNetwork('none'))->toBeFalse();+});