Skip to content

Commit

Permalink
Merge pull request #2164 from coollabsio/next
Browse files Browse the repository at this point in the history
v4.0.0-beta.277
  • Loading branch information
andrasbacsai authored May 10, 2024
2 parents 94acd12 + 7f265a6 commit b528a0f
Show file tree
Hide file tree
Showing 61 changed files with 1,500 additions and 447 deletions.
1 change: 0 additions & 1 deletion app/Actions/Database/StartClickhouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public function handle(StandaloneClickhouse $database)
$environment_variables = $this->generate_environment_variables();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Database/StartDatabaseProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St
COPY nginx.conf /etc/nginx/nginx.conf
EOF;
$docker_compose = [
'version' => '3.8',
'services' => [
$proxyContainerName => [
'build' => [
Expand Down
1 change: 0 additions & 1 deletion app/Actions/Database/StartDragonfly.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public function handle(StandaloneDragonfly $database)
$environment_variables = $this->generate_environment_variables();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down
5 changes: 2 additions & 3 deletions app/Actions/Database/StartKeydb.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function handle(StandaloneKeydb $database)
$this->add_custom_keydb();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -96,7 +95,7 @@ public function handle(StandaloneKeydb $database)
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',
Expand Down Expand Up @@ -162,7 +161,7 @@ private function generate_environment_variables()
}
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';
Expand Down
5 changes: 2 additions & 3 deletions app/Actions/Database/StartMariadb.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function handle(StandaloneMariadb $database)
$environment_variables = $this->generate_environment_variables();
$this->add_custom_mysql();
$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -90,7 +89,7 @@ public function handle(StandaloneMariadb $database)
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',
Expand Down Expand Up @@ -165,7 +164,7 @@ private function generate_environment_variables()
}
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';
Expand Down
5 changes: 2 additions & 3 deletions app/Actions/Database/StartMongodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function handle(StandaloneMongodb $database)
$this->add_custom_mongo_conf();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -97,7 +96,7 @@ public function handle(StandaloneMongodb $database)
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',
Expand Down Expand Up @@ -178,7 +177,7 @@ private function generate_environment_variables()
}
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';
Expand Down
5 changes: 2 additions & 3 deletions app/Actions/Database/StartMysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function handle(StandaloneMysql $database)
$environment_variables = $this->generate_environment_variables();
$this->add_custom_mysql();
$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -90,7 +89,7 @@ public function handle(StandaloneMysql $database)
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',
Expand Down Expand Up @@ -165,7 +164,7 @@ private function generate_environment_variables()
}
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';
Expand Down
13 changes: 7 additions & 6 deletions app/Actions/Database/StartPostgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function handle(StandalonePostgresql $database)
$this->add_custom_conf();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -78,7 +77,6 @@ public function handle(StandalonePostgresql $database)
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' => [
Expand Down Expand Up @@ -107,7 +105,7 @@ public function handle(StandalonePostgresql $database)
];
}
}
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',
Expand Down Expand Up @@ -165,8 +163,6 @@ private function generate_local_persistent_volumes_only_volume_names()
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");
}
Expand Down Expand Up @@ -203,11 +199,16 @@ private function generate_init_scripts()
}
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";
}
Expand Down
5 changes: 2 additions & 3 deletions app/Actions/Database/StartRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function handle(StandaloneRedis $database)
$this->add_custom_redis();

$docker_compose = [
'version' => '3.8',
'services' => [
$container_name => [
'image' => $this->database->image,
Expand Down Expand Up @@ -100,7 +99,7 @@ public function handle(StandaloneRedis $database)
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',
Expand Down Expand Up @@ -166,7 +165,7 @@ private function generate_environment_variables()
}
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';
Expand Down
Loading

0 comments on commit b528a0f

Please sign in to comment.