Merge pull request #2012 from coollabsio/next

v4.0.0-beta.261
This commit is contained in:
Andras Bacsai
2024-04-17 15:34:44 +02:00
committed by GitHub
13 changed files with 84 additions and 48 deletions

View File

@@ -56,7 +56,7 @@ class Handler extends ExceptionHandler
{ {
$this->reportable(function (Throwable $e) { $this->reportable(function (Throwable $e) {
if (isDev()) { if (isDev()) {
// return; return;
} }
if ($e instanceof RuntimeException) { if ($e instanceof RuntimeException) {
return; return;

View File

@@ -49,6 +49,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
private string $deployment_uuid; private string $deployment_uuid;
private int $pull_request_id; private int $pull_request_id;
private string $commit; private string $commit;
private bool $rollback;
private bool $force_rebuild; private bool $force_rebuild;
private bool $restart_only; private bool $restart_only;
@@ -117,6 +118,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->deployment_uuid = $this->application_deployment_queue->deployment_uuid; $this->deployment_uuid = $this->application_deployment_queue->deployment_uuid;
$this->pull_request_id = $this->application_deployment_queue->pull_request_id; $this->pull_request_id = $this->application_deployment_queue->pull_request_id;
$this->commit = $this->application_deployment_queue->commit; $this->commit = $this->application_deployment_queue->commit;
$this->rollback = $this->application_deployment_queue->rollback;
$this->force_rebuild = $this->application_deployment_queue->force_rebuild; $this->force_rebuild = $this->application_deployment_queue->force_rebuild;
$this->restart_only = $this->application_deployment_queue->restart_only; $this->restart_only = $this->application_deployment_queue->restart_only;
$this->only_this_server = $this->application_deployment_queue->only_this_server; $this->only_this_server = $this->application_deployment_queue->only_this_server;
@@ -789,9 +791,10 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
"save" => "dotenv" "save" => "dotenv"
]); ]);
if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) { if (str($this->saved_outputs->get('dotenv'))->isNotEmpty()) {
$base64_dotenv = base64_encode($this->saved_outputs->get('dotenv')->value());
$this->execute_remote_command( $this->execute_remote_command(
[ [
"echo '{$this->saved_outputs->get('dotenv')->value()}' | tee $this->configuration_dir/.env > /dev/null" "echo '{$base64_dotenv}' | base64 -d | tee $this->configuration_dir/.env > /dev/null"
] ]
); );
} else { } else {
@@ -1070,7 +1073,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
], ],
); );
} }
if ($this->saved_outputs->get('git_commit_sha')) { if ($this->saved_outputs->get('git_commit_sha') && !$this->rollback) {
$this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t"); $this->commit = $this->saved_outputs->get('git_commit_sha')->before("\t");
} }
} }

View File

@@ -18,7 +18,6 @@ class Rollback extends Component
{ {
$this->parameters = get_route_parameters(); $this->parameters = get_route_parameters();
} }
public function rollbackImage($commit) public function rollbackImage($commit)
{ {
$deployment_uuid = new Cuid2(7); $deployment_uuid = new Cuid2(7);
@@ -27,6 +26,7 @@ class Rollback extends Component
application: $this->application, application: $this->application,
deployment_uuid: $deployment_uuid, deployment_uuid: $deployment_uuid,
commit: $commit, commit: $commit,
rollback: true,
force_rebuild: false, force_rebuild: false,
); );
return redirect()->route('project.application.deployment.show', [ return redirect()->route('project.application.deployment.show', [

View File

@@ -9,7 +9,7 @@ use App\Models\StandaloneDocker;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Spatie\Url\Url; use Spatie\Url\Url;
function queue_application_deployment(Application $application, string $deployment_uuid, int | null $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $restart_only = false, ?string $git_type = null, bool $no_questions_asked = false, Server $server = null, StandaloneDocker $destination = null, bool $only_this_server = false) function queue_application_deployment(Application $application, string $deployment_uuid, int | null $pull_request_id = 0, string $commit = 'HEAD', bool $force_rebuild = false, bool $is_webhook = false, bool $restart_only = false, ?string $git_type = null, bool $no_questions_asked = false, Server $server = null, StandaloneDocker $destination = null, bool $only_this_server = false, bool $rollback = false)
{ {
$application_id = $application->id; $application_id = $application->id;
$deployment_link = Url::fromString($application->link() . "/deployment/{$deployment_uuid}"); $deployment_link = Url::fromString($application->link() . "/deployment/{$deployment_uuid}");
@@ -38,6 +38,7 @@ function queue_application_deployment(Application $application, string $deployme
'is_webhook' => $is_webhook, 'is_webhook' => $is_webhook,
'restart_only' => $restart_only, 'restart_only' => $restart_only,
'commit' => $commit, 'commit' => $commit,
'rollback' => $rollback,
'git_type' => $git_type, 'git_type' => $git_type,
'only_this_server' => $only_this_server 'only_this_server' => $only_this_server
]); ]);

View File

@@ -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.260', 'release' => '4.0.0-beta.261',
// 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.260'; return '4.0.0-beta.261';

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->boolean('rollback')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->dropColumn('rollback');
});
}
};

View File

@@ -95,7 +95,7 @@ services:
expose: expose:
- "${APP_PORT:-8000}" - "${APP_PORT:-8000}"
healthcheck: healthcheck:
test: curl --fail http://localhost:80/api/health || exit 1 test: curl --fail http://127.0.0.1:80/api/health || exit 1
interval: 5s interval: 5s
retries: 10 retries: 10
timeout: 2s timeout: 2s
@@ -142,7 +142,7 @@ services:
SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}" SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY}"
SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}" SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET}"
healthcheck: healthcheck:
test: wget -qO- http://localhost:6001/ready || exit 1 test: wget -qO- http://127.0.0.1:6001/ready || exit 1
interval: 5s interval: 5s
retries: 10 retries: 10
timeout: 2s timeout: 2s

View File

@@ -83,48 +83,48 @@
<livewire:project.application.general :application="$application" /> <livewire:project.application.general :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'swarm'" class="h-full"> <div x-cloak x-show="activeTab === 'swarm'" class="h-full">
<livewire:project.application.swarm :application="$application" lazy /> <livewire:project.application.swarm :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'advanced'" class="h-full"> <div x-cloak x-show="activeTab === 'advanced'" class="h-full">
<livewire:project.application.advanced :application="$application" lazy /> <livewire:project.application.advanced :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'environment-variables'"> <div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.shared.environment-variable.all :resource="$application" lazy /> <livewire:project.shared.environment-variable.all :resource="$application" />
</div> </div>
@if ($application->git_based()) @if ($application->git_based())
<div x-cloak x-show="activeTab === 'source'"> <div x-cloak x-show="activeTab === 'source'">
<livewire:project.application.source :application="$application" lazy /> <livewire:project.application.source :application="$application" />
</div> </div>
@endif @endif
<div x-cloak x-show="activeTab === 'servers'"> <div x-cloak x-show="activeTab === 'servers'">
<livewire:project.shared.destination :resource="$application" :servers="$servers" lazy /> <livewire:project.shared.destination :resource="$application" :servers="$servers" />
</div> </div>
<div x-cloak x-show="activeTab === 'storages'"> <div x-cloak x-show="activeTab === 'storages'">
<livewire:project.service.storage :resource="$application" lazy /> <livewire:project.service.storage :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'webhooks'"> <div x-cloak x-show="activeTab === 'webhooks'">
<livewire:project.shared.webhooks :resource="$application" lazy /> <livewire:project.shared.webhooks :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'previews'"> <div x-cloak x-show="activeTab === 'previews'">
<livewire:project.application.previews :application="$application" lazy /> <livewire:project.application.previews :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'health'"> <div x-cloak x-show="activeTab === 'health'">
<livewire:project.shared.health-checks :resource="$application" lazy /> <livewire:project.shared.health-checks :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'rollback'"> <div x-cloak x-show="activeTab === 'rollback'">
<livewire:project.application.rollback :application="$application" lazy /> <livewire:project.application.rollback :application="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'resource-limits'"> <div x-cloak x-show="activeTab === 'resource-limits'">
<livewire:project.shared.resource-limits :resource="$application" lazy /> <livewire:project.shared.resource-limits :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'scheduled-tasks'"> <div x-cloak x-show="activeTab === 'scheduled-tasks'">
<livewire:project.shared.scheduled-task.all :resource="$application" lazy /> <livewire:project.shared.scheduled-task.all :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'resource-operations'"> <div x-cloak x-show="activeTab === 'resource-operations'">
<livewire:project.shared.resource-operations :resource="$application" lazy /> <livewire:project.shared.resource-operations :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'tags'"> <div x-cloak x-show="activeTab === 'tags'">
<livewire:project.shared.tags :resource="$application" lazy /> <livewire:project.shared.tags :resource="$application" />
</div> </div>
<div x-cloak x-show="activeTab === 'danger'"> <div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$application" /> <livewire:project.shared.danger :resource="$application" />

View File

@@ -57,7 +57,7 @@
<div class="pb-4">Previews</div> <div class="pb-4">Previews</div>
<div class="flex flex-wrap gap-6"> <div class="flex flex-wrap gap-6">
@foreach ($application->previews as $preview) @foreach ($application->previews as $preview)
<div class="flex flex-col p-4 dark:bg-coolgray-200"> <div class="flex flex-col p-4 dark:bg-coolgray-100">
<div class="flex gap-2">PR #{{ data_get($preview, 'pull_request_id') }} | <div class="flex gap-2">PR #{{ data_get($preview, 'pull_request_id') }} |
@if (Str::of(data_get($preview, 'status'))->startsWith('running')) @if (Str::of(data_get($preview, 'status'))->startsWith('running'))
<x-status.running :status="data_get($preview, 'status')" /> <x-status.running :status="data_get($preview, 'status')" />
@@ -86,6 +86,7 @@
Redeploy Redeploy
@endif @endif
</x-forms.button> </x-forms.button>
@if (count($parameters) > 0)
<a <a
href="{{ route('project.application.deployment.index', [...$parameters, 'pull_request_id' => data_get($preview, 'pull_request_id')]) }}"> href="{{ route('project.application.deployment.index', [...$parameters, 'pull_request_id' => data_get($preview, 'pull_request_id')]) }}">
<x-forms.button class="dark:bg-coolgray-500"> <x-forms.button class="dark:bg-coolgray-500">
@@ -98,6 +99,7 @@
Application Logs Application Logs
</x-forms.button> </x-forms.button>
</a> </a>
@endif
<x-forms.button isError class="dark:bg-coolgray-500" <x-forms.button isError class="dark:bg-coolgray-500"
wire:click="stop({{ data_get($preview, 'pull_request_id') }})">Delete wire:click="stop({{ data_get($preview, 'pull_request_id') }})">Delete
</x-forms.button> </x-forms.button>

View File

@@ -9,7 +9,7 @@
<div class="flex flex-wrap"> <div class="flex flex-wrap">
@forelse ($images as $image) @forelse ($images as $image)
<div class="w-2/4 p-2"> <div class="w-2/4 p-2">
<div class="bg-white border rounded dark:border-bg-black dark:bg-coolgray-100"> <div class="bg-white border rounded dark:border-black dark:bg-coolgray-100">
<div class="p-2"> <div class="p-2">
<div class=""> <div class="">
@if (data_get($image, 'is_current')) @if (data_get($image, 'is_current'))

View File

@@ -75,7 +75,8 @@
<x-modal-input title="Edit Domains"> <x-modal-input title="Edit Domains">
<x-slot:content> <x-slot:content>
<span class="cursor-pointer"> <span class="cursor-pointer">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 dark:text-warning text-coollabs" <svg xmlns="http://www.w3.org/2000/svg"
class="w-4 h-4 dark:text-warning text-coollabs"
viewBox="0 0 24 24"> viewBox="0 0 24 24">
<g fill="none" stroke="currentColor" <g fill="none" stroke="currentColor"
stroke-linecap="round" stroke-linejoin="round" stroke-linecap="round" stroke-linejoin="round"
@@ -89,7 +90,8 @@
</span> </span>
</x-slot:content> </x-slot:content>
<livewire:project.service.edit-domain <livewire:project.service.edit-domain
applicationId="{{ $application->id }}" wire:key="edit-domain-{{ $application->id }}" /> applicationId="{{ $application->id }}"
wire:key="edit-domain-{{ $application->id }}" />
</x-modal-input> </x-modal-input>
</span> </span>
@endif @endif
@@ -160,14 +162,14 @@
<span class="dark:text-warning">Please modify storage layout in your Docker Compose file.</span> <span class="dark:text-warning">Please modify storage layout in your Docker Compose file.</span>
@foreach ($applications as $application) @foreach ($applications as $application)
<livewire:project.service.storage wire:key="application-{{ $application->id }}" <livewire:project.service.storage wire:key="application-{{ $application->id }}"
:resource="$application" lazy /> :resource="$application" />
@endforeach @endforeach
@foreach ($databases as $database) @foreach ($databases as $database)
<livewire:project.service.storage wire:key="database-{{ $database->id }}" :resource="$database" lazy /> <livewire:project.service.storage wire:key="database-{{ $database->id }}" :resource="$database" />
@endforeach @endforeach
</div> </div>
<div x-cloak x-show="activeTab === 'webhooks'"> <div x-cloak x-show="activeTab === 'webhooks'">
<livewire:project.shared.webhooks :resource="$service" lazy /> <livewire:project.shared.webhooks :resource="$service" />
</div> </div>
<div x-cloak x-show="activeTab === 'logs'"> <div x-cloak x-show="activeTab === 'logs'">
<livewire:project.shared.logs :resource="$service" /> <livewire:project.shared.logs :resource="$service" />
@@ -176,13 +178,13 @@
<livewire:project.shared.execute-container-command :resource="$service" /> <livewire:project.shared.execute-container-command :resource="$service" />
</div> </div>
<div x-cloak x-show="activeTab === 'environment-variables'"> <div x-cloak x-show="activeTab === 'environment-variables'">
<livewire:project.shared.environment-variable.all :resource="$service" lazy /> <livewire:project.shared.environment-variable.all :resource="$service" />
</div> </div>
<div x-cloak x-show="activeTab === 'resource-operations'"> <div x-cloak x-show="activeTab === 'resource-operations'">
<livewire:project.shared.resource-operations :resource="$service" lazy /> <livewire:project.shared.resource-operations :resource="$service" />
</div> </div>
<div x-cloak x-show="activeTab === 'tags'"> <div x-cloak x-show="activeTab === 'tags'">
<livewire:project.shared.tags :resource="$service" lazy /> <livewire:project.shared.tags :resource="$service" />
</div> </div>
<div x-cloak x-show="activeTab === 'danger'"> <div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$service" /> <livewire:project.shared.danger :resource="$service" />

View File

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