Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Actions/Application/GenerateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class GenerateConfig
{
use AsAction;

public function handle(Application $application, bool $is_json = false)
public function handle(Application $application, bool $is_json = false): string|array
{
return $application->generateConfig(is_json: $is_json);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Application/IsHorizonQueueEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class IsHorizonQueueEmpty
{
use AsAction;

public function handle()
public function handle(): bool
{
$hostname = gethostname();
$recent = app(JobRepository::class)->getRecent();
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Application/LoadComposeFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LoadComposeFile
{
use AsAction;

public function handle(Application $application)
public function handle(Application $application): void
{
$application->loadComposeFile();
}
Expand Down
6 changes: 4 additions & 2 deletions app/Actions/Application/StopApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StopApplication

public string $jobQueue = 'high';

public function handle(Application $application, bool $previewDeployments = false, bool $dockerCleanup = true)
public function handle(Application $application, bool $previewDeployments = false, bool $dockerCleanup = true): ?string
{
$servers = collect([$application->destination->server]);
if ($application?->additional_servers?->count() > 0) {
Expand All @@ -28,7 +28,7 @@ public function handle(Application $application, bool $previewDeployments = fals
if ($server->isSwarm()) {
instant_remote_process(["docker stack rm {$application->uuid}"], $server);

return;
return null;
}

$containers = $previewDeployments
Expand Down Expand Up @@ -56,5 +56,7 @@ public function handle(Application $application, bool $previewDeployments = fals
}
}
ServiceStatusChanged::dispatch($application->environment->project->team->id);

return null;
}
}
6 changes: 4 additions & 2 deletions app/Actions/Application/StopApplicationOneServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class StopApplicationOneServer
{
use AsAction;

public function handle(Application $application, Server $server)
public function handle(Application $application, Server $server): ?string
{
if ($application->destination->server->isSwarm()) {
return;
return null;
}
if (! $server->isFunctional()) {
return 'Server is not functional';
Expand All @@ -37,5 +37,7 @@ public function handle(Application $application, Server $server)
} catch (\Exception $e) {
return $e->getMessage();
}

return null;
}
}
3 changes: 2 additions & 1 deletion app/Actions/Database/RestartDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;

class RestartDatabase
{
use AsAction;

public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database)
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database): string|Activity|null
{
$server = $database->destination->server;
if (! $server->isFunctional()) {
Expand Down
18 changes: 14 additions & 4 deletions app/Actions/Database/StartClickhouse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Models\StandaloneClickhouse;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;
use Symfony\Component\Yaml\Yaml;

class StartClickhouse
Expand All @@ -16,7 +17,7 @@ class StartClickhouse

public string $configuration_dir;

public function handle(StandaloneClickhouse $database)
public function handle(StandaloneClickhouse $database): Activity
{
$this->database = $database;

Expand Down Expand Up @@ -113,7 +114,10 @@ public function handle(StandaloneClickhouse $database)
return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
}

private function generate_local_persistent_volumes()
/**
* @return array<int, string>
*/
private function generate_local_persistent_volumes(): array
{
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -128,7 +132,10 @@ private function generate_local_persistent_volumes()
return $local_persistent_volumes;
}

private function generate_local_persistent_volumes_only_volume_names()
/**
* @return array<string, array<string, bool|string>>
*/
private function generate_local_persistent_volumes_only_volume_names(): array
{
$local_persistent_volumes_names = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -145,7 +152,10 @@ private function generate_local_persistent_volumes_only_volume_names()
return $local_persistent_volumes_names;
}

private function generate_environment_variables()
/**
* @return array<int, string>
*/
private function generate_environment_variables(): array
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
Expand Down
3 changes: 2 additions & 1 deletion app/Actions/Database/StartDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;

class StartDatabase
{
use AsAction;

public string $jobQueue = 'high';

public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database)
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $database): string|Activity|null
{
$server = $database->destination->server;
if (! $server->isFunctional()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Database/StartDatabaseProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class StartDatabaseProxy

public string $jobQueue = 'high';

public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|ServiceDatabase $database)
public function handle(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|ServiceDatabase $database): void
{
$databaseType = $database->database_type;
$network = data_get($database, 'destination.network');
Expand Down
20 changes: 15 additions & 5 deletions app/Actions/Database/StartDragonfly.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\SslCertificate;
use App\Models\StandaloneDragonfly;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;
use Symfony\Component\Yaml\Yaml;

class StartDragonfly
Expand All @@ -20,7 +21,7 @@ class StartDragonfly

private ?SslCertificate $ssl_certificate = null;

public function handle(StandaloneDragonfly $database)
public function handle(StandaloneDragonfly $database): ?Activity
{
$this->database = $database;

Expand Down Expand Up @@ -65,7 +66,7 @@ public function handle(StandaloneDragonfly $database)
if (! $caCert) {
$this->dispatch('error', 'No CA certificate found for this database. Please generate a CA certificate for this server in the server/advanced page.');

return;
return null;
}

$this->ssl_certificate = $this->database->sslCertificates()->first();
Expand Down Expand Up @@ -217,7 +218,10 @@ private function buildStartCommand(): string
return $command;
}

private function generate_local_persistent_volumes()
/**
* @return array<int, string>
*/
private function generate_local_persistent_volumes(): array
{
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -232,7 +236,10 @@ private function generate_local_persistent_volumes()
return $local_persistent_volumes;
}

private function generate_local_persistent_volumes_only_volume_names()
/**
* @return array<string, array<string, bool|string>>
*/
private function generate_local_persistent_volumes_only_volume_names(): array
{
$local_persistent_volumes_names = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -249,7 +256,10 @@ private function generate_local_persistent_volumes_only_volume_names()
return $local_persistent_volumes_names;
}

private function generate_environment_variables()
/**
* @return array<int, string>
*/
private function generate_environment_variables(): array
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
Expand Down
22 changes: 16 additions & 6 deletions app/Actions/Database/StartKeydb.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\StandaloneKeydb;
use Illuminate\Support\Facades\Storage;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;
use Symfony\Component\Yaml\Yaml;

class StartKeydb
Expand All @@ -21,7 +22,7 @@ class StartKeydb

private ?SslCertificate $ssl_certificate = null;

public function handle(StandaloneKeydb $database)
public function handle(StandaloneKeydb $database): ?Activity
{
$this->database = $database;

Expand Down Expand Up @@ -66,7 +67,7 @@ public function handle(StandaloneKeydb $database)
if (! $caCert) {
$this->dispatch('error', 'No CA certificate found for this database. Please generate a CA certificate for this server in the server/advanced page.');

return;
return null;
}

$this->ssl_certificate = $this->database->sslCertificates()->first();
Expand Down Expand Up @@ -216,7 +217,10 @@ public function handle(StandaloneKeydb $database)
return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
}

private function generate_local_persistent_volumes()
/**
* @return array<int, string>
*/
private function generate_local_persistent_volumes(): array
{
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -231,7 +235,10 @@ private function generate_local_persistent_volumes()
return $local_persistent_volumes;
}

private function generate_local_persistent_volumes_only_volume_names()
/**
* @return array<string, array<string, bool|string>>
*/
private function generate_local_persistent_volumes_only_volume_names(): array
{
$local_persistent_volumes_names = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -248,7 +255,10 @@ private function generate_local_persistent_volumes_only_volume_names()
return $local_persistent_volumes_names;
}

private function generate_environment_variables()
/**
* @return array<int, string>
*/
private function generate_environment_variables(): array
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
Expand All @@ -264,7 +274,7 @@ private function generate_environment_variables()
return $environment_variables->all();
}

private function add_custom_keydb()
private function add_custom_keydb(): void
{
if (is_null($this->database->keydb_conf) || empty($this->database->keydb_conf)) {
return;
Expand Down
22 changes: 16 additions & 6 deletions app/Actions/Database/StartMariadb.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\SslCertificate;
use App\Models\StandaloneMariadb;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\Activitylog\Contracts\Activity;
use Symfony\Component\Yaml\Yaml;

class StartMariadb
Expand All @@ -20,7 +21,7 @@ class StartMariadb

private ?SslCertificate $ssl_certificate = null;

public function handle(StandaloneMariadb $database)
public function handle(StandaloneMariadb $database): ?Activity
{
$this->database = $database;

Expand Down Expand Up @@ -67,7 +68,7 @@ public function handle(StandaloneMariadb $database)
if (! $caCert) {
$this->dispatch('error', 'No CA certificate found for this database. Please generate a CA certificate for this server in the server/advanced page.');

return;
return null;
}

$this->ssl_certificate = $this->database->sslCertificates()->first();
Expand Down Expand Up @@ -220,7 +221,10 @@ public function handle(StandaloneMariadb $database)
return remote_process($this->commands, $database->destination->server, callEventOnFinish: 'DatabaseStatusChanged');
}

private function generate_local_persistent_volumes()
/**
* @return array<int, string>
*/
private function generate_local_persistent_volumes(): array
{
$local_persistent_volumes = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -235,7 +239,10 @@ private function generate_local_persistent_volumes()
return $local_persistent_volumes;
}

private function generate_local_persistent_volumes_only_volume_names()
/**
* @return array<string, array<string, bool|string>>
*/
private function generate_local_persistent_volumes_only_volume_names(): array
{
$local_persistent_volumes_names = [];
foreach ($this->database->persistentStorages as $persistentStorage) {
Expand All @@ -252,7 +259,10 @@ private function generate_local_persistent_volumes_only_volume_names()
return $local_persistent_volumes_names;
}

private function generate_environment_variables()
/**
* @return array<int, string>
*/
private function generate_environment_variables(): array
{
$environment_variables = collect();
foreach ($this->database->runtime_environment_variables as $env) {
Expand All @@ -279,7 +289,7 @@ private function generate_environment_variables()
return $environment_variables->all();
}

private function add_custom_mysql()
private function add_custom_mysql(): void
{
if (is_null($this->database->mariadb_conf) || empty($this->database->mariadb_conf)) {
return;
Expand Down
Loading