new deployer command

This commit is contained in:
Mark Gregory
2026-09-16 12:58:04 +01:00
parent f02f801b31
commit 21ee6e951a
23 changed files with 71 additions and 39 deletions
+10 -5
View File
@@ -217,9 +217,12 @@ class DatabaseStage extends Command
$this->components->task('Restoring complete stage database', function () use ($stage, $remoteDump): bool {
$restore = sprintf(
'PGPASSWORD=%s pg_restore --host=%s --port=%s --username=%s --dbname=%s --no-owner --no-acl --exit-on-error --verbose %s',
escapeshellarg((string) $stage['password']), escapeshellarg((string) $stage['db_host']),
escapeshellarg((string) $stage['db_port']), escapeshellarg((string) $stage['username']),
escapeshellarg((string) $stage['database']), escapeshellarg($remoteDump),
escapeshellarg((string) $stage['password']),
escapeshellarg((string) $stage['db_host']),
escapeshellarg((string) $stage['db_port']),
escapeshellarg((string) $stage['username']),
escapeshellarg((string) $stage['database']),
escapeshellarg($remoteDump),
);
$result = Process::timeout(3600)->run($this->sshCommand($stage, $restore));
$this->throwWhenFailed($result->failed(), "Database restore failed:\n" . $result->errorOutput());
@@ -234,8 +237,10 @@ class DatabaseStage extends Command
$this->components->task('Verifying restored database', function () use ($stage): bool {
$command = sprintf(
'PGPASSWORD=%s psql --host=%s --port=%s --username=%s --dbname=%s --tuples-only --command=%s',
escapeshellarg((string) $stage['password']), escapeshellarg((string) $stage['db_host']),
escapeshellarg((string) $stage['db_port']), escapeshellarg((string) $stage['username']),
escapeshellarg((string) $stage['password']),
escapeshellarg((string) $stage['db_host']),
escapeshellarg((string) $stage['db_port']),
escapeshellarg((string) $stage['username']),
escapeshellarg((string) $stage['database']),
escapeshellarg("SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'public';"),
);
+1 -3
View File
@@ -4,6 +4,4 @@ namespace App\Exceptions;
use RuntimeException;
final class DatabaseStageException extends RuntimeException
{
}
final class DatabaseStageException extends RuntimeException {}
-1
View File
@@ -7,7 +7,6 @@ use Laravel\Horizon\HorizonApplicationServiceProvider;
class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Register the Horizon gate.
*