Skip to content

Commit 0f7a199

Browse files
authored
Merge branch 'next' into main
2 parents b8cdb40 + d2eaf4f commit 0f7a199

File tree

76 files changed

+1728
-811
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1728
-811
lines changed

app/Actions/Database/StartClickhouse.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function handle(StandaloneClickhouse $database)
2121
$this->database = $database;
2222

2323
$container_name = $this->database->uuid;
24-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
24+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2525

2626
$this->commands = [
2727
"echo 'Starting {$database->name}.'",
@@ -75,7 +75,7 @@ public function handle(StandaloneClickhouse $database)
7575
],
7676
],
7777
];
78-
if (! is_null($this->database->limits_cpuset)) {
78+
if (!is_null($this->database->limits_cpuset)) {
7979
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8080
}
8181
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -102,6 +102,11 @@ public function handle(StandaloneClickhouse $database)
102102
if (count($volume_names) > 0) {
103103
$docker_compose['volumes'] = $volume_names;
104104
}
105+
106+
// Add custom docker run options
107+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
108+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
109+
105110
$docker_compose = Yaml::dump($docker_compose, 10);
106111
$docker_compose_base64 = base64_encode($docker_compose);
107112
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -120,10 +125,10 @@ private function generate_local_persistent_volumes()
120125
$local_persistent_volumes = [];
121126
foreach ($this->database->persistentStorages as $persistentStorage) {
122127
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
123-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
128+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
124129
} else {
125130
$volume_name = $persistentStorage->name;
126-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
131+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
127132
}
128133
}
129134

@@ -154,11 +159,11 @@ private function generate_environment_variables()
154159
$environment_variables->push("$env->key=$env->real_value");
155160
}
156161

157-
if ($environment_variables->filter(fn ($env) => str($env)->contains('CLICKHOUSE_ADMIN_USER'))->isEmpty()) {
162+
if ($environment_variables->filter(fn($env) => str($env)->contains('CLICKHOUSE_ADMIN_USER'))->isEmpty()) {
158163
$environment_variables->push("CLICKHOUSE_ADMIN_USER={$this->database->clickhouse_admin_user}");
159164
}
160165

161-
if ($environment_variables->filter(fn ($env) => str($env)->contains('CLICKHOUSE_ADMIN_PASSWORD'))->isEmpty()) {
166+
if ($environment_variables->filter(fn($env) => str($env)->contains('CLICKHOUSE_ADMIN_PASSWORD'))->isEmpty()) {
162167
$environment_variables->push("CLICKHOUSE_ADMIN_PASSWORD={$this->database->clickhouse_admin_password}");
163168
}
164169

app/Actions/Database/StartDragonfly.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(StandaloneDragonfly $database)
2323
$startCommand = "dragonfly --requirepass {$this->database->dragonfly_password}";
2424

2525
$container_name = $this->database->uuid;
26-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
26+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2727

2828
$this->commands = [
2929
"echo 'Starting {$database->name}.'",
@@ -75,7 +75,7 @@ public function handle(StandaloneDragonfly $database)
7575
],
7676
],
7777
];
78-
if (! is_null($this->database->limits_cpuset)) {
78+
if (!is_null($this->database->limits_cpuset)) {
7979
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8080
}
8181
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -102,6 +102,11 @@ public function handle(StandaloneDragonfly $database)
102102
if (count($volume_names) > 0) {
103103
$docker_compose['volumes'] = $volume_names;
104104
}
105+
106+
// Add custom docker run options
107+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
108+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
109+
105110
$docker_compose = Yaml::dump($docker_compose, 10);
106111
$docker_compose_base64 = base64_encode($docker_compose);
107112
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -120,10 +125,10 @@ private function generate_local_persistent_volumes()
120125
$local_persistent_volumes = [];
121126
foreach ($this->database->persistentStorages as $persistentStorage) {
122127
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
123-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
128+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
124129
} else {
125130
$volume_name = $persistentStorage->name;
126-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
131+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
127132
}
128133
}
129134

@@ -154,7 +159,7 @@ private function generate_environment_variables()
154159
$environment_variables->push("$env->key=$env->real_value");
155160
}
156161

157-
if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
162+
if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
158163
$environment_variables->push("REDIS_PASSWORD={$this->database->dragonfly_password}");
159164
}
160165

app/Actions/Database/StartKeydb.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function handle(StandaloneKeydb $database)
2424
$startCommand = "keydb-server --requirepass {$this->database->keydb_password} --appendonly yes";
2525

2626
$container_name = $this->database->uuid;
27-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
27+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2828

2929
$this->commands = [
3030
"echo 'Starting {$database->name}.'",
@@ -74,7 +74,7 @@ public function handle(StandaloneKeydb $database)
7474
],
7575
],
7676
];
77-
if (! is_null($this->database->limits_cpuset)) {
77+
if (!is_null($this->database->limits_cpuset)) {
7878
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
7979
}
8080
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -101,15 +101,19 @@ public function handle(StandaloneKeydb $database)
101101
if (count($volume_names) > 0) {
102102
$docker_compose['volumes'] = $volume_names;
103103
}
104-
if (! is_null($this->database->keydb_conf) || ! empty($this->database->keydb_conf)) {
104+
if (!is_null($this->database->keydb_conf) || !empty($this->database->keydb_conf)) {
105105
$docker_compose['services'][$container_name]['volumes'][] = [
106106
'type' => 'bind',
107-
'source' => $this->configuration_dir.'/keydb.conf',
107+
'source' => $this->configuration_dir . '/keydb.conf',
108108
'target' => '/etc/keydb/keydb.conf',
109109
'read_only' => true,
110110
];
111111
$docker_compose['services'][$container_name]['command'] = "keydb-server /etc/keydb/keydb.conf --requirepass {$this->database->keydb_password} --appendonly yes";
112112
}
113+
114+
// Add custom docker run options
115+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
116+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
113117
$docker_compose = Yaml::dump($docker_compose, 10);
114118
$docker_compose_base64 = base64_encode($docker_compose);
115119
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -128,10 +132,10 @@ private function generate_local_persistent_volumes()
128132
$local_persistent_volumes = [];
129133
foreach ($this->database->persistentStorages as $persistentStorage) {
130134
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
131-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
135+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
132136
} else {
133137
$volume_name = $persistentStorage->name;
134-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
138+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
135139
}
136140
}
137141

@@ -162,7 +166,7 @@ private function generate_environment_variables()
162166
$environment_variables->push("$env->key=$env->real_value");
163167
}
164168

165-
if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
169+
if ($environment_variables->filter(fn($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {
166170
$environment_variables->push("REDIS_PASSWORD={$this->database->keydb_password}");
167171
}
168172

app/Actions/Database/StartMariadb.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function handle(StandaloneMariadb $database)
2121
$this->database = $database;
2222

2323
$container_name = $this->database->uuid;
24-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
24+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2525

2626
$this->commands = [
2727
"echo 'Starting {$database->name}.'",
@@ -69,7 +69,7 @@ public function handle(StandaloneMariadb $database)
6969
],
7070
],
7171
];
72-
if (! is_null($this->database->limits_cpuset)) {
72+
if (!is_null($this->database->limits_cpuset)) {
7373
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
7474
}
7575
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -96,14 +96,19 @@ public function handle(StandaloneMariadb $database)
9696
if (count($volume_names) > 0) {
9797
$docker_compose['volumes'] = $volume_names;
9898
}
99-
if (! is_null($this->database->mariadb_conf) || ! empty($this->database->mariadb_conf)) {
99+
if (!is_null($this->database->mariadb_conf) || !empty($this->database->mariadb_conf)) {
100100
$docker_compose['services'][$container_name]['volumes'][] = [
101101
'type' => 'bind',
102-
'source' => $this->configuration_dir.'/custom-config.cnf',
102+
'source' => $this->configuration_dir . '/custom-config.cnf',
103103
'target' => '/etc/mysql/conf.d/custom-config.cnf',
104104
'read_only' => true,
105105
];
106106
}
107+
108+
// Add custom docker run options
109+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
110+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
111+
107112
$docker_compose = Yaml::dump($docker_compose, 10);
108113
$docker_compose_base64 = base64_encode($docker_compose);
109114
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -122,10 +127,10 @@ private function generate_local_persistent_volumes()
122127
$local_persistent_volumes = [];
123128
foreach ($this->database->persistentStorages as $persistentStorage) {
124129
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
125-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
130+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
126131
} else {
127132
$volume_name = $persistentStorage->name;
128-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
133+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
129134
}
130135
}
131136

@@ -156,18 +161,18 @@ private function generate_environment_variables()
156161
$environment_variables->push("$env->key=$env->real_value");
157162
}
158163

159-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) {
164+
if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_ROOT_PASSWORD'))->isEmpty()) {
160165
$environment_variables->push("MARIADB_ROOT_PASSWORD={$this->database->mariadb_root_password}");
161166
}
162167

163-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_DATABASE'))->isEmpty()) {
168+
if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_DATABASE'))->isEmpty()) {
164169
$environment_variables->push("MARIADB_DATABASE={$this->database->mariadb_database}");
165170
}
166171

167-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_USER'))->isEmpty()) {
172+
if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_USER'))->isEmpty()) {
168173
$environment_variables->push("MARIADB_USER={$this->database->mariadb_user}");
169174
}
170-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MARIADB_PASSWORD'))->isEmpty()) {
175+
if ($environment_variables->filter(fn($env) => str($env)->contains('MARIADB_PASSWORD'))->isEmpty()) {
171176
$environment_variables->push("MARIADB_PASSWORD={$this->database->mariadb_password}");
172177
}
173178

app/Actions/Database/StartMongodb.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function handle(StandaloneMongodb $database)
2323
$startCommand = 'mongod';
2424

2525
$container_name = $this->database->uuid;
26-
$this->configuration_dir = database_configuration_dir().'/'.$container_name;
26+
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
2727

2828
$this->commands = [
2929
"echo 'Starting {$database->name}.'",
@@ -77,7 +77,7 @@ public function handle(StandaloneMongodb $database)
7777
],
7878
],
7979
];
80-
if (! is_null($this->database->limits_cpuset)) {
80+
if (!is_null($this->database->limits_cpuset)) {
8181
data_set($docker_compose, "services.{$container_name}.cpuset", $this->database->limits_cpuset);
8282
}
8383
if ($this->database->destination->server->isLogDrainEnabled() && $this->database->isLogDrainEnabled()) {
@@ -104,23 +104,27 @@ public function handle(StandaloneMongodb $database)
104104
if (count($volume_names) > 0) {
105105
$docker_compose['volumes'] = $volume_names;
106106
}
107-
if (! is_null($this->database->mongo_conf) || ! empty($this->database->mongo_conf)) {
107+
if (!is_null($this->database->mongo_conf) || !empty($this->database->mongo_conf)) {
108108
$docker_compose['services'][$container_name]['volumes'][] = [
109109
'type' => 'bind',
110-
'source' => $this->configuration_dir.'/mongod.conf',
110+
'source' => $this->configuration_dir . '/mongod.conf',
111111
'target' => '/etc/mongo/mongod.conf',
112112
'read_only' => true,
113113
];
114-
$docker_compose['services'][$container_name]['command'] = $startCommand.' --config /etc/mongo/mongod.conf';
114+
$docker_compose['services'][$container_name]['command'] = $startCommand . ' --config /etc/mongo/mongod.conf';
115115
}
116116
$this->add_default_database();
117117
$docker_compose['services'][$container_name]['volumes'][] = [
118118
'type' => 'bind',
119-
'source' => $this->configuration_dir.'/docker-entrypoint-initdb.d',
119+
'source' => $this->configuration_dir . '/docker-entrypoint-initdb.d',
120120
'target' => '/docker-entrypoint-initdb.d',
121121
'read_only' => true,
122122
];
123123

124+
// Add custom docker run options
125+
$docker_run_options = convert_docker_run_to_compose($this->database->custom_docker_run_options);
126+
$docker_compose = generate_custom_docker_run_options_for_databases($docker_run_options, $docker_compose, $container_name, $this->database->destination->network);
127+
124128
$docker_compose = Yaml::dump($docker_compose, 10);
125129
$docker_compose_base64 = base64_encode($docker_compose);
126130
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d | tee $this->configuration_dir/docker-compose.yml > /dev/null";
@@ -139,10 +143,10 @@ private function generate_local_persistent_volumes()
139143
$local_persistent_volumes = [];
140144
foreach ($this->database->persistentStorages as $persistentStorage) {
141145
if ($persistentStorage->host_path !== '' && $persistentStorage->host_path !== null) {
142-
$local_persistent_volumes[] = $persistentStorage->host_path.':'.$persistentStorage->mount_path;
146+
$local_persistent_volumes[] = $persistentStorage->host_path . ':' . $persistentStorage->mount_path;
143147
} else {
144148
$volume_name = $persistentStorage->name;
145-
$local_persistent_volumes[] = $volume_name.':'.$persistentStorage->mount_path;
149+
$local_persistent_volumes[] = $volume_name . ':' . $persistentStorage->mount_path;
146150
}
147151
}
148152

@@ -173,15 +177,15 @@ private function generate_environment_variables()
173177
$environment_variables->push("$env->key=$env->real_value");
174178
}
175179

176-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) {
180+
if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_ROOT_USERNAME'))->isEmpty()) {
177181
$environment_variables->push("MONGO_INITDB_ROOT_USERNAME={$this->database->mongo_initdb_root_username}");
178182
}
179183

180-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) {
184+
if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_ROOT_PASSWORD'))->isEmpty()) {
181185
$environment_variables->push("MONGO_INITDB_ROOT_PASSWORD={$this->database->mongo_initdb_root_password}");
182186
}
183187

184-
if ($environment_variables->filter(fn ($env) => str($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) {
188+
if ($environment_variables->filter(fn($env) => str($env)->contains('MONGO_INITDB_DATABASE'))->isEmpty()) {
185189
$environment_variables->push("MONGO_INITDB_DATABASE={$this->database->mongo_initdb_database}");
186190
}
187191

0 commit comments

Comments
 (0)