Merge pull request #2025 from coollabsio/next

v4.0.0-beta.265
This commit is contained in:
Andras Bacsai 2024-04-18 13:54:23 +02:00 committed by GitHub
commit 144b34ca2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 17 deletions

View File

@ -24,6 +24,7 @@
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Sleep; use Illuminate\Support\Sleep;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use RuntimeException; use RuntimeException;
@ -740,6 +741,10 @@ private function save_environment_variables()
$envs->push("SOURCE_COMMIT=unknown"); $envs->push("SOURCE_COMMIT=unknown");
} }
} }
$envs = $envs->sort(function ($a, $b) {
return strpos($a, '$') === false ? -1 : 1;
});
Log::info("message", $envs->implode("\n"));
} else { } else {
$this->env_filename = ".env"; $this->env_filename = ".env";
foreach ($this->application->environment_variables as $env) { foreach ($this->application->environment_variables as $env) {
@ -775,6 +780,10 @@ private function save_environment_variables()
} }
if ($envs->isEmpty()) { if ($envs->isEmpty()) {
$this->env_filename = null;
if ($this->use_build_server) {
$this->server = $this->original_server;
}
$this->execute_remote_command( $this->execute_remote_command(
[ [
"command" => "rm -f $this->configuration_dir/{$this->env_filename}", "command" => "rm -f $this->configuration_dir/{$this->env_filename}",
@ -782,8 +791,28 @@ private function save_environment_variables()
"ignore_errors" => true "ignore_errors" => true
] ]
); );
$this->env_filename = null; if ($this->use_build_server) {
return; $this->server = $this->build_server;
}
} else {
$envs_base64 = base64_encode($envs->implode("\n"));
$this->execute_remote_command(
[
executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
],
);
if ($this->use_build_server) {
$this->server = $this->original_server;
}
$this->execute_remote_command(
[
"echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
]
);
if ($this->use_build_server) {
$this->server = $this->build_server;
}
} }
// $this->execute_remote_command([ // $this->execute_remote_command([
// executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"), // executeInDocker($this->deployment_uuid, "cat $this->workdir/.env 2>/dev/null || true"),
@ -806,15 +835,7 @@ private function save_environment_variables()
// ] // ]
// ); // );
// } // }
$envs_base64 = base64_encode($envs->implode("\n"));
$this->execute_remote_command(
[
executeInDocker($this->deployment_uuid, "echo '$envs_base64' | base64 -d | tee $this->workdir/{$this->env_filename} > /dev/null")
],
[
"echo '$envs_base64' | base64 -d | tee $this->configuration_dir/{$this->env_filename} > /dev/null"
]
);
} }
@ -1295,7 +1316,7 @@ private function generate_compose_file()
// $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename]; // $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
// } // }
// } // }
if ($this->env_filename) { if (!is_null($this->env_filename)) {
$docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename]; $docker_compose['services'][$this->container_name]['env_file'] = [$this->env_filename];
} }
if (!$this->custom_healthcheck_found) { if (!$this->custom_healthcheck_found) {

View File

@ -860,6 +860,9 @@ public function validateCoolifyNetwork($isSwarm = false, $isBuildServer = false)
} }
public function isNonRoot() public function isNonRoot()
{ {
if ($this->user instanceof Stringable) {
return $this->user->value() !== 'root';
}
return $this->user !== 'root'; return $this->user !== 'root';
} }
} }

View File

@ -7,7 +7,7 @@
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.264', 'release' => '4.0.0-beta.265',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.264'; return '4.0.0-beta.265';

View File

@ -87,7 +87,7 @@ class="fixed top-4 right-16" x-on:click="toggleScroll"><svg class="icon" viewBox
@foreach (decode_remote_command_output($application_deployment_queue) as $line) @foreach (decode_remote_command_output($application_deployment_queue) as $line)
<span @class([ <span @class([
'dark:text-warning whitespace-pre-line' => $line['hidden'], 'dark:text-warning whitespace-pre-line' => $line['hidden'],
'text-red-500 font-bold' => $line['type'] == 'stderr', 'text-red-500 font-bold whitespace-pre-line' => $line['type'] == 'stderr',
])>[{{ $line['timestamp'] }}] @if ($line['hidden']) ])>[{{ $line['timestamp'] }}] @if ($line['hidden'])
<br><br>[COMMAND] {{ $line['command'] }}<br>[OUTPUT] <br><br>[COMMAND] {{ $line['command'] }}<br>[OUTPUT]
@endif @if (str($line['output'])->contains('http://') || str($line['output'])->contains('https://')) @endif @if (str($line['output'])->contains('http://') || str($line['output'])->contains('https://'))

View File

@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.264" "version": "4.0.0-beta.265"
} }
} }
} }