mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-28 02:06:37 -04:00
feat(deploy): pull compose images before stopping containers
Pull image-based Docker Compose services with --ignore-buildable before stopping the current deployment so image-only services are ready first. Fail the deploy if pull fails, and run the pull on the runtime server when a build server is used.
This commit is contained in:
@@ -808,6 +808,8 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
// This overwrites the build-time .env with ALL variables (build-time + runtime)
|
||||
$this->save_runtime_environment_variables();
|
||||
|
||||
$this->pull_docker_compose_images();
|
||||
|
||||
$this->stop_running_container(force: true);
|
||||
$this->application_deployment_queue->addLogEntry('Starting new application.');
|
||||
$networkId = $this->application->uuid;
|
||||
@@ -911,6 +913,26 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||
$this->application_deployment_queue->addLogEntry('New container started.');
|
||||
}
|
||||
|
||||
private function pull_docker_compose_images(): void
|
||||
{
|
||||
$this->application_deployment_queue->addLogEntry('Pulling image-based services before stopping the current deployment.');
|
||||
|
||||
if ($this->use_build_server) {
|
||||
$this->write_deployment_configurations();
|
||||
$this->server = $this->mainServer;
|
||||
$workdir = $this->application->workdir();
|
||||
$command = "{$this->coolify_variables} docker compose --env-file {$workdir}/.env --project-name {$this->application->uuid} --project-directory {$workdir} -f {$workdir}{$this->docker_compose_location} pull --ignore-buildable";
|
||||
} else {
|
||||
$workdir = $this->workdir;
|
||||
$command = executeInDocker($this->deployment_uuid, "{$this->coolify_variables} docker compose --env-file {$workdir}/.env --project-name {$this->application->uuid} --project-directory {$workdir} -f {$workdir}{$this->docker_compose_location} pull --ignore-buildable");
|
||||
}
|
||||
|
||||
$this->execute_remote_command([
|
||||
$command,
|
||||
'hidden' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
private function deploy_dockerfile_buildpack()
|
||||
{
|
||||
$this->application_deployment_queue->addLogEntry("Starting deployment of {$this->customRepository}:{$this->application->git_branch} to {$this->server->name}.");
|
||||
|
||||
Reference in New Issue
Block a user