mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-05 07:52:34 +00:00
Migrate queues to Horizon (#621)
This commit is contained in:
@ -65,7 +65,7 @@ public function delete(Backup $backup): void
|
||||
}
|
||||
|
||||
$backup->delete();
|
||||
});
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,6 @@ public function delete(BackupFile $file): void
|
||||
|
||||
dispatch(function () use ($file): void {
|
||||
$file->deleteFile();
|
||||
});
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public function restore(BackupFile $backupFile, array $input): void
|
||||
})->catch(function () use ($backupFile): void {
|
||||
$backupFile->status = BackupFileStatus::RESTORE_FAILED;
|
||||
$backupFile->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ public function run(Backup $backup): BackupFile
|
||||
$backup->save();
|
||||
$file->status = BackupFileStatus::FAILED;
|
||||
$file->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public function create(Server $server, array $input): FirewallRule
|
||||
|
||||
$rule->save();
|
||||
|
||||
dispatch(fn () => $this->applyRule($rule));
|
||||
dispatch(fn () => $this->applyRule($rule))->onQueue('ssh');
|
||||
|
||||
return $rule;
|
||||
}
|
||||
@ -58,7 +58,7 @@ public function update(FirewallRule $rule, array $input): FirewallRule
|
||||
'status' => FirewallRuleStatus::UPDATING,
|
||||
]);
|
||||
|
||||
dispatch(fn () => $this->applyRule($rule));
|
||||
dispatch(fn () => $this->applyRule($rule))->onQueue('ssh');
|
||||
|
||||
return $rule;
|
||||
}
|
||||
@ -68,7 +68,7 @@ public function delete(FirewallRule $rule): void
|
||||
$rule->status = FirewallRuleStatus::DELETING;
|
||||
$rule->save();
|
||||
|
||||
dispatch(fn () => $this->applyRule($rule));
|
||||
dispatch(fn () => $this->applyRule($rule))->onQueue('ssh');
|
||||
}
|
||||
|
||||
protected function applyRule(FirewallRule $rule): void
|
||||
|
@ -44,7 +44,7 @@ function () use ($service, $input): void {
|
||||
$typeData['extensions'] = array_values(array_diff($typeData['extensions'], [$input['extension']]));
|
||||
$service->type_data = $typeData;
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public function create(Site $site, array $input): Redirect
|
||||
$redirect->status = RedirectStatus::FAILED;
|
||||
$redirect->save();
|
||||
})
|
||||
->onConnection('ssh');
|
||||
->onQueue('ssh-unique');
|
||||
|
||||
return $redirect->refresh();
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ public function delete(Site $site, Redirect $redirect): void
|
||||
})->catch(function () use ($redirect): void {
|
||||
$redirect->status = RedirectStatus::FAILED;
|
||||
$redirect->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public function create(Site $site, array $input): void
|
||||
})->catch(function () use ($ssl): void {
|
||||
$ssl->status = SslStatus::FAILED;
|
||||
$ssl->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public function execute(Script $script, User $user, array $input): ScriptExecuti
|
||||
})->catch(function () use ($execution): void {
|
||||
$execution->status = ScriptExecutionStatus::FAILED;
|
||||
$execution->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
|
||||
return $execution;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public function create(User $creator, Project $project, array $input): Server
|
||||
'error' => (string) $e,
|
||||
]);
|
||||
})
|
||||
->onConnection('ssh');
|
||||
->onQueue('ssh');
|
||||
|
||||
return $this->server;
|
||||
} catch (Exception $e) {
|
||||
|
@ -20,6 +20,6 @@ public function update(Server $server): void
|
||||
})->catch(function () use ($server): void {
|
||||
Notifier::send($server, new ServerUpdateFailed($server));
|
||||
$server->checkConnection();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ public function install(Server $server, array $input): Service
|
||||
})->catch(function () use ($service): void {
|
||||
$service->status = ServiceStatus::INSTALLATION_FAILED;
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public function start(Service $service): void
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
}
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function stop(Service $service): void
|
||||
@ -37,7 +37,7 @@ public function stop(Service $service): void
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
}
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function restart(Service $service): void
|
||||
@ -53,7 +53,7 @@ public function restart(Service $service): void
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
}
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function enable(Service $service): void
|
||||
@ -69,7 +69,7 @@ public function enable(Service $service): void
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
}
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function disable(Service $service): void
|
||||
@ -85,7 +85,7 @@ public function disable(Service $service): void
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
}
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
private function validate(Service $service): void
|
||||
|
@ -26,6 +26,6 @@ public function uninstall(Service $service): void
|
||||
})->catch(function () use ($service): void {
|
||||
$service->status = ServiceStatus::FAILED;
|
||||
$service->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public function create(Server $server, array $input): Site
|
||||
$site->status = SiteStatus::INSTALLATION_FAILED;
|
||||
$site->save();
|
||||
Notifier::send($site, new SiteInstallationFailed($site));
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
|
||||
DB::commit();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public function run(Site $site): Deployment
|
||||
$deployment->status = DeploymentStatus::FAILED;
|
||||
$deployment->save();
|
||||
Notifier::send($site, new DeploymentCompleted($deployment, $site));
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh-unique');
|
||||
|
||||
return $deployment;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public function execute(Command $command, User $user, array $input): CommandExec
|
||||
})->catch(function () use ($execution): void {
|
||||
$execution->status = CommandExecutionStatus::FAILED;
|
||||
$execution->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
|
||||
return $execution;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public function create(Server $server, array $input, ?Site $site = null): void
|
||||
$worker->save();
|
||||
})->catch(function () use ($worker): void {
|
||||
$worker->delete();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ public function edit(Worker $worker, array $input): void
|
||||
})->catch(function () use ($worker): void {
|
||||
$worker->status = WorkerStatus::FAILED;
|
||||
$worker->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ public function start(Worker $worker): void
|
||||
$handler->start($worker->id, $worker->site_id);
|
||||
$worker->status = WorkerStatus::RUNNING;
|
||||
$worker->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function stop(Worker $worker): void
|
||||
@ -36,7 +36,7 @@ public function stop(Worker $worker): void
|
||||
$handler->stop($worker->id, $worker->site_id);
|
||||
$worker->status = WorkerStatus::STOPPED;
|
||||
$worker->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
|
||||
public function restart(Worker $worker): void
|
||||
@ -51,6 +51,6 @@ public function restart(Worker $worker): void
|
||||
$handler->restart($worker->id, $worker->site_id);
|
||||
$worker->status = WorkerStatus::RUNNING;
|
||||
$worker->save();
|
||||
})->onConnection('ssh');
|
||||
})->onQueue('ssh');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user