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(database): prevent malformed URLs when server IP is empty
Andras Bacsai4cc668253ea9
diff --git a/app/Models/StandaloneClickhouse.php b/app/Models/StandaloneClickhouse.phpindex 146ee0a2d6..6ac6856189 100644--- a/app/Models/StandaloneClickhouse.php+++ b/app/Models/StandaloneClickhouse.php@@ -243,10 +243,14 @@ class StandaloneClickhouse extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$encodedUser = rawurlencode($this->clickhouse_admin_user);$encodedPass = rawurlencode($this->clickhouse_admin_password);- return "clickhouse://{$encodedUser}:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/{$this->clickhouse_db}";+ return "clickhouse://{$encodedUser}:{$encodedPass}@{$serverIp}:{$this->public_port}/{$this->clickhouse_db}";}return null;diff --git a/app/Models/StandaloneDragonfly.php b/app/Models/StandaloneDragonfly.phpindex 90e7304f1c..2d004246cf 100644--- a/app/Models/StandaloneDragonfly.php+++ b/app/Models/StandaloneDragonfly.php@@ -249,9 +249,13 @@ class StandaloneDragonfly extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$scheme = $this->enable_ssl ? 'rediss' : 'redis';$encodedPass = rawurlencode($this->dragonfly_password);- $url = "{$scheme}://:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/0";+ $url = "{$scheme}://:{$encodedPass}@{$serverIp}:{$this->public_port}/0";if ($this->enable_ssl && $this->ssl_mode === 'verify-ca') {$url .= '?cacert=/etc/ssl/certs/coolify-ca.crt';diff --git a/app/Models/StandaloneKeydb.php b/app/Models/StandaloneKeydb.phpindex ad0cabf7ef..131e5bb3fa 100644--- a/app/Models/StandaloneKeydb.php+++ b/app/Models/StandaloneKeydb.php@@ -249,9 +249,13 @@ class StandaloneKeydb extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$scheme = $this->enable_ssl ? 'rediss' : 'redis';$encodedPass = rawurlencode($this->keydb_password);- $url = "{$scheme}://:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/0";+ $url = "{$scheme}://:{$encodedPass}@{$serverIp}:{$this->public_port}/0";if ($this->enable_ssl && $this->ssl_mode === 'verify-ca') {$url .= '?cacert=/etc/ssl/certs/coolify-ca.crt';diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.phpindex 3d9e381479..675c7987f9 100644--- a/app/Models/StandaloneMariadb.php+++ b/app/Models/StandaloneMariadb.php@@ -239,10 +239,14 @@ class StandaloneMariadb extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$encodedUser = rawurlencode($this->mariadb_user);$encodedPass = rawurlencode($this->mariadb_password);- return "mysql://{$encodedUser}:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mariadb_database}";+ return "mysql://{$encodedUser}:{$encodedPass}@{$serverIp}:{$this->public_port}/{$this->mariadb_database}";}return null;diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.phpindex 7cccd332a0..7b70988f6e 100644--- a/app/Models/StandaloneMongodb.php+++ b/app/Models/StandaloneMongodb.php@@ -269,9 +269,13 @@ class StandaloneMongodb extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$encodedUser = rawurlencode($this->mongo_initdb_root_username);$encodedPass = rawurlencode($this->mongo_initdb_root_password);- $url = "mongodb://{$encodedUser}:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/?directConnection=true";+ $url = "mongodb://{$encodedUser}:{$encodedPass}@{$serverIp}:{$this->public_port}/?directConnection=true";if ($this->enable_ssl) {$url .= '&tls=true&tlsCAFile=/etc/mongo/certs/ca.pem';if (in_array($this->ssl_mode, ['verify-full'])) {diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.phpindex 80269972f9..6f79241af2 100644--- a/app/Models/StandaloneMysql.php+++ b/app/Models/StandaloneMysql.php@@ -251,9 +251,13 @@ class StandaloneMysql extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$encodedUser = rawurlencode($this->mysql_user);$encodedPass = rawurlencode($this->mysql_password);- $url = "mysql://{$encodedUser}:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/{$this->mysql_database}";+ $url = "mysql://{$encodedUser}:{$encodedPass}@{$serverIp}:{$this->public_port}/{$this->mysql_database}";if ($this->enable_ssl) {$url .= "?ssl-mode={$this->ssl_mode}";if (in_array($this->ssl_mode, ['VERIFY_CA', 'VERIFY_IDENTITY'])) {diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.phpindex acde7a20c4..2dc5616a29 100644--- a/app/Models/StandalonePostgresql.php+++ b/app/Models/StandalonePostgresql.php@@ -246,9 +246,13 @@ class StandalonePostgresql extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$encodedUser = rawurlencode($this->postgres_user);$encodedPass = rawurlencode($this->postgres_password);- $url = "postgres://{$encodedUser}:{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/{$this->postgres_db}";+ $url = "postgres://{$encodedUser}:{$encodedPass}@{$serverIp}:{$this->public_port}/{$this->postgres_db}";if ($this->enable_ssl) {$url .= "?sslmode={$this->ssl_mode}";if (in_array($this->ssl_mode, ['verify-ca', 'verify-full'])) {diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.phpindex 001ebe36a5..c0223304a0 100644--- a/app/Models/StandaloneRedis.php+++ b/app/Models/StandaloneRedis.php@@ -253,11 +253,15 @@ class StandaloneRedis extends BaseModelreturn new Attribute(get: function () {if ($this->is_public && $this->public_port) {+ $serverIp = $this->destination->server->getIp;+ if (empty($serverIp)) {+ return null;+ }$redis_version = $this->getRedisVersion();$username_part = version_compare($redis_version, '6.0', '>=') ? rawurlencode($this->redis_username).':' : '';$encodedPass = rawurlencode($this->redis_password);$scheme = $this->enable_ssl ? 'rediss' : 'redis';- $url = "{$scheme}://{$username_part}{$encodedPass}@{$this->destination->server->getIp}:{$this->public_port}/0";+ $url = "{$scheme}://{$username_part}{$encodedPass}@{$serverIp}:{$this->public_port}/0";if ($this->enable_ssl && $this->ssl_mode === 'verify-ca') {$url .= '?cacert=/etc/ssl/certs/coolify-ca.crt';diff --git a/templates/service-templates-latest.json b/templates/service-templates-latest.jsonindex 1629cc1522..859981ac02 100644--- a/templates/service-templates-latest.json+++ b/templates/service-templates-latest.json@@ -4527,7 +4527,7 @@"web","admin"],- "category": "vps",+ "category": "vpn","logo": "svgs/wireguard.svg","minversion": "0.0.0","port": "8000"diff --git a/templates/service-templates.json b/templates/service-templates.jsonindex 13a6d73827..468bf75432 100644--- a/templates/service-templates.json+++ b/templates/service-templates.json@@ -4527,7 +4527,7 @@"web","admin"],- "category": "vps",+ "category": "vpn","logo": "svgs/wireguard.svg","minversion": "0.0.0","port": "8000"