Refactor database and application start scripts

This commit is contained in:
Andras Bacsai 2024-01-12 14:15:15 +01:00
parent 5e7c6906b3
commit 27b18fbedf
8 changed files with 9 additions and 9 deletions

View File

@ -68,7 +68,7 @@ class StartMariadb
]
]
];
if ($this->database->limits_cpuset !== 0) {
if (!is_null($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()) {

View File

@ -75,7 +75,7 @@ class StartMongodb
]
]
];
if ($this->database->limits_cpuset !== 0) {
if (!is_null($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()) {
@ -123,7 +123,7 @@ class StartMongodb
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml pull";
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";
$this->commands[] = "echo '{$database->name} started.'";
return remote_process($this->commands, $database->destination->server,callEventOnFinish: 'DatabaseStatusChanged');
return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
}
private function generate_local_persistent_volumes()

View File

@ -68,7 +68,7 @@ class StartMysql
]
]
];
if ($this->database->limits_cpuset !== 0) {
if (!is_null($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()) {

View File

@ -78,7 +78,7 @@ class StartPostgresql
]
]
];
if ($this->database->limits_cpuset !== 0) {
if (!is_null($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()) {

View File

@ -77,7 +77,7 @@ class StartRedis
]
]
];
if ($this->database->limits_cpuset !== 0) {
if (!is_null($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()) {

View File

@ -1027,7 +1027,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
]
]
];
if ($this->application->limits_cpuset !== 0) {
if (!is_null($this->application->limits_cpuset)) {
data_set($docker_compose, 'services.' . $this->container_name . '.cpuset', $this->application->limits_cpuset);
}
if ($this->server->isSwarm()) {

View File

@ -653,7 +653,7 @@ class Application extends BaseModel
]
]
];
if ($this->limits_cpuset !== 0) {
if (!is_null($this->limits_cpuset)) {
data_set($docker_compose, "services.{$container_name}.cpuset", $this->limits_cpuset);
}
if ($server->isSwarm()) {

View File

@ -178,7 +178,7 @@ function generateComposeFile(string $deploymentUuid, Server $server, string $net
]
]
];
if ($application->limits_cpuset !== 0) {
if (!is_null($application->limits_cpuset)) {
data_set($docker_compose, "services.{$containerName}.cpuset", $application->limits_cpuset);
}
if ($server->isLogDrainEnabled() && $application->isLogDrainEnabled()) {