From 486de58d5b31030bf1149daf097fa0ec5b1a8eb4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 13 Nov 2023 15:27:33 +0100 Subject: [PATCH 1/2] Update database start commands --- app/Actions/Database/StartDatabaseProxy.php | 1 + app/Actions/Database/StartMariadb.php | 2 ++ app/Actions/Database/StartMongodb.php | 2 ++ app/Actions/Database/StartMysql.php | 2 ++ app/Actions/Database/StartPostgresql.php | 2 ++ app/Actions/Database/StartRedis.php | 2 ++ config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 3 ++- 9 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Actions/Database/StartDatabaseProxy.php b/app/Actions/Database/StartDatabaseProxy.php index 3f6449af2..500798d30 100644 --- a/app/Actions/Database/StartDatabaseProxy.php +++ b/app/Actions/Database/StartDatabaseProxy.php @@ -129,6 +129,7 @@ public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|St "echo '{$dockerfile_base64}' | base64 -d > $configuration_dir/Dockerfile", "echo '{$nginxconf_base64}' | base64 -d > $configuration_dir/nginx.conf", "echo '{$dockercompose_base64}' | base64 -d > $configuration_dir/docker-compose.yaml", + "docker compose --project-directory {$configuration_dir} pull", "docker compose --project-directory {$configuration_dir} up --build -d", ], $server); } diff --git a/app/Actions/Database/StartMariadb.php b/app/Actions/Database/StartMariadb.php index 14110cf9b..d42b53c09 100644 --- a/app/Actions/Database/StartMariadb.php +++ b/app/Actions/Database/StartMariadb.php @@ -91,6 +91,8 @@ public function handle(StandaloneMariadb $database) $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; + $this->commands[] = "echo 'Pulling {$database->image} image.'"; + $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); diff --git a/app/Actions/Database/StartMongodb.php b/app/Actions/Database/StartMongodb.php index bc21bf50a..c1f1b71df 100644 --- a/app/Actions/Database/StartMongodb.php +++ b/app/Actions/Database/StartMongodb.php @@ -107,6 +107,8 @@ public function handle(StandaloneMongodb $database) $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; + $this->commands[] = "echo 'Pulling {$database->image} image.'"; + $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); diff --git a/app/Actions/Database/StartMysql.php b/app/Actions/Database/StartMysql.php index 103affb89..4cf4282b6 100644 --- a/app/Actions/Database/StartMysql.php +++ b/app/Actions/Database/StartMysql.php @@ -91,6 +91,8 @@ public function handle(StandaloneMysql $database) $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; + $this->commands[] = "echo 'Pulling {$database->image} image.'"; + $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); diff --git a/app/Actions/Database/StartPostgresql.php b/app/Actions/Database/StartPostgresql.php index 6821926be..6eefd45ff 100644 --- a/app/Actions/Database/StartPostgresql.php +++ b/app/Actions/Database/StartPostgresql.php @@ -116,6 +116,8 @@ public function handle(StandalonePostgresql $database) $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; + $this->commands[] = "echo 'Pulling {$database->image} image.'"; + $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); diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php index 1fe8b463a..a585678b3 100644 --- a/app/Actions/Database/StartRedis.php +++ b/app/Actions/Database/StartRedis.php @@ -101,6 +101,8 @@ public function handle(StandaloneRedis $database) $this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml"; $readme = generate_readme_file($this->database->name, now()); $this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md"; + $this->commands[] = "echo 'Pulling {$database->image} image.'"; + $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); diff --git a/config/sentry.php b/config/sentry.php index c576a0a38..b2f0653c0 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.126', + 'release' => '4.0.0-beta.127', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 6a0ed299c..7ca7b6014 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Mon, 13 Nov 2023 15:41:49 +0100 Subject: [PATCH 2/2] Fix URLs and remove unnecessary command in ApplicationDeploymentJob.php --- app/Jobs/ApplicationDeploymentJob.php | 2 +- app/Jobs/ContainerStatusJob.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 15359f454..fbf6ef005 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1076,7 +1076,7 @@ private function start_by_compose_file() ) { $this->execute_remote_command( ["echo -n 'Pulling latest images from the registry.'"], - [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), "hidden" => true], + [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir}"), "hidden" => true], ); } $this->execute_remote_command( diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php index 3b995d721..c4a6c02b6 100644 --- a/app/Jobs/ContainerStatusJob.php +++ b/app/Jobs/ContainerStatusJob.php @@ -255,6 +255,8 @@ public function handle(): void if ($projectUuid && $serviceUuid && $environmentName) { $url = base_url() . '/project/' . $projectUuid . "/" . $environmentName . "/service/" . $serviceUuid; + } else { + $url = null; } $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); $exitedService->update(['status' => 'exited']); @@ -279,6 +281,8 @@ public function handle(): void if ($projectUuid && $applicationUuid && $environment) { $url = base_url() . '/project/' . $projectUuid . "/" . $environment . "/application/" . $applicationUuid; + } else { + $url = null; } $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); @@ -302,6 +306,8 @@ public function handle(): void if ($projectUuid && $applicationUuid && $environmentName) { $url = base_url() . '/project/' . $projectUuid . "/" . $environmentName . "/application/" . $applicationUuid; + } else { + $url = null; } $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); @@ -325,6 +331,8 @@ public function handle(): void if ($projectUuid && $databaseUuid && $environmentName) { $url = base_url() . '/project/' . $projectUuid . "/" . $environmentName . "/database/" . $databaseUuid; + } else { + $url = null; } $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url)); }