fix: raw compose deployment .env not found

This commit is contained in:
Andras Bacsai
2024-07-25 11:07:32 +02:00
parent 98f67c5c6c
commit 69d8f706cf

View File

@@ -497,13 +497,13 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
} else { } else {
$this->write_deployment_configurations(); $this->write_deployment_configurations();
$server_workdir = $this->application->workdir(); $server_workdir = $this->application->workdir();
$this->docker_compose_location = '/docker-compose.yaml';
$command = "{$this->coolify_variables} docker compose"; $command = "{$this->coolify_variables} docker compose";
if ($this->env_filename) { if ($this->env_filename) {
$command .= " --env-file {$this->workdir}/{$this->env_filename}"; $command .= " --env-file {$server_workdir}/{$this->env_filename}";
} }
$command .= " --project-directory {$server_workdir} -f {$server_workdir}{$this->docker_compose_location} up -d"; $command .= " --project-directory {$server_workdir} -f {$server_workdir}{$this->docker_compose_location} up -d";
$this->execute_remote_command( $this->execute_remote_command(
['command' => $command, 'hidden' => true], ['command' => $command, 'hidden' => true],
); );
@@ -636,21 +636,26 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$this->server = $this->original_server; $this->server = $this->original_server;
} }
$readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at); $readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at);
$mainDir = $this->configuration_dir;
if ($this->application->settings->is_raw_compose_deployment_enabled) {
$mainDir = $this->application->workdir();
}
if ($this->pull_request_id === 0) { if ($this->pull_request_id === 0) {
$composeFileName = "$this->configuration_dir/docker-compose.yaml"; $composeFileName = "$mainDir/docker-compose.yaml";
} else { } else {
$composeFileName = "$this->configuration_dir/docker-compose-pr-{$this->pull_request_id}.yaml"; $composeFileName = "$mainDir/docker-compose-pr-{$this->pull_request_id}.yaml";
$this->docker_compose_location = "/docker-compose-pr-{$this->pull_request_id}.yaml"; $this->docker_compose_location = "/docker-compose-pr-{$this->pull_request_id}.yaml";
} }
$this->execute_remote_command( $this->execute_remote_command(
[ [
"mkdir -p $this->configuration_dir", "mkdir -p $mainDir",
], ],
[ [
"echo '{$this->docker_compose_base64}' | base64 -d | tee $composeFileName > /dev/null", "echo '{$this->docker_compose_base64}' | base64 -d | tee $composeFileName > /dev/null",
], ],
[ [
"echo '{$readme}' > $this->configuration_dir/README.md", "echo '{$readme}' > $mainDir/README.md",
] ]
); );
if ($this->use_build_server) { if ($this->use_build_server) {