Add fallback node refresh without maintenance
This commit is contained in:
parent
00f43aae7a
commit
19a4da6301
|
|
@ -343,6 +343,21 @@ public function runNodeRefresh(): void
|
||||||
$this->startNodeRefreshJob();
|
$this->startNodeRefreshJob();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function runNodeRefreshFallback(): void
|
||||||
|
{
|
||||||
|
if (! $this->canRunUpdate()) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Permessi insufficienti')
|
||||||
|
->body('Solo super-admin/admin/amministratore possono lanciare il refresh completo del nodo.')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->startNodeRefreshJob(true);
|
||||||
|
}
|
||||||
|
|
||||||
public function generateDevelopmentSnapshot(): void
|
public function generateDevelopmentSnapshot(): void
|
||||||
{
|
{
|
||||||
if (! $this->canRunUpdate()) {
|
if (! $this->canRunUpdate()) {
|
||||||
|
|
@ -1749,7 +1764,7 @@ private function startGitSyncJob(): void
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function startNodeRefreshJob(): void
|
private function startNodeRefreshJob(bool $skipMaintenance = false): void
|
||||||
{
|
{
|
||||||
$jobId = now()->format('YmdHis') . '-' . Str::lower(Str::random(6));
|
$jobId = now()->format('YmdHis') . '-' . Str::lower(Str::random(6));
|
||||||
$jobsDir = storage_path('app/support/update-jobs');
|
$jobsDir = storage_path('app/support/update-jobs');
|
||||||
|
|
@ -1763,13 +1778,17 @@ private function startNodeRefreshJob(): void
|
||||||
$this->updateJobId = $jobId;
|
$this->updateJobId = $jobId;
|
||||||
$this->updateInProgress = true;
|
$this->updateInProgress = true;
|
||||||
$this->updateProgressPercent = 1;
|
$this->updateProgressPercent = 1;
|
||||||
$this->updateProgressMessage = 'Preparazione refresh nodo da Gitea...';
|
$this->updateProgressMessage = $skipMaintenance
|
||||||
|
? 'Preparazione refresh nodo da Gitea senza maintenance mode...'
|
||||||
|
: 'Preparazione refresh nodo da Gitea...';
|
||||||
$this->updateProgressStatus = 'running';
|
$this->updateProgressStatus = 'running';
|
||||||
|
|
||||||
@file_put_contents($progressPath, json_encode([
|
@file_put_contents($progressPath, json_encode([
|
||||||
'timestamp' => now()->toIso8601String(),
|
'timestamp' => now()->toIso8601String(),
|
||||||
'percent' => 1,
|
'percent' => 1,
|
||||||
'message' => 'Preparazione refresh nodo da Gitea...',
|
'message' => $skipMaintenance
|
||||||
|
? 'Preparazione refresh nodo da Gitea senza maintenance mode...'
|
||||||
|
: 'Preparazione refresh nodo da Gitea...',
|
||||||
'status' => 'running',
|
'status' => 'running',
|
||||||
'exit_code' => null,
|
'exit_code' => null,
|
||||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||||
|
|
@ -1795,6 +1814,10 @@ private function startNodeRefreshJob(): void
|
||||||
$args[] = '--skip-backup';
|
$args[] = '--skip-backup';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($skipMaintenance) {
|
||||||
|
$args[] = '--skip-maintenance';
|
||||||
|
}
|
||||||
|
|
||||||
if ($driveEnabled && $adminId > 0) {
|
if ($driveEnabled && $adminId > 0) {
|
||||||
$args[] = '--drive';
|
$args[] = '--drive';
|
||||||
$args[] = '--admin-id=' . $adminId;
|
$args[] = '--admin-id=' . $adminId;
|
||||||
|
|
@ -1826,7 +1849,9 @@ private function startNodeRefreshJob(): void
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Refresh nodo avviato')
|
->title('Refresh nodo avviato')
|
||||||
->body('Sync da Gitea, migrate e rebuild cache verranno eseguiti direttamente sul nodo da browser.')
|
->body($skipMaintenance
|
||||||
|
? 'Refresh nodo avviato senza maintenance mode. Usalo solo come percorso di riserva su macchine dove il blocco accessi non si attiva.'
|
||||||
|
: 'Sync da Gitea, migrate e rebuild cache verranno eseguiti direttamente sul nodo da browser.')
|
||||||
->success()
|
->success()
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@
|
||||||
<x-filament::button size="sm" color="warning" wire:click="runNodeRefresh" :disabled="!$supportCanRunUpdate">
|
<x-filament::button size="sm" color="warning" wire:click="runNodeRefresh" :disabled="!$supportCanRunUpdate">
|
||||||
Aggiorna staging da Gitea
|
Aggiorna staging da Gitea
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
|
<x-filament::button size="sm" color="gray" wire:click="runNodeRefreshFallback" :disabled="!$supportCanRunUpdate">
|
||||||
|
Refresh di riserva senza maintenance
|
||||||
|
</x-filament::button>
|
||||||
<x-filament::button size="sm" wire:click="runGitSync" :disabled="!$supportCanRunUpdate">
|
<x-filament::button size="sm" wire:click="runGitSync" :disabled="!$supportCanRunUpdate">
|
||||||
Solo sync Git avanzata
|
Solo sync Git avanzata
|
||||||
</x-filament::button>
|
</x-filament::button>
|
||||||
|
|
@ -74,6 +77,10 @@
|
||||||
Il pulsante <span class="font-semibold">Aggiorna staging da Gitea</span> esegue il refresh completo del nodo: backup pre-update, maintenance mode per bloccare nuove operazioni utente, sync da Gitea, <span class="font-mono">composer install</span>, tentativo di build frontend se disponibile, <span class="font-mono">migrate --force</span>, pulizia cache, rebuild Blade e riapertura automatica del sistema.
|
Il pulsante <span class="font-semibold">Aggiorna staging da Gitea</span> esegue il refresh completo del nodo: backup pre-update, maintenance mode per bloccare nuove operazioni utente, sync da Gitea, <span class="font-mono">composer install</span>, tentativo di build frontend se disponibile, <span class="font-mono">migrate --force</span>, pulizia cache, rebuild Blade e riapertura automatica del sistema.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3 rounded-lg border border-slate-200 bg-slate-50 p-3 text-[11px] text-slate-600">
|
||||||
|
Se la macchina remota fallisce su <span class="font-mono">Maintenance mode non attivata</span>, prima allinea il nodo con <span class="font-semibold">Solo sync Git avanzata</span> e poi usa <span class="font-semibold">Refresh di riserva senza maintenance</span>. E un percorso di recupero per nodi dove il blocco accessi Laravel non parte correttamente.
|
||||||
|
</div>
|
||||||
|
|
||||||
@if($this->updateInProgress)
|
@if($this->updateInProgress)
|
||||||
<div class="mt-3 rounded-lg border bg-slate-50 p-3" wire:poll.2s="refreshUpdateProgress">
|
<div class="mt-3 rounded-lg border bg-slate-50 p-3" wire:poll.2s="refreshUpdateProgress">
|
||||||
@else
|
@else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user