Skip to content

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.

fix: empty db conf feat: add listen_addresses to postgresql if its missing in the custom conf

Andras Bacsai2b422a542a51
diff --git a/app/Actions/Database/StartKeydb.php b/app/Actions/Database/StartKeydb.php
index 489c74053a..52768b13ed 100644
--- a/app/Actions/Database/StartKeydb.php
+++ b/app/Actions/Database/StartKeydb.php
@@ -96,7 +96,7 @@ class StartKeydb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->keydb_conf)) {
+ if (!is_null($this->database->keydb_conf) || !empty($this->database->keydb_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/keydb.conf',
@@ -162,7 +162,7 @@ class StartKeydb
}
private function add_custom_keydb()
{
- if (is_null($this->database->keydb_conf)) {
+ if (is_null($this->database->keydb_conf) || empty($this->database->keydb_conf)) {
return;
}
$filename = 'keydb.conf';
diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php
index e02b28b2e0..b6d6c5bb35 100644
--- a/app/Actions/Database/StartMariadb.php
+++ b/app/Actions/Database/StartMariadb.php
@@ -90,7 +90,7 @@ class StartMariadb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mariadb_conf)) {
+ if (!is_null($this->database->mariadb_conf) || !empty($this->database->mariadb_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/custom-config.cnf',
@@ -165,7 +165,7 @@ class StartMariadb
}
private function add_custom_mysql()
{
- if (is_null($this->database->mariadb_conf)) {
+ if (is_null($this->database->mariadb_conf) || empty($this->database->mariadb_conf)) {
return;
}
$filename = 'custom-config.cnf';
diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php
index 7bb6cbcd05..b624c2f505 100644
--- a/app/Actions/Database/StartMongodb.php
+++ b/app/Actions/Database/StartMongodb.php
@@ -97,7 +97,7 @@ class StartMongodb
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mongo_conf)) {
+ if (!is_null($this->database->mongo_conf) || !empty($this->database->mongo_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/mongod.conf',
@@ -178,7 +178,7 @@ class StartMongodb
}
private function add_custom_mongo_conf()
{
- if (is_null($this->database->mongo_conf)) {
+ if (is_null($this->database->mongo_conf) || empty($this->database->mongo_conf)) {
return;
}
$filename = 'mongod.conf';
diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php
index b3f695d727..43b7292fbc 100644
--- a/app/Actions/Database/StartMysql.php
+++ b/app/Actions/Database/StartMysql.php
@@ -90,7 +90,7 @@ class StartMysql
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->mysql_conf)) {
+ if (!is_null($this->database->mysql_conf) || !empty($this->database->mysql_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/custom-config.cnf',
@@ -165,7 +165,7 @@ class StartMysql
}
private function add_custom_mysql()
{
- if (is_null($this->database->mysql_conf)) {
+ if (is_null($this->database->mysql_conf) || empty($this->database->mysql_conf)) {
return;
}
$filename = 'custom-config.cnf';
diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php
index f19a8b0365..37eb157f89 100644
--- a/app/Actions/Database/StartPostgresql.php
+++ b/app/Actions/Database/StartPostgresql.php
@@ -78,7 +78,6 @@ class StartPostgresql
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
- ray('Log Drain Enabled');
$docker_compose['services'][$container_name]['logging'] = [
'driver' => 'fluentd',
'options' => [
@@ -107,7 +106,7 @@ class StartPostgresql
];
}
}
- if (!is_null($this->database->postgres_conf)) {
+ if (!is_null($this->database->postgres_conf) && !empty($this->database->postgres_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/custom-postgres.conf',
@@ -165,8 +164,6 @@ class StartPostgresql
private function generate_environment_variables()
{
$environment_variables = collect();
- ray('Generate Environment Variables')->green();
- ray($this->database->runtime_environment_variables)->green();
foreach ($this->database->runtime_environment_variables as $env) {
$environment_variables->push("$env->key=$env->real_value");
}
@@ -203,11 +200,16 @@ class StartPostgresql
}
private function add_custom_conf()
{
- if (is_null($this->database->postgres_conf)) {
+ if (is_null($this->database->postgres_conf) || empty($this->database->postgres_conf)) {
return;
}
$filename = 'custom-postgres.conf';
$content = $this->database->postgres_conf;
+ if (!str($content)->contains('listen_addresses')) {
+ $content .= "\nlisten_addresses = '*'";
+ $this->database->postgres_conf = $content;
+ $this->database->save();
+ }
$content_base64 = base64_encode($content);
$this->commands[] = "echo '{$content_base64}' | base64 -d | tee $this->configuration_dir/{$filename} > /dev/null";
}
diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php
index 01e9a9befc..35b9d5c8e4 100644
--- a/app/Actions/Database/StartRedis.php
+++ b/app/Actions/Database/StartRedis.php
@@ -100,7 +100,7 @@ class StartRedis
if (count($volume_names) > 0) {
$docker_compose['volumes'] = $volume_names;
}
- if (!is_null($this->database->redis_conf)) {
+ if (!is_null($this->database->redis_conf) || !empty($this->database->redis_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir . '/redis.conf',
@@ -166,7 +166,7 @@ class StartRedis
}
private function add_custom_redis()
{
- if (is_null($this->database->redis_conf)) {
+ if (is_null($this->database->redis_conf) || empty($this->database->redis_conf)) {
return;
}
$filename = 'redis.conf';