commit
42e37246f3
@ -5,6 +5,7 @@ namespace App\Actions\CoolifyTask;
|
|||||||
use App\Enums\ActivityTypes;
|
use App\Enums\ActivityTypes;
|
||||||
use App\Enums\ProcessStatus;
|
use App\Enums\ProcessStatus;
|
||||||
use App\Jobs\ApplicationDeploymentJob;
|
use App\Jobs\ApplicationDeploymentJob;
|
||||||
|
use App\Jobs\ApplicationDeploymentJobNew;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Process\ProcessResult;
|
use Illuminate\Process\ProcessResult;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@ -165,7 +166,15 @@ class RunRemoteProcess
|
|||||||
public function encodeOutput($type, $output)
|
public function encodeOutput($type, $output)
|
||||||
{
|
{
|
||||||
$outputStack = json_decode($this->activity->description, associative: true, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
$outputStack = json_decode($this->activity->description, associative: true, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
||||||
|
if (isDev()) {
|
||||||
|
$outputStack[] = [
|
||||||
|
'type' => $type,
|
||||||
|
'output' => $output,
|
||||||
|
'timestamp' => hrtime(true),
|
||||||
|
'batch' => ApplicationDeploymentJobNew::$batch_counter,
|
||||||
|
'order' => $this->getLatestCounter(),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
$outputStack[] = [
|
$outputStack[] = [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'output' => $output,
|
'output' => $output,
|
||||||
@ -173,6 +182,7 @@ class RunRemoteProcess
|
|||||||
'batch' => ApplicationDeploymentJob::$batch_counter,
|
'batch' => ApplicationDeploymentJob::$batch_counter,
|
||||||
'order' => $this->getLatestCounter(),
|
'order' => $this->getLatestCounter(),
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return json_encode($outputStack, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
return json_encode($outputStack, flags: JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
|
@ -1813,7 +1813,11 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
} else {
|
} else {
|
||||||
// Pure Dockerfile based deployment
|
// Pure Dockerfile based deployment
|
||||||
if ($this->application->dockerfile) {
|
if ($this->application->dockerfile) {
|
||||||
|
if ($this->force_rebuild) {
|
||||||
|
$build_command = "docker build --no-cache --pull {$this->buildTarget} {$this->addHosts} --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t {$this->production_image_name} {$this->workdir}";
|
||||||
|
} else {
|
||||||
$build_command = "docker build --pull {$this->buildTarget} {$this->addHosts} --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t {$this->production_image_name} {$this->workdir}";
|
$build_command = "docker build --pull {$this->buildTarget} {$this->addHosts} --network host -f {$this->workdir}{$this->dockerfile_location} {$this->build_args} --progress plain -t {$this->production_image_name} {$this->workdir}";
|
||||||
|
}
|
||||||
$base64_build_command = base64_encode($build_command);
|
$base64_build_command = base64_encode($build_command);
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
|
2154
app/Jobs/ApplicationDeploymentJobNew.php
Normal file
2154
app/Jobs/ApplicationDeploymentJobNew.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -669,7 +669,9 @@ class Application extends BaseModel
|
|||||||
$git_clone_command = "{$git_clone_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository} {$baseDir}";
|
$git_clone_command = "{$git_clone_command} $source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository} {$baseDir}";
|
||||||
$fullRepoUrl = "$source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}";
|
$fullRepoUrl = "$source_html_url_scheme://x-access-token:$github_access_token@$source_html_url_host/{$customRepository}";
|
||||||
}
|
}
|
||||||
|
if (!$only_checkout) {
|
||||||
$git_clone_command = $this->setGitImportSettings($deployment_uuid, $git_clone_command, public: false);
|
$git_clone_command = $this->setGitImportSettings($deployment_uuid, $git_clone_command, public: false);
|
||||||
|
}
|
||||||
if ($exec_in_docker) {
|
if ($exec_in_docker) {
|
||||||
$commands->push(executeInDocker($deployment_uuid, $git_clone_command));
|
$commands->push(executeInDocker($deployment_uuid, $git_clone_command));
|
||||||
} else {
|
} else {
|
||||||
@ -888,7 +890,8 @@ class Application extends BaseModel
|
|||||||
// }
|
// }
|
||||||
$commands = collect([
|
$commands = collect([
|
||||||
"rm -rf /tmp/{$uuid}",
|
"rm -rf /tmp/{$uuid}",
|
||||||
"mkdir -p /tmp/{$uuid} && cd /tmp/{$uuid}",
|
"mkdir -p /tmp/{$uuid}",
|
||||||
|
"cd /tmp/{$uuid}",
|
||||||
$cloneCommand,
|
$cloneCommand,
|
||||||
"git sparse-checkout init --cone",
|
"git sparse-checkout init --cone",
|
||||||
"git sparse-checkout set {$fileList->implode(' ')}",
|
"git sparse-checkout set {$fileList->implode(' ')}",
|
||||||
@ -899,29 +902,15 @@ class Application extends BaseModel
|
|||||||
if (!$composeFileContent) {
|
if (!$composeFileContent) {
|
||||||
$this->docker_compose_location = $initialDockerComposeLocation;
|
$this->docker_compose_location = $initialDockerComposeLocation;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
$commands = collect([
|
||||||
|
"rm -rf /tmp/{$uuid}",
|
||||||
|
]);
|
||||||
|
instant_remote_process($commands, $this->destination->server, false);
|
||||||
throw new \RuntimeException("Docker Compose file not found at: $workdir$composeFile<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.");
|
throw new \RuntimeException("Docker Compose file not found at: $workdir$composeFile<br><br>Check if you used the right extension (.yaml or .yml) in the compose file name.");
|
||||||
} else {
|
} else {
|
||||||
$this->docker_compose_raw = $composeFileContent;
|
$this->docker_compose_raw = $composeFileContent;
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
// if ($composeFile === $prComposeFile) {
|
|
||||||
// $this->docker_compose_pr_raw = $composeFileContent;
|
|
||||||
// $this->save();
|
|
||||||
// } else {
|
|
||||||
// $commands = collect([
|
|
||||||
// "cd /tmp/{$uuid}",
|
|
||||||
// "cat .$workdir$prComposeFile",
|
|
||||||
// ]);
|
|
||||||
// $composePrFileContent = instant_remote_process($commands, $this->destination->server, false);
|
|
||||||
// if (!$composePrFileContent) {
|
|
||||||
// $this->docker_compose_pr_location = $initialDockerComposePrLocation;
|
|
||||||
// $this->save();
|
|
||||||
// throw new \Exception("Could not load compose file from $workdir$prComposeFile");
|
|
||||||
// } else {
|
|
||||||
// $this->docker_compose_pr_raw = $composePrFileContent;
|
|
||||||
// $this->save();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
$commands = collect([
|
$commands = collect([
|
||||||
"rm -rf /tmp/{$uuid}",
|
"rm -rf /tmp/{$uuid}",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use App\Enums\ApplicationDeploymentStatus;
|
use App\Enums\ApplicationDeploymentStatus;
|
||||||
use App\Jobs\ApplicationDeploymentJob;
|
use App\Jobs\ApplicationDeploymentJob;
|
||||||
|
use App\Jobs\ApplicationDeploymentJobNew;
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
@ -42,6 +43,17 @@ function queue_application_deployment(Application $application, string $deployme
|
|||||||
'only_this_server' => $only_this_server
|
'only_this_server' => $only_this_server
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (isDev()) {
|
||||||
|
if ($no_questions_asked) {
|
||||||
|
dispatch(new ApplicationDeploymentJobNew(
|
||||||
|
application_deployment_queue_id: $deployment->id,
|
||||||
|
));
|
||||||
|
} else if (next_queuable($server_id, $application_id)) {
|
||||||
|
dispatch(new ApplicationDeploymentJobNew(
|
||||||
|
application_deployment_queue_id: $deployment->id,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if ($no_questions_asked) {
|
if ($no_questions_asked) {
|
||||||
dispatch(new ApplicationDeploymentJob(
|
dispatch(new ApplicationDeploymentJob(
|
||||||
application_deployment_queue_id: $deployment->id,
|
application_deployment_queue_id: $deployment->id,
|
||||||
@ -51,15 +63,22 @@ function queue_application_deployment(Application $application, string $deployme
|
|||||||
application_deployment_queue_id: $deployment->id,
|
application_deployment_queue_id: $deployment->id,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function force_start_deployment(ApplicationDeploymentQueue $deployment)
|
function force_start_deployment(ApplicationDeploymentQueue $deployment)
|
||||||
{
|
{
|
||||||
$deployment->update([
|
$deployment->update([
|
||||||
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
||||||
]);
|
]);
|
||||||
|
if (isDev()) {
|
||||||
|
dispatch(new ApplicationDeploymentJobNew(
|
||||||
|
application_deployment_queue_id: $deployment->id,
|
||||||
|
));
|
||||||
|
} else {
|
||||||
dispatch(new ApplicationDeploymentJob(
|
dispatch(new ApplicationDeploymentJob(
|
||||||
application_deployment_queue_id: $deployment->id,
|
application_deployment_queue_id: $deployment->id,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function queue_next_deployment(Application $application)
|
function queue_next_deployment(Application $application)
|
||||||
{
|
{
|
||||||
@ -69,10 +88,16 @@ function queue_next_deployment(Application $application)
|
|||||||
$next_found->update([
|
$next_found->update([
|
||||||
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
'status' => ApplicationDeploymentStatus::IN_PROGRESS->value,
|
||||||
]);
|
]);
|
||||||
|
if (isDev()) {
|
||||||
|
dispatch(new ApplicationDeploymentJobNew(
|
||||||
|
application_deployment_queue_id: $next_found->id,
|
||||||
|
));
|
||||||
|
} else {
|
||||||
dispatch(new ApplicationDeploymentJob(
|
dispatch(new ApplicationDeploymentJob(
|
||||||
application_deployment_queue_id: $next_found->id,
|
application_deployment_queue_id: $next_found->id,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function next_queuable(string $server_id, string $application_id): bool
|
function next_queuable(string $server_id, string $application_id): bool
|
||||||
|
@ -7,7 +7,7 @@ return [
|
|||||||
|
|
||||||
// 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.289',
|
'release' => '4.0.0-beta.290',
|
||||||
// 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'),
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.289';
|
return '4.0.0-beta.290';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"coolify": {
|
"coolify": {
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.289"
|
"version": "4.0.0-beta.290"
|
||||||
},
|
},
|
||||||
"sentinel": {
|
"sentinel": {
|
||||||
"version": "0.0.4"
|
"version": "0.0.4"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user