This commit is contained in:
Andras Bacsai
2024-12-18 10:44:56 +01:00
parent 07984ce74f
commit 33ae10a6dc

View File

@@ -23,6 +23,9 @@ class StartPostgresql
$this->database = $database;
$container_name = $this->database->uuid;
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
if (isDev()) {
$this->configuration_dir = '/var/lib/docker/volumes/coolify_dev_coolify_data/_data/databases/'.$container_name;
}
$this->commands = [
"echo 'Starting database.'",
@@ -78,7 +81,7 @@ class StartPostgresql
],
],
];
if (! is_null($this->database->limits_cpuset)) {
if (filled($this->database->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
}
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -108,7 +111,7 @@ class StartPostgresql
];
}
}
if (! is_null($this->database->postgres_conf) && ! empty($this->database->postgres_conf)) {
if (filled($this->database->postgres_conf)) {
$docker_compose['services'][$container_name]['volumes'][] = [
'type' => 'bind',
'source' => $this->configuration_dir.'/custom-postgres.conf',
@@ -201,7 +204,7 @@ class StartPostgresql
{
$this->commands[] = "rm -rf $this->configuration_dir/docker-entrypoint-initdb.d/*";
if (is_null($this->database->init_scripts) || count($this->database->init_scripts) === 0) {
if (blank($this->database->init_scripts) || count($this->database->init_scripts) === 0) {
return;
}
@@ -219,7 +222,7 @@ class StartPostgresql
$filename = 'custom-postgres.conf';
$config_file_path = "$this->configuration_dir/$filename";
if (is_null($this->database->postgres_conf) || empty($this->database->postgres_conf)) {
if (blank($this->database->postgres_conf)) {
$this->commands[] = "rm -f $config_file_path";
return;