diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..54fed1a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,95 @@ +name: Code Quality + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + env: + HUSKY: 0 + BROADCAST_DRIVER: log + CACHE_DRIVER: redis + QUEUE_CONNECTION: redis + SESSION_DRIVER: redis + DB_CONNECTION: pgsql + DB_HOST: localhost + DB_PASSWORD: postgres + DB_USERNAME: postgres + DB_DATABASE: postgres + + # Docs: https://docs.github.com/en/actions/using-containerized-services + services: + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432/tcp + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3 + + redis: + image: redis + ports: + - 6379/tcp + options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: pdo pdo_pgsql pgsql bcmath + coverage: xdebug + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + # Use composer.json for key, if composer.lock is not committed. + # key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install Node dependencies + run: npm i --frozen-lockfile + + - name: Build JS + run: npm run build + + - name: Prepare the application + run: | + php -r "file_exists('.env') || copy('.env.example', '.env');" + php artisan key:generate + + - name: Clear Config + run: php artisan config:clear + + - name: Run Migration + run: php artisan migrate -v + env: + DB_PORT: ${{ job.services.postgres.ports[5432] }} + REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + + - name: Test with pest + run: php artisan test --coverage-text + env: + DB_PORT: ${{ job.services.postgres.ports[5432] }} + REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + + - name: Pint! + run: vendor/bin/pint --test diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..c27d889 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +lint-staged diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..750dfaf --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18.x \ No newline at end of file diff --git a/api-nodes/Http/Controllers/EventController.php b/api-nodes/Http/Controllers/EventController.php index 40f52ef..1cfebe2 100644 --- a/api-nodes/Http/Controllers/EventController.php +++ b/api-nodes/Http/Controllers/EventController.php @@ -4,10 +4,7 @@ use ApiNodes\Models\AgentStartedEventData; use App\Models\Node; -use App\Models\NodeData; -use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; -use Illuminate\Support\Facades\Log; class EventController { @@ -29,8 +26,8 @@ public function started(Node $node, AgentStartedEventData $data) return [ 'settings' => [ - 'poll_interval' => 5 - ] + 'poll_interval' => 5, + ], ]; } -} \ No newline at end of file +} diff --git a/api-nodes/Http/Controllers/NextTaskController.php b/api-nodes/Http/Controllers/NextTaskController.php index 0f49a31..0e631a2 100644 --- a/api-nodes/Http/Controllers/NextTaskController.php +++ b/api-nodes/Http/Controllers/NextTaskController.php @@ -3,7 +3,6 @@ namespace ApiNodes\Http\Controllers; use App\Models\Node; -use App\Models\NodeTasks\TaskStatus; use App\Models\NodeTaskGroup; use Illuminate\Database\Eloquent\Builder; use Illuminate\Http\Response; @@ -14,7 +13,7 @@ public function __invoke(Node $node) { if ($node->swarm_id === null) { return new Response([ - 'message' => 'No task found.' + 'message' => 'No task found.', ], 204); } @@ -29,12 +28,12 @@ public function __invoke(Node $node) return $task->only([ 'id', 'type', - 'payload' + 'payload', ]); } return new Response([ - 'message' => 'No task found.' + 'message' => 'No task found.', ], 204); } @@ -42,7 +41,7 @@ protected function getNextTaskFromGroup(Node $node, NodeTaskGroup $taskGroup) { if ($taskGroup->tasks()->running()->first()) { return new Response([ - 'error_message' => 'Another task should be already running.' + 'error_message' => 'Another task should be already running.', ], 409); } @@ -63,7 +62,7 @@ protected function pickNextTask(Node $node) return $query->where('node_id', $node->id)->orWhere('node_id', null); })->pending()->first(); - if (!$taskGroup) { + if (! $taskGroup) { return null; } @@ -73,4 +72,4 @@ protected function pickNextTask(Node $node) return $task; } -} \ No newline at end of file +} diff --git a/api-nodes/Http/Controllers/TaskController.php b/api-nodes/Http/Controllers/TaskController.php index 9b2de6c..1c9feea 100644 --- a/api-nodes/Http/Controllers/TaskController.php +++ b/api-nodes/Http/Controllers/TaskController.php @@ -44,4 +44,4 @@ public function fail(NodeTask $task, Request $request) return new Response('', 204); } -} \ No newline at end of file +} diff --git a/api-nodes/Http/Middleware/AgentTokenAuth.php b/api-nodes/Http/Middleware/AgentTokenAuth.php index fdd0031..e7d26bf 100644 --- a/api-nodes/Http/Middleware/AgentTokenAuth.php +++ b/api-nodes/Http/Middleware/AgentTokenAuth.php @@ -3,7 +3,6 @@ namespace ApiNodes\Http\Middleware; use App\Models\Node; -use App\Models\NodeTasks; use App\Models\Scopes\TeamScope; use App\Models\Team; use Closure; @@ -23,13 +22,13 @@ public function handle(Request $request, Closure $next): Response { $token = $request->header(self::AUTH_HEADER); - if (!$token) { + if (! $token) { if ($request->bearerToken()) { return $next($request); } return response()->json([ - 'message' => 'Unauthorized' + 'message' => 'Unauthorized', ], 403); } @@ -39,8 +38,8 @@ public function handle(Request $request, Closure $next): Response $node->save(); - app()->singleton(Node::class, fn() => $node); - app()->singleton(Team::class, fn() => $node->team); + app()->singleton(Node::class, fn () => $node); + app()->singleton(Team::class, fn () => $node->team); return $next($request); } diff --git a/api-nodes/Models/AgentStartedEventData.php b/api-nodes/Models/AgentStartedEventData.php index 15c890a..8a2565d 100644 --- a/api-nodes/Models/AgentStartedEventData.php +++ b/api-nodes/Models/AgentStartedEventData.php @@ -11,8 +11,5 @@ class AgentStartedEventData extends Data public function __construct( public NodeData $node, public ?SwarmData $swarm, - ) - { - - } + ) {} } diff --git a/api-nodes/Models/AgentStartedEventData/SwarmData.php b/api-nodes/Models/AgentStartedEventData/SwarmData.php index 1f61578..22851ec 100644 --- a/api-nodes/Models/AgentStartedEventData/SwarmData.php +++ b/api-nodes/Models/AgentStartedEventData/SwarmData.php @@ -14,8 +14,5 @@ public function __construct( #[DataCollectionOf(ManagerNode::class)] /* @var ManagerNode[] */ public array $managerNodes, - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Actions/Jetstream/AddTeamMember.php b/app/Actions/Jetstream/AddTeamMember.php index cf3ae4b..43f92a0 100644 --- a/app/Actions/Jetstream/AddTeamMember.php +++ b/app/Actions/Jetstream/AddTeamMember.php @@ -18,7 +18,7 @@ class AddTeamMember implements AddsTeamMembers /** * Add a new team member to the given team. */ - public function add(User $user, Team $team, string $email, string $role = null): void + public function add(User $user, Team $team, string $email, ?string $role = null): void { Gate::forUser($user)->authorize('addTeamMember', $team); diff --git a/app/Actions/Jetstream/DeleteUser.php b/app/Actions/Jetstream/DeleteUser.php index 4b051af..807bf01 100644 --- a/app/Actions/Jetstream/DeleteUser.php +++ b/app/Actions/Jetstream/DeleteUser.php @@ -13,9 +13,7 @@ class DeleteUser implements DeletesUsers /** * Create a new action instance. */ - public function __construct(protected DeletesTeams $deletesTeams) - { - } + public function __construct(protected DeletesTeams $deletesTeams) {} /** * Delete the given user. diff --git a/app/Actions/Jetstream/InviteTeamMember.php b/app/Actions/Jetstream/InviteTeamMember.php index 641360f..08385ac 100644 --- a/app/Actions/Jetstream/InviteTeamMember.php +++ b/app/Actions/Jetstream/InviteTeamMember.php @@ -21,7 +21,7 @@ class InviteTeamMember implements InvitesTeamMembers /** * Invite a new team member to the given team. */ - public function invite(User $user, Team $team, string $email, string $role = null): void + public function invite(User $user, Team $team, string $email, ?string $role = null): void { Gate::forUser($user)->authorize('addTeamMember', $team); diff --git a/app/Api/Controllers/Controller.php b/app/Api/Controllers/Controller.php index d59bb6e..be84300 100644 --- a/app/Api/Controllers/Controller.php +++ b/app/Api/Controllers/Controller.php @@ -2,7 +2,4 @@ namespace App\Api\Controllers; -class Controller -{ - -} \ No newline at end of file +class Controller {} diff --git a/app/Api/Controllers/ServiceController.php b/app/Api/Controllers/ServiceController.php index f5c7a90..d8dc323 100644 --- a/app/Api/Controllers/ServiceController.php +++ b/app/Api/Controllers/ServiceController.php @@ -2,7 +2,6 @@ namespace App\Api\Controllers; -use App\Models\DeploymentData; use App\Models\Service; use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; @@ -21,4 +20,4 @@ public function deploy(Service $service, Request $request): array 'deployment_id' => $deployment->id, ]; } -} \ No newline at end of file +} diff --git a/app/Console/Commands/DispatchProcessBackupTask.php b/app/Console/Commands/DispatchProcessBackupTask.php index 81f21dd..5b84eee 100644 --- a/app/Console/Commands/DispatchProcessBackupTask.php +++ b/app/Console/Commands/DispatchProcessBackupTask.php @@ -67,7 +67,7 @@ protected function dispatchBackupTask(): void ]); $date = now()->format('Y-m-d_His'); - $backupFileName = dockerize_name("svc-{$service->id}-{$process->name}_backup-{$backupCmd->name}-{$date}") . '.tar.gz'; + $backupFileName = dockerize_name("svc-{$service->id}-{$process->name}_backup-{$backupCmd->name}-{$date}").'.tar.gz'; $archivePath = "{$process->backupVolume->path}/$backupFileName"; $backupCommand = "mkdir -p /tmp/{$backupCmd->id} && cd /tmp/{$backupCmd->id} && {$backupCmd->command} && tar czfv $archivePath -C /tmp/{$backupCmd->id} . && rm -rf /tmp/{$backupCmd->id}"; @@ -89,8 +89,8 @@ protected function dispatchBackupTask(): void 'AttachStdout' => true, 'AttachStderr' => true, 'Cmd' => ['sh', '-c', $backupCommand], - ] - ] + ], + ], ], [ 'type' => NodeTaskType::UploadS3File, @@ -105,9 +105,9 @@ protected function dispatchBackupTask(): void 'Target' => $process->backupVolume->path, ], 'SrcFilePath' => $archivePath, - 'DestFilePath' => $s3Storage->pathPrefix . '/' . $backupFileName, + 'DestFilePath' => $s3Storage->pathPrefix.'/'.$backupFileName, ], - ] + ], ]); } } diff --git a/app/Console/Commands/DispatchVolumeBackupTask.php b/app/Console/Commands/DispatchVolumeBackupTask.php index cc8ee7d..53545d8 100644 --- a/app/Console/Commands/DispatchVolumeBackupTask.php +++ b/app/Console/Commands/DispatchVolumeBackupTask.php @@ -67,7 +67,7 @@ protected function dispatchBackupTask(): void ]); $date = now()->format('Y-m-d_His'); - $backupFileName = dockerize_name("svc-{$service->id}-{$process->name}-vol-{$volume->name}-{$date}") . '.tar.gz'; + $backupFileName = dockerize_name("svc-{$service->id}-{$process->name}-vol-{$volume->name}-{$date}").'.tar.gz'; $archivePath = "{$process->backupVolume->path}/$backupFileName"; $backupCommand = "tar czfv $archivePath -C {$volume->path} ."; @@ -90,8 +90,8 @@ protected function dispatchBackupTask(): void 'AttachStdout' => true, 'AttachStderr' => true, 'Cmd' => ['sh', '-c', $backupCommand], - ] - ] + ], + ], ], [ 'type' => NodeTaskType::UploadS3File, @@ -106,9 +106,9 @@ protected function dispatchBackupTask(): void 'Target' => $process->backupVolume->path, ], 'SrcFilePath' => $archivePath, - 'DestFilePath' => $s3Storage->pathPrefix . '/' . $backupFileName, + 'DestFilePath' => $s3Storage->pathPrefix.'/'.$backupFileName, ], - ] + ], ]); } } diff --git a/app/Console/Commands/MakeNodeTask.php b/app/Console/Commands/MakeNodeTask.php index e0d9979..86a5dc4 100644 --- a/app/Console/Commands/MakeNodeTask.php +++ b/app/Console/Commands/MakeNodeTask.php @@ -17,6 +17,7 @@ class MakeNodeTask extends Command /** * The console command description. *34 + * * @var string */ protected $description = 'Create a new node task'; @@ -52,7 +53,7 @@ public function handle(): void foreach ($dirs as $dir) { $path = app_path($dir); - $this->info('Creating directory ' . $dir); + $this->info('Creating directory '.$dir); mkdir($path); } @@ -60,7 +61,7 @@ public function handle(): void foreach ($taskDataFiles as $abstractPath => $template) { $path = app_path($abstractPath); - $this->info('Writing ' . $abstractPath); + $this->info('Writing '.$abstractPath); file_put_contents($path, $template); } @@ -70,7 +71,7 @@ public function handle(): void protected function readStub($type, $taskName): string { - $template = file_get_contents(__DIR__ . "/stubs/MakeNodeTask/$type.stub"); + $template = file_get_contents(__DIR__."/stubs/MakeNodeTask/$type.stub"); return str_replace('$taskName', $taskName, $template); } diff --git a/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthCompleted.php b/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthCompleted.php index 1d29131..e448e54 100644 --- a/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthCompleted.php +++ b/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CheckRegistryAuthCompleted extends BaseTaskEvent -{ -} +class CheckRegistryAuthCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthFailed.php b/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthFailed.php index 7b2ae39..64916b7 100644 --- a/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthFailed.php +++ b/app/Events/NodeTasks/CheckRegistryAuth/CheckRegistryAuthFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CheckRegistryAuthFailed extends BaseTaskEvent -{ -} +class CheckRegistryAuthFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageCompleted.php b/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageCompleted.php index 418edfd..5132444 100644 --- a/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageCompleted.php +++ b/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CheckS3StorageCompleted extends BaseTaskEvent -{ -} +class CheckS3StorageCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageFailed.php b/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageFailed.php index e216928..f90238e 100644 --- a/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageFailed.php +++ b/app/Events/NodeTasks/CheckS3Storage/CheckS3StorageFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CheckS3StorageFailed extends BaseTaskEvent -{ -} +class CheckS3StorageFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeCompleted.php b/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeCompleted.php index ba12733..2e4ee61 100644 --- a/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeCompleted.php +++ b/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ConfirmAgentUpgradeCompleted extends BaseTaskEvent -{ -} +class ConfirmAgentUpgradeCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeFailed.php b/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeFailed.php index 74ec57c..4f89df5 100644 --- a/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeFailed.php +++ b/app/Events/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ConfirmAgentUpgradeFailed extends BaseTaskEvent -{ -} +class ConfirmAgentUpgradeFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateConfig/CreateConfigCompleted.php b/app/Events/NodeTasks/CreateConfig/CreateConfigCompleted.php index 3a55fe1..64af841 100644 --- a/app/Events/NodeTasks/CreateConfig/CreateConfigCompleted.php +++ b/app/Events/NodeTasks/CreateConfig/CreateConfigCompleted.php @@ -4,7 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateConfigCompleted extends BaseTaskEvent -{ - -} \ No newline at end of file +class CreateConfigCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateConfig/CreateConfigFailed.php b/app/Events/NodeTasks/CreateConfig/CreateConfigFailed.php index d1ef732..0c83331 100644 --- a/app/Events/NodeTasks/CreateConfig/CreateConfigFailed.php +++ b/app/Events/NodeTasks/CreateConfig/CreateConfigFailed.php @@ -4,7 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateConfigFailed extends BaseTaskEvent -{ - -} \ No newline at end of file +class CreateConfigFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateNetwork/CreateNetworkCompleted.php b/app/Events/NodeTasks/CreateNetwork/CreateNetworkCompleted.php index 790201a..d69e0b7 100644 --- a/app/Events/NodeTasks/CreateNetwork/CreateNetworkCompleted.php +++ b/app/Events/NodeTasks/CreateNetwork/CreateNetworkCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateNetworkCompleted extends BaseTaskEvent -{ -} +class CreateNetworkCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateNetwork/CreateNetworkFailed.php b/app/Events/NodeTasks/CreateNetwork/CreateNetworkFailed.php index 54240a4..464351d 100644 --- a/app/Events/NodeTasks/CreateNetwork/CreateNetworkFailed.php +++ b/app/Events/NodeTasks/CreateNetwork/CreateNetworkFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateNetworkFailed extends BaseTaskEvent -{ -} +class CreateNetworkFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthCompleted.php b/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthCompleted.php index 5c4e996..093cd10 100644 --- a/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthCompleted.php +++ b/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateRegistryAuthCompleted extends BaseTaskEvent -{ -} +class CreateRegistryAuthCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthFailed.php b/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthFailed.php index c61e45a..69db50b 100644 --- a/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthFailed.php +++ b/app/Events/NodeTasks/CreateRegistryAuth/CreateRegistryAuthFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateRegistryAuthFailed extends BaseTaskEvent -{ -} +class CreateRegistryAuthFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageCompleted.php b/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageCompleted.php index 14abe61..e3c8ac5 100644 --- a/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageCompleted.php +++ b/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateS3StorageCompleted extends BaseTaskEvent -{ -} +class CreateS3StorageCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageFailed.php b/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageFailed.php index f3e2f0c..77ff728 100644 --- a/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageFailed.php +++ b/app/Events/NodeTasks/CreateS3Storage/CreateS3StorageFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateS3StorageFailed extends BaseTaskEvent -{ -} +class CreateS3StorageFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateSecret/CreateSecretCompleted.php b/app/Events/NodeTasks/CreateSecret/CreateSecretCompleted.php index 77434bf..37c71ea 100644 --- a/app/Events/NodeTasks/CreateSecret/CreateSecretCompleted.php +++ b/app/Events/NodeTasks/CreateSecret/CreateSecretCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateSecretCompleted extends BaseTaskEvent -{ -} +class CreateSecretCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateSecret/CreateSecretFailed.php b/app/Events/NodeTasks/CreateSecret/CreateSecretFailed.php index 76bbe5f..92b3339 100644 --- a/app/Events/NodeTasks/CreateSecret/CreateSecretFailed.php +++ b/app/Events/NodeTasks/CreateSecret/CreateSecretFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateSecretFailed extends BaseTaskEvent -{ -} +class CreateSecretFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateService/CreateServiceCompleted.php b/app/Events/NodeTasks/CreateService/CreateServiceCompleted.php index 8a37b4a..68e6a51 100644 --- a/app/Events/NodeTasks/CreateService/CreateServiceCompleted.php +++ b/app/Events/NodeTasks/CreateService/CreateServiceCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateServiceCompleted extends BaseTaskEvent -{ -} +class CreateServiceCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/CreateService/CreateServiceFailed.php b/app/Events/NodeTasks/CreateService/CreateServiceFailed.php index bb44ee5..e437d57 100644 --- a/app/Events/NodeTasks/CreateService/CreateServiceFailed.php +++ b/app/Events/NodeTasks/CreateService/CreateServiceFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class CreateServiceFailed extends BaseTaskEvent -{ -} +class CreateServiceFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/DeleteService/DeleteServiceCompleted.php b/app/Events/NodeTasks/DeleteService/DeleteServiceCompleted.php index 6d7e23f..b077344 100644 --- a/app/Events/NodeTasks/DeleteService/DeleteServiceCompleted.php +++ b/app/Events/NodeTasks/DeleteService/DeleteServiceCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class DeleteServiceCompleted extends BaseTaskEvent -{ -} +class DeleteServiceCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/DeleteService/DeleteServiceFailed.php b/app/Events/NodeTasks/DeleteService/DeleteServiceFailed.php index 3f97c2e..df064b0 100644 --- a/app/Events/NodeTasks/DeleteService/DeleteServiceFailed.php +++ b/app/Events/NodeTasks/DeleteService/DeleteServiceFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class DeleteServiceFailed extends BaseTaskEvent -{ -} +class DeleteServiceFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeCompleted.php b/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeCompleted.php index e213e93..5117f92 100644 --- a/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeCompleted.php +++ b/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class DownloadAgentUpgradeCompleted extends BaseTaskEvent -{ -} +class DownloadAgentUpgradeCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeFailed.php b/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeFailed.php index fe3d7b5..8f5005c 100644 --- a/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeFailed.php +++ b/app/Events/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class DownloadAgentUpgradeFailed extends BaseTaskEvent -{ -} +class DownloadAgentUpgradeFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/InitSwarm/InitSwarmCompleted.php b/app/Events/NodeTasks/InitSwarm/InitSwarmCompleted.php index 6b67267..dd7f159 100644 --- a/app/Events/NodeTasks/InitSwarm/InitSwarmCompleted.php +++ b/app/Events/NodeTasks/InitSwarm/InitSwarmCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class InitSwarmCompleted extends BaseTaskEvent -{ -} +class InitSwarmCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/InitSwarm/InitSwarmFailed.php b/app/Events/NodeTasks/InitSwarm/InitSwarmFailed.php index 663b0ea..c7eb81b 100644 --- a/app/Events/NodeTasks/InitSwarm/InitSwarmFailed.php +++ b/app/Events/NodeTasks/InitSwarm/InitSwarmFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class InitSwarmFailed extends BaseTaskEvent -{ -} +class InitSwarmFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/JoinSwarm/JoinSwarmCompleted.php b/app/Events/NodeTasks/JoinSwarm/JoinSwarmCompleted.php index 008c6ed..b2cd99d 100644 --- a/app/Events/NodeTasks/JoinSwarm/JoinSwarmCompleted.php +++ b/app/Events/NodeTasks/JoinSwarm/JoinSwarmCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class JoinSwarmCompleted extends BaseTaskEvent -{ -} +class JoinSwarmCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/JoinSwarm/JoinSwarmFailed.php b/app/Events/NodeTasks/JoinSwarm/JoinSwarmFailed.php index 492d450..2472769 100644 --- a/app/Events/NodeTasks/JoinSwarm/JoinSwarmFailed.php +++ b/app/Events/NodeTasks/JoinSwarm/JoinSwarmFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class JoinSwarmFailed extends BaseTaskEvent -{ -} +class JoinSwarmFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/PullDockerImage/PullDockerImageCompleted.php b/app/Events/NodeTasks/PullDockerImage/PullDockerImageCompleted.php index 6569471..d1e4131 100644 --- a/app/Events/NodeTasks/PullDockerImage/PullDockerImageCompleted.php +++ b/app/Events/NodeTasks/PullDockerImage/PullDockerImageCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class PullDockerImageCompleted extends BaseTaskEvent -{ -} +class PullDockerImageCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/PullDockerImage/PullDockerImageFailed.php b/app/Events/NodeTasks/PullDockerImage/PullDockerImageFailed.php index 5d27303..2dcfe0b 100644 --- a/app/Events/NodeTasks/PullDockerImage/PullDockerImageFailed.php +++ b/app/Events/NodeTasks/PullDockerImage/PullDockerImageFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class PullDockerImageFailed extends BaseTaskEvent -{ -} +class PullDockerImageFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigCompleted.php b/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigCompleted.php index d3815d5..468d1a3 100644 --- a/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigCompleted.php +++ b/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ApplyCaddyConfigCompleted extends BaseTaskEvent -{ -} +class ApplyCaddyConfigCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigFailed.php b/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigFailed.php index 5549477..924bef8 100644 --- a/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigFailed.php +++ b/app/Events/NodeTasks/RebuildCaddyConfig/ApplyCaddyConfigFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ApplyCaddyConfigFailed extends BaseTaskEvent -{ -} +class ApplyCaddyConfigFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/ServiceExec/ServiceExecCompleted.php b/app/Events/NodeTasks/ServiceExec/ServiceExecCompleted.php index ba385a4..0dcd5bf 100644 --- a/app/Events/NodeTasks/ServiceExec/ServiceExecCompleted.php +++ b/app/Events/NodeTasks/ServiceExec/ServiceExecCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ServiceExecCompleted extends BaseTaskEvent -{ -} +class ServiceExecCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/ServiceExec/ServiceExecFailed.php b/app/Events/NodeTasks/ServiceExec/ServiceExecFailed.php index 3137a1c..de61730 100644 --- a/app/Events/NodeTasks/ServiceExec/ServiceExecFailed.php +++ b/app/Events/NodeTasks/ServiceExec/ServiceExecFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class ServiceExecFailed extends BaseTaskEvent -{ -} +class ServiceExecFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkCompleted.php b/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkCompleted.php index feccb53..7cdace7 100644 --- a/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkCompleted.php +++ b/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateAgentSymlinkCompleted extends BaseTaskEvent -{ -} +class UpdateAgentSymlinkCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkFailed.php b/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkFailed.php index 5995b92..b6e2f11 100644 --- a/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkFailed.php +++ b/app/Events/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateAgentSymlinkFailed extends BaseTaskEvent -{ -} +class UpdateAgentSymlinkFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeCompleted.php b/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeCompleted.php index 96bdbc6..0670adc 100644 --- a/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeCompleted.php +++ b/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateCurrentNodeCompleted extends BaseTaskEvent -{ -} +class UpdateCurrentNodeCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeFailed.php b/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeFailed.php index b6546b2..3f16d8c 100644 --- a/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeFailed.php +++ b/app/Events/NodeTasks/UpdateNode/UpdateCurrentNodeFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateCurrentNodeFailed extends BaseTaskEvent -{ -} +class UpdateCurrentNodeFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateService/UpdateServiceCompleted.php b/app/Events/NodeTasks/UpdateService/UpdateServiceCompleted.php index 0118d39..ae98ead 100644 --- a/app/Events/NodeTasks/UpdateService/UpdateServiceCompleted.php +++ b/app/Events/NodeTasks/UpdateService/UpdateServiceCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateServiceCompleted extends BaseTaskEvent -{ -} +class UpdateServiceCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UpdateService/UpdateServiceFailed.php b/app/Events/NodeTasks/UpdateService/UpdateServiceFailed.php index d460b60..3fd16f9 100644 --- a/app/Events/NodeTasks/UpdateService/UpdateServiceFailed.php +++ b/app/Events/NodeTasks/UpdateService/UpdateServiceFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UpdateServiceFailed extends BaseTaskEvent -{ -} +class UpdateServiceFailed extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UploadS3File/UploadS3FileCompleted.php b/app/Events/NodeTasks/UploadS3File/UploadS3FileCompleted.php index b09c4f0..df51bd1 100644 --- a/app/Events/NodeTasks/UploadS3File/UploadS3FileCompleted.php +++ b/app/Events/NodeTasks/UploadS3File/UploadS3FileCompleted.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UploadS3FileCompleted extends BaseTaskEvent -{ -} +class UploadS3FileCompleted extends BaseTaskEvent {} diff --git a/app/Events/NodeTasks/UploadS3File/UploadS3FileFailed.php b/app/Events/NodeTasks/UploadS3File/UploadS3FileFailed.php index 3d5d5af..b79cd4f 100644 --- a/app/Events/NodeTasks/UploadS3File/UploadS3FileFailed.php +++ b/app/Events/NodeTasks/UploadS3File/UploadS3FileFailed.php @@ -4,6 +4,4 @@ use App\Events\NodeTasks\BaseTaskEvent; -class UploadS3FileFailed extends BaseTaskEvent -{ -} +class UploadS3FileFailed extends BaseTaskEvent {} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index ca49ee0..95a3b89 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,8 +2,6 @@ namespace App\Http\Controllers; -use App\Models\User; - abstract class Controller { // TODO: replace with Gate::authorize() diff --git a/app/Http/Controllers/NodeController.php b/app/Http/Controllers/NodeController.php index 8c6f98d..48f3ea7 100644 --- a/app/Http/Controllers/NodeController.php +++ b/app/Http/Controllers/NodeController.php @@ -78,7 +78,7 @@ public function show(Node $node) 'initTaskGroup' => $initTaskGroup ?: $joinTaskGroup, 'lastAgentVersion' => $lastAgentVersion, 'agentUpgradeTaskGroup' => $taskGroup?->is_completed ? null : $taskGroup, - 'registryUpdateTaskGroup' => $registryTaskGroup?->is_completed ? null : $registryTaskGroup + 'registryUpdateTaskGroup' => $registryTaskGroup?->is_completed ? null : $registryTaskGroup, ]); } diff --git a/app/Http/Controllers/NodeTaskGroupController.php b/app/Http/Controllers/NodeTaskGroupController.php index a3e93d5..036a258 100644 --- a/app/Http/Controllers/NodeTaskGroupController.php +++ b/app/Http/Controllers/NodeTaskGroupController.php @@ -4,8 +4,6 @@ use App\Models\Node; use App\Models\NodeTaskGroup; -use App\Models\User; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Http\Request; class NodeTaskGroupController extends Controller @@ -24,4 +22,4 @@ public function retry(Request $request, NodeTaskGroup $taskGroup) $taskGroup->retry($node); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/ServiceController.php b/app/Http/Controllers/ServiceController.php index 5b4c748..b88ebb6 100644 --- a/app/Http/Controllers/ServiceController.php +++ b/app/Http/Controllers/ServiceController.php @@ -5,8 +5,6 @@ use App\Http\Requests\StoreServiceRequest; use App\Http\Requests\UpdateServiceRequest; use App\Models\DeploymentData; -use App\Models\NodeTaskGroup; -use App\Models\NodeTaskGroupType; use App\Models\Service; use App\Models\Swarm; use Illuminate\Support\Facades\DB; @@ -71,7 +69,6 @@ public function store(StoreServiceRequest $request) $service->deploy($deploymentData); }); - return to_route('services.deployments', ['service' => $service->id]); } @@ -102,8 +99,7 @@ public function deployments(Service $service) $deployments->with(['latestTaskGroup' => function ($taskGroups) { $taskGroups->with([ 'invoker', - 'tasks' => function ($tasks) { - }]); + 'tasks' => function ($tasks) {}]); }]); }]); @@ -112,7 +108,7 @@ public function deployments(Service $service) public function deploy(Service $service, DeploymentData $deploymentData) { - DB::transaction(function() use ($service, $deploymentData) { + DB::transaction(function () use ($service, $deploymentData) { $service->deploy($deploymentData); }); diff --git a/app/Http/Controllers/SwarmController.php b/app/Http/Controllers/SwarmController.php index 33d70ed..e65885a 100644 --- a/app/Http/Controllers/SwarmController.php +++ b/app/Http/Controllers/SwarmController.php @@ -9,7 +9,6 @@ use App\Models\NodeTaskGroupType; use App\Models\NodeTasks\CheckRegistryAuth\CheckRegistryAuthMeta; use App\Models\NodeTasks\CheckS3Storage\CheckS3StorageMeta; -use App\Models\NodeTasks\CreateConfig\CreateConfigMeta; use App\Models\NodeTasks\CreateRegistryAuth\CreateRegistryAuthMeta; use App\Models\NodeTasks\CreateS3Storage\CreateS3StorageMeta; use App\Models\NodeTaskType; @@ -99,7 +98,7 @@ public function updateDockerRegistries(Swarm $swarm, Request $request) } } - $registry->dockerName = dockerize_name('registry_r' . $swarmData->registriesRev . '_' . $registry->name); + $registry->dockerName = dockerize_name('registry_r'.$swarmData->registriesRev.'_'.$registry->name); $taskMeta = [ 'registryName' => $registry->name, @@ -122,7 +121,7 @@ public function updateDockerRegistries(Swarm $swarm, Request $request) 'revision' => $swarmData->registriesRev, ]), ], - ] + ], ]; $tasks[] = [ @@ -130,14 +129,14 @@ public function updateDockerRegistries(Swarm $swarm, Request $request) 'meta' => CheckRegistryAuthMeta::validateAndCreate($taskMeta), 'payload' => [ 'RegistryConfigName' => $registry->dockerName, - ] + ], ]; } $swarm->data = $swarmData; $swarm->save(); - if (!empty($tasks)) { + if (! empty($tasks)) { $taskGroup = NodeTaskGroup::create([ 'type' => NodeTaskGroupType::UpdateDockerRegistries, 'swarm_id' => $swarm->id, @@ -170,7 +169,7 @@ public function updateS3Storages(Swarm $swarm, Request $request) } } - $s3Storage->dockerName = dockerize_name('s3_r' . $swarmData->s3StoragesRev . '_' . $s3Storage->name); + $s3Storage->dockerName = dockerize_name('s3_r'.$swarmData->s3StoragesRev.'_'.$s3Storage->name); $taskMeta = [ 's3StorageId' => $s3Storage->id, @@ -198,7 +197,7 @@ public function updateS3Storages(Swarm $swarm, Request $request) 'revision' => $swarmData->s3StoragesRev, ]), ], - ] + ], ]; $tasks[] = [ @@ -206,14 +205,14 @@ public function updateS3Storages(Swarm $swarm, Request $request) 'meta' => CheckS3StorageMeta::validateAndCreate($taskMeta), 'payload' => [ 'S3StorageConfigName' => $s3Storage->dockerName, - ] + ], ]; } $swarm->data = $swarmData; $swarm->save(); - if (!empty($tasks)) { + if (! empty($tasks)) { $taskGroup = NodeTaskGroup::create([ 'type' => NodeTaskGroupType::UpdateS3Storages, 'swarm_id' => $swarm->id, diff --git a/app/Http/Controllers/SwarmTaskController.php b/app/Http/Controllers/SwarmTaskController.php index 8701cae..22b46e7 100644 --- a/app/Http/Controllers/SwarmTaskController.php +++ b/app/Http/Controllers/SwarmTaskController.php @@ -4,10 +4,8 @@ use App\Http\Requests\NodeTask\InitClusterFormRequest; use App\Http\Requests\NodeTask\JoinClusterFormRequest; -use App\Models\Deployment; use App\Models\DeploymentData; use App\Models\DeploymentData\LaunchMode; -use App\Models\DeploymentData\ReleaseCommand; use App\Models\Network; use App\Models\Node; use App\Models\NodeTaskGroup; @@ -17,7 +15,6 @@ use App\Models\NodeTasks\JoinSwarm\JoinSwarmMeta; use App\Models\NodeTasks\UpdateCurrentNode\UpdateCurrentNodeMeta; use App\Models\NodeTaskType; -use App\Models\Service; use App\Models\Swarm; use App\Models\SwarmData; use Illuminate\Support\Facades\DB; @@ -77,10 +74,10 @@ public function initCluster(InitClusterFormRequest $request) 'Labels' => dockerize_labels([ 'swarm.id' => $swarm->id, ]), - ] - ] - ] - ] + ], + ], + ], + ], ], [ 'type' => NodeTaskType::UpdateCurrentNode, @@ -96,8 +93,8 @@ public function initCluster(InitClusterFormRequest $request) 'node.id' => $node->id, 'node.name' => $node->name, ]), - ] - ] + ], + ], ], [ 'type' => NodeTaskType::CreateNetwork, @@ -107,10 +104,10 @@ public function initCluster(InitClusterFormRequest $request) 'NetworkCreateOptions' => [ 'Driver' => 'overlay', 'Labels' => dockerize_labels([ - 'network.id' => $network->id + 'network.id' => $network->id, ]), 'Scope' => 'swarm', - 'Attachable' => true + 'Attachable' => true, ], ], ], @@ -143,7 +140,7 @@ public function initCluster(InitClusterFormRequest $request) [ 'name' => 'CADDY_ADMIN', 'value' => '0.0.0.0:2019', - ] + ], ], 'secretVars' => [ 'vars' => [], @@ -156,20 +153,20 @@ public function initCluster(InitClusterFormRequest $request) [ 'path' => '/start.sh', 'content' => trim(file_get_contents(resource_path('support/caddy/start.sh'))), - ] + ], ], 'secretFiles' => [], 'volumes' => [ [ - 'id' => 'volume-' . Str::random(11), + 'id' => 'volume-'.Str::random(11), 'name' => 'data', 'path' => '/data', ], [ - 'id' => 'volume-' . Str::random(11), + 'id' => 'volume-'.Str::random(11), 'name' => 'config', 'path' => '/config', - ] + ], ], 'ports' => [ [ @@ -219,7 +216,7 @@ public function joinCluster(JoinClusterFormRequest $request) $node->swarm_id = $request->swarm_id; $node->save(); - $remoteAddrs = collect($taskGroup->swarm->data->managerNodes)->map(fn(SwarmData\ManagerNode $node) => $node->addr)->toArray(); + $remoteAddrs = collect($taskGroup->swarm->data->managerNodes)->map(fn (SwarmData\ManagerNode $node) => $node->addr)->toArray(); $joinToken = match ($request->role) { 'manager' => $taskGroup->swarm->data->joinTokens->manager, @@ -238,7 +235,7 @@ public function joinCluster(JoinClusterFormRequest $request) 'JoinToken' => $joinToken, 'Availability' => 'active', ], - ] + ], ]); }); } diff --git a/app/Http/Controllers/TeamBillingController.php b/app/Http/Controllers/TeamBillingController.php index 2882bbd..9182a72 100644 --- a/app/Http/Controllers/TeamBillingController.php +++ b/app/Http/Controllers/TeamBillingController.php @@ -18,9 +18,10 @@ public function show(Team $team) // dd($team->subscription()->nextPayment()); $checkout = $team->subscribe('pri_01j2ag2ts45hznad1t67bs4syd')->returnTo(route('teams.billing.show', $team)); -//$team->subscription()->anchorBillingCycleOn(Carbon::now()->addMonth()->startOfMonth()); + //$team->subscription()->anchorBillingCycleOn(Carbon::now()->addMonth()->startOfMonth()); $nextPayment = $team->subscription()?->nextPayment(); -//Cashier::api() + + //Cashier::api() return Inertia::render('Teams/Billing', [ 'team' => $team, 'customer' => $customer, @@ -49,7 +50,7 @@ public function updateCustomer(Team $team, Request $request) $customer = $team->createAsCustomer(); $customer->update($formData); - Cashier::api('PATCH', 'customers/' . $customer->paddle_id, $formData); + Cashier::api('PATCH', 'customers/'.$customer->paddle_id, $formData); }); return redirect()->route('teams.billing.show', $team); diff --git a/app/Http/Middleware/EnsureTeamSubscription.php b/app/Http/Middleware/EnsureTeamSubscription.php index be29172..7bc2bda 100644 --- a/app/Http/Middleware/EnsureTeamSubscription.php +++ b/app/Http/Middleware/EnsureTeamSubscription.php @@ -22,8 +22,8 @@ public function handle(Request $request, Closure $next): Response $team = auth()->user()->currentTeam; $subscription = $team->subscription(); - $doesntHaveSubscription = $subscription === null || !$subscription->onTrial() && !$subscription->active(); - if ($doesntHaveSubscription && !$request->routeIs('teams.billing.show')) { + $doesntHaveSubscription = $subscription === null || ! $subscription->onTrial() && ! $subscription->active(); + if ($doesntHaveSubscription && ! $request->routeIs('teams.billing.show')) { return redirect()->route('teams.billing.show', $team); } diff --git a/app/Http/Requests/NodeTask/InitClusterFormRequest.php b/app/Http/Requests/NodeTask/InitClusterFormRequest.php index 584a61c..6cfb88c 100644 --- a/app/Http/Requests/NodeTask/InitClusterFormRequest.php +++ b/app/Http/Requests/NodeTask/InitClusterFormRequest.php @@ -20,4 +20,4 @@ public function rules(): array 'force_new_cluster' => ['boolean'], ]; } -} \ No newline at end of file +} diff --git a/app/Http/Requests/NodeTask/JoinClusterFormRequest.php b/app/Http/Requests/NodeTask/JoinClusterFormRequest.php index 2168906..03ee3a9 100644 --- a/app/Http/Requests/NodeTask/JoinClusterFormRequest.php +++ b/app/Http/Requests/NodeTask/JoinClusterFormRequest.php @@ -20,4 +20,4 @@ public function rules(): array 'advertise_addr' => ['exclude_if:role,worker', 'required', 'ipv4'], ]; } -} \ No newline at end of file +} diff --git a/app/Http/Requests/StoreServiceRequest.php b/app/Http/Requests/StoreServiceRequest.php index 7c0aeb6..137ce2c 100644 --- a/app/Http/Requests/StoreServiceRequest.php +++ b/app/Http/Requests/StoreServiceRequest.php @@ -3,7 +3,6 @@ namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; -use Illuminate\Support\Facades\Validator; class StoreServiceRequest extends FormRequest { diff --git a/app/Jobs/CheckAgentUpdates.php b/app/Jobs/CheckAgentUpdates.php index 9753404..cd87560 100644 --- a/app/Jobs/CheckAgentUpdates.php +++ b/app/Jobs/CheckAgentUpdates.php @@ -17,16 +17,14 @@ class CheckAgentUpdates implements ShouldQueue /** * Create a new job instance. */ - public function __construct() - { - } + public function __construct() {} /** * Execute the job. */ public function handle(): void { - $json = Http::get("https://api.github.com/repos/ptah-sh/ptah-agent/releases/latest")->json(); + $json = Http::get('https://api.github.com/repos/ptah-sh/ptah-agent/releases/latest')->json(); foreach ($json['assets'] as $asset) { preg_match('/^ptah-agent-(?.+)-(?.+).bin$/', $asset['name'], $matches); diff --git a/app/Models/Deployment.php b/app/Models/Deployment.php index 655b9fc..dfbf903 100644 --- a/app/Models/Deployment.php +++ b/app/Models/Deployment.php @@ -15,7 +15,6 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough; use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Query\Builder as QueryBuilder; -use Illuminate\Support\Facades\Blade; use InvalidArgumentException; class Deployment extends Model @@ -41,12 +40,12 @@ public function service(): BelongsTo public function taskGroups(): HasManyThrough { - return $this->hasManyThrough(NodeTaskGroup::class, NodeTask::class, 'meta__deployment_id', 'id', 'id', 'task_group_id')->orderByDesc('id'); + return $this->hasManyThrough(NodeTaskGroup::class, NodeTask::class, 'meta__deployment_id', 'id', 'id', 'task_group_id')->orderByDesc('id'); } public function latestTaskGroup(): HasOneThrough { - return $this->hasOneThrough(NodeTaskGroup::class, NodeTask::class, 'meta__deployment_id', 'id', 'id', 'task_group_id')->latest(); + return $this->hasOneThrough(NodeTaskGroup::class, NodeTask::class, 'meta__deployment_id', 'id', 'id', 'task_group_id')->latest(); } public function previousDeployment(): ?Deployment @@ -56,7 +55,7 @@ public function previousDeployment(): ?Deployment public function makeResourceName($name): string { - return $this->service->makeResourceName("dpl_". $this->id . "_" . $name); + return $this->service->makeResourceName('dpl_'.$this->id.'_'.$name); } public function scopeLatestDeployments(EloquentBuilder $query): EloquentBuilder @@ -69,7 +68,8 @@ public function scopeLatestDeployments(EloquentBuilder $query): EloquentBuilder }); } - public function resourceLabels(): array { + public function resourceLabels(): array + { return dockerize_labels([ 'service.id' => $this->service_id, 'deployment.id' => $this->id, @@ -107,7 +107,7 @@ public function asNodeTasks(): array $this->latestDeployments()->each(function ($deployment) use (&$caddyHandlers) { foreach ($deployment->data->processes as $process) { - $caddyHandlers[] = collect($process->caddy)->map(function(Caddy $caddy) use ($deployment, $process) { + $caddyHandlers[] = collect($process->caddy)->map(function (Caddy $caddy) use ($deployment, $process) { $routes = []; $routes[] = [ @@ -135,10 +135,10 @@ public function asNodeTasks(): array 'upstreams' => [ [ 'dial' => "{$process->name}.{$deployment->data->internalDomain}:{$caddy->targetPort}", - ] - ] - ] - ] + ], + ], + ], + ], ]; foreach ($process->redirectRules as $redirectRule) { @@ -152,9 +152,9 @@ public function asNodeTasks(): array 'host' => [$redirectRule->domainFrom], 'path_regexp' => [ 'name' => $regexpName, - 'pattern' => $redirectRule->pathFrom + 'pattern' => $redirectRule->pathFrom, ], - ] + ], ], 'handle' => [ [ @@ -165,8 +165,8 @@ public function asNodeTasks(): array 'X-Ptah-Rule-Id' => [$redirectRule->id], 'Location' => ["{http.request.scheme}://{$redirectRule->domainTo}{$pathTo}"], ], - ] - ] + ], + ], ]; } @@ -179,10 +179,10 @@ public function asNodeTasks(): array "0.0.0.0:{$caddy->publishedPort}", ], 'routes' => $routes, - ] - ] - ] - ] + ], + ], + ], + ], ]; })->toArray(); } @@ -193,13 +193,13 @@ public function asNodeTasks(): array $caddyTask = []; - if (!empty($caddyHandlers)) { + if (! empty($caddyHandlers)) { $caddy = [ 'apps' => [ 'http' => [ 'servers' => (object) [], - ] - ] + ], + ], ]; foreach ($caddyHandlers as $handler) { @@ -215,7 +215,7 @@ public function asNodeTasks(): array [ 'host' => ['*'], 'path' => ['/*'], - ] + ], ], 'handle' => [ [ @@ -226,8 +226,8 @@ public function asNodeTasks(): array 'Content-Type' => ['text/html; charset=utf-8'], ], 'body' => file_get_contents(resource_path('support/caddy/404.html')), - ] - ] + ], + ], ]; } @@ -238,7 +238,7 @@ public function asNodeTasks(): array ]), 'payload' => [ 'caddy' => $caddy, - ] + ], ]; } diff --git a/app/Models/DeploymentData.php b/app/Models/DeploymentData.php index af16245..ab8b619 100644 --- a/app/Models/DeploymentData.php +++ b/app/Models/DeploymentData.php @@ -15,16 +15,14 @@ class DeploymentData extends Data { public function __construct( - public string $networkName, + public string $networkName, public string $internalDomain, #[Exists(Node::class, 'id')] - public ?int $placementNodeId, + public ?int $placementNodeId, #[DataCollectionOf(Process::class)] /* @var Process[] */ - public array $processes - ) - { - } + public array $processes + ) {} public static function make(array $attributes): static { @@ -62,7 +60,7 @@ public static function make(array $attributes): static return self::from([ ...$defaults, - ...$attributes + ...$attributes, ]); } @@ -73,8 +71,8 @@ public function copyWith(array $attributes): DeploymentData if (isset($attributes['processes'])) { foreach ($attributes['processes'] as $idx => $process) { - if (!isset($process['name'])) { - $errors["processes.{$idx}.name"] = "Process name is required"; + if (! isset($process['name'])) { + $errors["processes.{$idx}.name"] = 'Process name is required'; continue; } @@ -87,7 +85,7 @@ public function copyWith(array $attributes): DeploymentData $updatedVars = collect($process['envVars'])->pluck('name')->toArray(); $existingProcess['envVars'] = collect($result['processes'][$existingIdx]['envVars']) - ->reject(fn($var) => in_array($var['name'], $updatedVars)) + ->reject(fn ($var) => in_array($var['name'], $updatedVars)) ->values() ->toArray(); } @@ -98,13 +96,13 @@ public function copyWith(array $attributes): DeploymentData } } - if (!$processExists) { + if (! $processExists) { $errors["processes.{$idx}.name"] = "Process {$process['name']} does not exist"; } } } - if (!empty($errors)) { + if (! empty($errors)) { throw ValidationException::withMessages($errors); } @@ -113,6 +111,6 @@ public function copyWith(array $attributes): DeploymentData public function findProcess(string $dockerName): ?Process { - return collect($this->processes)->first(fn(Process $process) => $process->dockerName === $dockerName); + return collect($this->processes)->first(fn (Process $process) => $process->dockerName === $dockerName); } } diff --git a/app/Models/DeploymentData/BackupSchedule.php b/app/Models/DeploymentData/BackupSchedule.php index 0b4fece..0efec40 100644 --- a/app/Models/DeploymentData/BackupSchedule.php +++ b/app/Models/DeploymentData/BackupSchedule.php @@ -8,11 +8,8 @@ class BackupSchedule extends Data { public function __construct( public CronPreset $preset, - public string $s3StorageId, + public string $s3StorageId, // TODO: !!! validate CRON expr - public string $expr, - ) - { - - } + public string $expr, + ) {} } diff --git a/app/Models/DeploymentData/BackupVolume.php b/app/Models/DeploymentData/BackupVolume.php index 495e8e1..b26c70e 100644 --- a/app/Models/DeploymentData/BackupVolume.php +++ b/app/Models/DeploymentData/BackupVolume.php @@ -11,8 +11,5 @@ public function __construct( public string $name, public ?string $dockerName, public string $path, - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/Caddy.php b/app/Models/DeploymentData/Caddy.php index 3bb6043..b762477 100644 --- a/app/Models/DeploymentData/Caddy.php +++ b/app/Models/DeploymentData/Caddy.php @@ -2,10 +2,9 @@ namespace App\Models\DeploymentData; -use Spatie\LaravelData\Data; use Spatie\LaravelData\Attributes\Validation\Between; use Spatie\LaravelData\Attributes\Validation\In; - +use Spatie\LaravelData\Data; class Caddy extends Data { @@ -19,8 +18,5 @@ public function __construct( public int $publishedPort, public string $domain, public string $path, - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/ConfigFile.php b/app/Models/DeploymentData/ConfigFile.php index b10fd7a..804c20c 100644 --- a/app/Models/DeploymentData/ConfigFile.php +++ b/app/Models/DeploymentData/ConfigFile.php @@ -2,10 +2,6 @@ namespace App\Models\DeploymentData; -use App\Models\NodeTasks\DockerId; -use App\Models\Service; -use Illuminate\Support\Str; -use Spatie\LaravelData\Attributes\Computed; use Spatie\LaravelData\Data; class ConfigFile extends Data @@ -14,8 +10,7 @@ public function __construct( public string $path, public ?string $content, public ?string $dockerName, - ) - { + ) { $this->content = $content ?? ''; } diff --git a/app/Models/DeploymentData/EnvVar.php b/app/Models/DeploymentData/EnvVar.php index 0c4dcb9..55dbde5 100644 --- a/app/Models/DeploymentData/EnvVar.php +++ b/app/Models/DeploymentData/EnvVar.php @@ -9,8 +9,5 @@ class EnvVar extends Data public function __construct( public string $name, public ?string $value - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/FastCgi.php b/app/Models/DeploymentData/FastCgi.php index 5c02eea..5900bdc 100644 --- a/app/Models/DeploymentData/FastCgi.php +++ b/app/Models/DeploymentData/FastCgi.php @@ -12,8 +12,5 @@ public function __construct( #[DataCollectionOf(EnvVar::class)] /* @var EnvVar[] */ public array $env - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/NodePort.php b/app/Models/DeploymentData/NodePort.php index 033a923..4dff154 100644 --- a/app/Models/DeploymentData/NodePort.php +++ b/app/Models/DeploymentData/NodePort.php @@ -12,8 +12,5 @@ public function __construct( public int $targetPort, #[Between(1, 65535)] public int $publishedPort - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/Process.php b/app/Models/DeploymentData/Process.php index 46e90d3..35fdc5c 100644 --- a/app/Models/DeploymentData/Process.php +++ b/app/Models/DeploymentData/Process.php @@ -23,67 +23,64 @@ class Process extends Data public function __construct( public string $name, public ?string $dockerName, - public ?string $dockerRegistryId, + public ?string $dockerRegistryId, public string $dockerImage, public ReleaseCommand $releaseCommand, public ?string $command, #[DataCollectionOf(ProcessBackup::class)] - /* @var ProcessBackup[] */ + /* @var ProcessBackup[] */ public array $backups, #[DataCollectionOf(Worker::class)] - /* @var Worker[] */ + /* @var Worker[] */ public array $workers, #[Enum(LaunchMode::class)] public string $launchMode, #[DataCollectionOf(EnvVar::class)] - /* @var EnvVar[] */ - public array $envVars, - public SecretVars $secretVars, + /* @var EnvVar[] */ + public array $envVars, + public SecretVars $secretVars, #[DataCollectionOf(ConfigFile::class)] - /* @var ConfigFile[] */ - public array $configFiles, + /* @var ConfigFile[] */ + public array $configFiles, #[DataCollectionOf(ConfigFile::class)] - /* @var ConfigFile[] */ - public array $secretFiles, + /* @var ConfigFile[] */ + public array $secretFiles, #[DataCollectionOf(Volume::class)] - /* @var Volume[] */ - public array $volumes, + /* @var Volume[] */ + public array $volumes, public ?BackupVolume $backupVolume, - public int $replicas, + public int $replicas, #[DataCollectionOf(NodePort::class)] /* @var NodePort[] */ - public array $ports, + public array $ports, #[DataCollectionOf(Caddy::class)] - /* @var Caddy[] */ - public array $caddy, + /* @var Caddy[] */ + public array $caddy, #[Rule(new RequiredIfArrayHas('caddy.*.targetProtocol', 'fastcgi'))] public ?FastCgi $fastCgi, #[DataCollectionOf(RedirectRule::class)] - /* @var RedirectRule[] */ + /* @var RedirectRule[] */ public array $redirectRules - ) - { - - } + ) {} public function findVolume(string $id): ?Volume { - return collect($this->volumes)->first(fn(Volume $volume) => $volume->id === $id); + return collect($this->volumes)->first(fn (Volume $volume) => $volume->id === $id); } public function findProcessBackup(string $id): ?ProcessBackup { - return collect($this->backups)->first(fn(ProcessBackup $backup) => $backup->id === $id); + return collect($this->backups)->first(fn (ProcessBackup $backup) => $backup->id === $id); } public function findConfigFile(string $path): ?ConfigFile { - return collect($this->configFiles)->first(fn(ConfigFile $file) => $file->path === $path); + return collect($this->configFiles)->first(fn (ConfigFile $file) => $file->path === $path); } public function findSecretFile(string $path): ?ConfigFile { - return collect($this->secretFiles)->first(fn(ConfigFile $file) => $file->path === $path); + return collect($this->secretFiles)->first(fn (ConfigFile $file) => $file->path === $path); } /** @@ -92,7 +89,7 @@ public function findSecretFile(string $path): ?ConfigFile public function asNodeTasks(Deployment $deployment): array { if (empty($this->dockerName)) { - $this->dockerName = dockerize_name($deployment->service->docker_name . '_' . $this->name); + $this->dockerName = dockerize_name($deployment->service->docker_name.'_'.$this->name); } $labels = $deployment->resourceLabels(); @@ -114,9 +111,9 @@ public function asNodeTasks(Deployment $deployment): array } foreach ($this->workers as $worker) { - if (!$worker->dockerName) { + if (! $worker->dockerName) { // TODO: add validation - allow only unique worker commands - $worker->dockerName = $this->makeResourceName('wkr_' . $worker->name); + $worker->dockerName = $this->makeResourceName('wkr_'.$worker->name); } } @@ -128,7 +125,7 @@ public function asNodeTasks(Deployment $deployment): array continue; } - $configFile->dockerName = $this->makeResourceName('dpl_'.$deployment->id .'_cfg_' . $configFile->path); + $configFile->dockerName = $this->makeResourceName('dpl_'.$deployment->id.'_cfg_'.$configFile->path); $tasks[] = [ 'type' => NodeTaskType::CreateConfig, @@ -145,7 +142,7 @@ public function asNodeTasks(Deployment $deployment): array 'Labels' => dockerize_labels([ ...$labels, 'kind' => 'config', - "content.hash" => $configFile->hash(), + 'content.hash' => $configFile->hash(), ]), ], ], @@ -160,7 +157,7 @@ public function asNodeTasks(Deployment $deployment): array continue; } - $secretFile->dockerName = $this->makeResourceName('dpl_'.$deployment->id .'_cfg_' . $secretFile->path); + $secretFile->dockerName = $this->makeResourceName('dpl_'.$deployment->id.'_cfg_'.$secretFile->path); $tasks[] = [ 'type' => NodeTaskType::CreateSecret, @@ -176,15 +173,15 @@ public function asNodeTasks(Deployment $deployment): array 'Data' => $secretFile->base64(), 'Labels' => dockerize_labels([ ...$labels, - "content.hash" => $secretFile->hash(), + 'content.hash' => $secretFile->hash(), ]), - ] - ] + ], + ], ]; } foreach ($this->volumes as $volume) { - if (!$volume->dockerName) { + if (! $volume->dockerName) { $volume->dockerName = $this->makeResourceName($volume->name); } } @@ -212,7 +209,7 @@ public function asNodeTasks(Deployment $deployment): array $authConfigName = $dockerRegistry ? $dockerRegistry->dockerName - : ""; + : ''; $tasks[] = [ 'type' => NodeTaskType::PullDockerImage, @@ -240,7 +237,7 @@ public function asNodeTasks(Deployment $deployment): array $volumes = $this->volumes; $mounts = collect($volumes) - ->map(fn(Volume $volume) => [ + ->map(fn (Volume $volume) => [ 'Type' => 'volume', 'Source' => $volume->dockerName, 'Target' => $volume->path, @@ -249,7 +246,7 @@ public function asNodeTasks(Deployment $deployment): array 'id' => $volume->id, ...$labels, ]), - ] + ], ]) ->toArray(); @@ -257,7 +254,7 @@ public function asNodeTasks(Deployment $deployment): array if (count($this->volumes)) { if ($this->backupVolume == null) { $this->backupVolume = BackupVolume::validateAndCreate([ - 'id' => 'backups-' . Str::random(11), + 'id' => 'backups-'.Str::random(11), 'name' => 'backups', 'dockerName' => $this->makeResourceName('/ptah/backups'), 'path' => '/ptah/backups', @@ -273,13 +270,13 @@ public function asNodeTasks(Deployment $deployment): array 'id' => $this->backupVolume->id, ...$labels, ]), - ] + ], ]; } $envVars = $this->envVars; $envVars[] = EnvVar::validateAndCreate([ - 'name' => "PTAH_HOSTNAME", + 'name' => 'PTAH_HOSTNAME', 'value' => $internalDomain, ]); @@ -305,42 +302,42 @@ public function asNodeTasks(Deployment $deployment): array 'Command' => $command, 'Args' => $args, 'Hostname' => "dpl-{$deployment->id}.{$internalDomain}", - 'Env' => collect($envVars)->map(fn(EnvVar $var) => "{$var->name}={$var->value}")->toArray(), + 'Env' => collect($envVars)->map(fn (EnvVar $var) => "{$var->name}={$var->value}")->toArray(), 'Mounts' => $mounts, 'Hosts' => [ $internalDomain, ], - 'Secrets' => collect($this->secretFiles)->map(fn(ConfigFile $secretFile) => [ + 'Secrets' => collect($this->secretFiles)->map(fn (ConfigFile $secretFile) => [ 'File' => [ 'Name' => $secretFile->path, // TODO: figure out better permissions settings (if any) - 'UID' => "0", - "GID" => "0", - "Mode" => 0777 + 'UID' => '0', + 'GID' => '0', + 'Mode' => 0777, ], 'SecretName' => $secretFile->dockerName, ])->values()->toArray(), - 'Configs' => collect($this->configFiles)->map(fn(ConfigFile $configFile) => [ + 'Configs' => collect($this->configFiles)->map(fn (ConfigFile $configFile) => [ 'File' => [ 'Name' => $configFile->path, // TODO: figure out better permissions settings (if any) - 'UID' => "0", - "GID" => "0", - "Mode" => 0777 + 'UID' => '0', + 'GID' => '0', + 'Mode' => 0777, ], 'ConfigName' => $configFile->dockerName, ])->values()->toArray(), 'Placement' => $deployment->data->placementNodeId ? [ 'Constraints' => [ "node.labels.sh.ptah.node.id=={$deployment->data->placementNodeId}", - ] + ], ] : [], ], 'Networks' => [ [ 'Target' => $deployment->data->networkName, 'Aliases' => [$internalDomain], - ] + ], ], ], 'Mode' => [ @@ -349,14 +346,14 @@ public function asNodeTasks(Deployment $deployment): array ], ], 'EndpointSpec' => [ - 'Ports' => collect($this->ports)->map(fn(NodePort $port) => [ + 'Ports' => collect($this->ports)->map(fn (NodePort $port) => [ 'Protocol' => 'tcp', 'TargetPort' => $port->targetPort, 'PublishedPort' => $port->publishedPort, 'PublishMode' => 'ingress', - ])->toArray() - ] - ] + ])->toArray(), + ], + ], ], ]; @@ -387,31 +384,31 @@ public function asNodeTasks(Deployment $deployment): array $worker->command, ], 'Hostname' => "dpl-{$deployment->id}.{$worker->name}.{$internalDomain}", - 'Env' => collect($this->envVars)->map(fn(EnvVar $var) => "{$var->name}={$var->value}")->toArray(), + 'Env' => collect($this->envVars)->map(fn (EnvVar $var) => "{$var->name}={$var->value}")->toArray(), 'Mounts' => [], 'HealthCheck' => [ - 'Test' => ['NONE'] + 'Test' => ['NONE'], ], 'Hosts' => [ "{$worker->name}.{$internalDomain}", ], - 'Secrets' => collect($this->secretFiles)->map(fn(ConfigFile $secretFile) => [ + 'Secrets' => collect($this->secretFiles)->map(fn (ConfigFile $secretFile) => [ 'File' => [ 'Name' => $secretFile->path, // TODO: figure out better permissions settings (if any) - 'UID' => "0", - "GID" => "0", - "Mode" => 0777 + 'UID' => '0', + 'GID' => '0', + 'Mode' => 0777, ], 'SecretName' => $secretFile->dockerName, ])->values()->toArray(), - 'Configs' => collect($this->configFiles)->map(fn(ConfigFile $configFile) => [ + 'Configs' => collect($this->configFiles)->map(fn (ConfigFile $configFile) => [ 'File' => [ 'Name' => $configFile->path, // TODO: figure out better permissions settings (if any) - 'UID' => "0", - "GID" => "0", - "Mode" => 0777 + 'UID' => '0', + 'GID' => '0', + 'Mode' => 0777, ], 'ConfigName' => $configFile->dockerName, ])->values()->toArray(), @@ -423,7 +420,7 @@ public function asNodeTasks(Deployment $deployment): array 'Aliases' => [ "{$worker->name}.{$internalDomain}", ], - ] + ], ], ], 'Mode' => [ @@ -435,9 +432,9 @@ public function asNodeTasks(Deployment $deployment): array 'Parallelism' => 1, ], 'EndpointSpec' => [ - 'Ports' => [] - ] - ] + 'Ports' => [], + ], + ], ], ]; } @@ -460,11 +457,11 @@ protected function getSecretVars(?Process $previous, $labels): array|object 'kind' => 'secret-env-vars', ]), 'Values' => (object) collect($this->data->secretVars->vars) - ->reject(fn(EnvVar $var) => $var->value === null) - ->reduce(fn($carry, EnvVar $var) => [...$carry, $var->name => $var->value], []), + ->reject(fn (EnvVar $var) => $var->value === null) + ->reduce(fn ($carry, EnvVar $var) => [...$carry, $var->name => $var->value], []), ]; - if (!empty($previous?->secretVars->dockerName)) { + if (! empty($previous?->secretVars->dockerName)) { $data['Preserve'] = collect($this->data->secretVars->vars) ->filter(fn (EnvVar $var) => $var->value === null) ->map(fn (EnvVar $var) => $var->name) @@ -483,26 +480,25 @@ private function getWorkerSecretVars(Worker $worker, array $labels): array|objec } return [ - 'ConfigName' => $this->data->secretVars->dockerName . '_wkr_' . $worker->name, + 'ConfigName' => $this->data->secretVars->dockerName.'_wkr_'.$worker->name, 'ConfigLabels' => dockerize_labels([ ...$labels, 'kind' => 'secret-env-vars', ]), 'Values' => [], - 'Preserve' => collect($this->data->secretVars->vars)->map(fn(EnvVar $var) => $var->name)->toArray(), + 'Preserve' => collect($this->data->secretVars->vars)->map(fn (EnvVar $var) => $var->name)->toArray(), 'PreserveFromConfig' => $this->secretVars->dockerName, ]; } - public function makeResourceName(string $name): string { - return dockerize_name($this->dockerName . '_' . $name); + return dockerize_name($this->dockerName.'_'.$name); } private function getReleaseCommandPayload(Deployment $deployment, array $labels): array { - if (!$this->releaseCommand->command) { + if (! $this->releaseCommand->command) { return [ 'ConfigName' => '', 'ConfigLabels' => (object) [], @@ -512,6 +508,7 @@ private function getReleaseCommandPayload(Deployment $deployment, array $labels) // Always create a new config, as the command may be the same, but the image/entrypoint may be different. $this->releaseCommand->dockerName = $deployment->makeResourceName('release_command'); + return [ 'ConfigName' => $this->releaseCommand->dockerName, 'ConfigLabels' => dockerize_labels([ @@ -524,10 +521,10 @@ private function getReleaseCommandPayload(Deployment $deployment, array $labels) private function findWorker(?string $dockerName): ?Worker { - if (!$dockerName) { + if (! $dockerName) { return null; } - return collect($this->workers)->first(fn(Worker $worker) => $worker->dockerName === $dockerName); + return collect($this->workers)->first(fn (Worker $worker) => $worker->dockerName === $dockerName); } } diff --git a/app/Models/DeploymentData/ProcessBackup.php b/app/Models/DeploymentData/ProcessBackup.php index 5073a62..ebcc22e 100644 --- a/app/Models/DeploymentData/ProcessBackup.php +++ b/app/Models/DeploymentData/ProcessBackup.php @@ -6,14 +6,10 @@ class ProcessBackup extends Data { - public function __construct( public string $id, public string $name, public string $command, public BackupSchedule $backupSchedule, - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/RedirectRule.php b/app/Models/DeploymentData/RedirectRule.php index 80db969..25eaf3a 100644 --- a/app/Models/DeploymentData/RedirectRule.php +++ b/app/Models/DeploymentData/RedirectRule.php @@ -13,8 +13,5 @@ public function __construct( public string $pathFrom, public string $pathTo, public int $statusCode - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/ReleaseCommand.php b/app/Models/DeploymentData/ReleaseCommand.php index e57e05b..e867ee6 100644 --- a/app/Models/DeploymentData/ReleaseCommand.php +++ b/app/Models/DeploymentData/ReleaseCommand.php @@ -9,8 +9,7 @@ class ReleaseCommand extends Data public function __construct( public ?string $dockerName, public ?string $command - ) - { + ) { // } } diff --git a/app/Models/DeploymentData/SecretVars.php b/app/Models/DeploymentData/SecretVars.php index 5df2726..016c062 100644 --- a/app/Models/DeploymentData/SecretVars.php +++ b/app/Models/DeploymentData/SecretVars.php @@ -11,8 +11,5 @@ public function __construct( #[DataCollectionOf(EnvVar::class)] public array $vars, public ?string $dockerName - ) - { - - } + ) {} } diff --git a/app/Models/DeploymentData/Volume.php b/app/Models/DeploymentData/Volume.php index c1c6813..ab9beb4 100644 --- a/app/Models/DeploymentData/Volume.php +++ b/app/Models/DeploymentData/Volume.php @@ -12,8 +12,5 @@ public function __construct( public ?string $dockerName, public string $path, public ?BackupSchedule $backupSchedule - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/DeploymentData/Worker.php b/app/Models/DeploymentData/Worker.php index 07f023a..23884f7 100644 --- a/app/Models/DeploymentData/Worker.php +++ b/app/Models/DeploymentData/Worker.php @@ -6,14 +6,12 @@ class Worker extends Data { - public function __construct( public string $name, public ?string $dockerName, public string $command, public int $replicas - ) - { + ) { // } } diff --git a/app/Models/Node.php b/app/Models/Node.php index c134d12..68714de 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -16,7 +16,7 @@ class Node extends Model use HasOwningTeam; protected $casts = [ - 'data' => NodeData::class + 'data' => NodeData::class, ]; protected $fillable = [ @@ -132,7 +132,7 @@ public function upgradeAgent($targetVersion): void 'payload' => [ 'TargetVersion' => $targetVersion, 'DownloadUrl' => $release->download_url, - ] + ], ], [ 'type' => NodeTaskType::UpdateAgentSymlink, @@ -141,7 +141,7 @@ public function upgradeAgent($targetVersion): void ], 'payload' => [ 'TargetVersion' => $targetVersion, - ] + ], ], [ 'type' => NodeTaskType::ConfirmAgentUpgrade, @@ -150,8 +150,8 @@ public function upgradeAgent($targetVersion): void ], 'payload' => [ 'TargetVersion' => $targetVersion, - ] - ] + ], + ], ]); } } diff --git a/app/Models/NodeData.php b/app/Models/NodeData.php index 3f89bf4..6e09d6f 100644 --- a/app/Models/NodeData.php +++ b/app/Models/NodeData.php @@ -7,13 +7,12 @@ use App\Models\NodeData\NodeRole; use Spatie\LaravelData\Data; -class NodeData extends Data { +class NodeData extends Data +{ public function __construct( public string $version, public DockerData $docker, public HostData $host, public NodeRole $role, - ) { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeData/DockerData.php b/app/Models/NodeData/DockerData.php index b84eb51..33c8117 100644 --- a/app/Models/NodeData/DockerData.php +++ b/app/Models/NodeData/DockerData.php @@ -2,13 +2,11 @@ namespace App\Models\NodeData; - use Spatie\LaravelData\Data; -class DockerData extends Data { +class DockerData extends Data +{ public function __construct( public DockerPlatformData $platform - ) { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeData/DockerPlatformData.php b/app/Models/NodeData/DockerPlatformData.php index a334ca7..e928271 100644 --- a/app/Models/NodeData/DockerPlatformData.php +++ b/app/Models/NodeData/DockerPlatformData.php @@ -8,8 +8,5 @@ class DockerPlatformData extends Data { public function __construct( public string $name - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeData/HostData.php b/app/Models/NodeData/HostData.php index 56b46da..e3ea0f6 100644 --- a/app/Models/NodeData/HostData.php +++ b/app/Models/NodeData/HostData.php @@ -5,12 +5,10 @@ use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Data; -class HostData extends Data { - +class HostData extends Data +{ public function __construct( #[DataCollectionOf(HostNetwork::class)] public array $networks - ) { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeData/HostNetwork.php b/app/Models/NodeData/HostNetwork.php index 4184021..130816b 100644 --- a/app/Models/NodeData/HostNetwork.php +++ b/app/Models/NodeData/HostNetwork.php @@ -12,9 +12,6 @@ public function __construct( public string $if_name, #[DataCollectionOf(IpAddress::class)] #[Required] - public array $ips - ) - { - - } -} \ No newline at end of file + public array $ips + ) {} +} diff --git a/app/Models/NodeData/IpAddress.php b/app/Models/NodeData/IpAddress.php index 00a789a..fcdcfb1 100644 --- a/app/Models/NodeData/IpAddress.php +++ b/app/Models/NodeData/IpAddress.php @@ -13,7 +13,5 @@ public function __construct( public string $version, #[IP] public string $ip - ) - { - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeData/IpVersion.php b/app/Models/NodeData/IpVersion.php index a4b4713..062602d 100644 --- a/app/Models/NodeData/IpVersion.php +++ b/app/Models/NodeData/IpVersion.php @@ -6,4 +6,4 @@ enum IpVersion: string { case IPv4 = 'ipv4'; case IPv6 = 'ipv6'; -} \ No newline at end of file +} diff --git a/app/Models/NodeTask.php b/app/Models/NodeTask.php index d821197..2632fb4 100644 --- a/app/Models/NodeTask.php +++ b/app/Models/NodeTask.php @@ -52,7 +52,7 @@ public function getFormattedMetaAttribute(): string return $this->meta->formattedHtml(); } - public function getFormattedResultAttribute(): string | null + public function getFormattedResultAttribute(): ?string { if (is_null($this->result)) { return null; diff --git a/app/Models/NodeTaskGroup.php b/app/Models/NodeTaskGroup.php index 498f9f0..0d24858 100644 --- a/app/Models/NodeTaskGroup.php +++ b/app/Models/NodeTaskGroup.php @@ -2,7 +2,6 @@ namespace App\Models; -use App\Models\NodeTasks\AbstractTaskResult; use App\Models\NodeTasks\TaskStatus; use App\Traits\HasOwningTeam; use App\Traits\HasTaskStatus; @@ -11,8 +10,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; -use Symfony\Component\VarDumper\VarDumper; -use function Psy\debug; class NodeTaskGroup extends Model { @@ -43,7 +40,7 @@ public function latestTask(): HasOne return $this->hasOne(NodeTask::class, 'task_group_id')->latest(); } - public function allTasksEnded() :bool + public function allTasksEnded(): bool { return ! $this->tasks()->whereNull('ended_at')->exists(); } @@ -66,11 +63,11 @@ public function start(Node $node): void $this->save(); } - public function retry(Node|null $node): void + public function retry(?Node $node): void { $nodeId = is_null($node) ? null : $node->id; - $taskGroup = new NodeTaskGroup(); + $taskGroup = new NodeTaskGroup; $taskGroup->type = $this->type; $taskGroup->node_id = $nodeId; $taskGroup->forceFill(collect($this->attributes)->only([ @@ -80,26 +77,25 @@ public function retry(Node|null $node): void ])->toArray()); $taskGroup->save(); - - $taskGroup->tasks()->saveMany($this->tasks->map(function (NodeTask $task) use ($node) { + $taskGroup->tasks()->saveMany($this->tasks->map(function (NodeTask $task) { $dataAttrs = $task->is_completed ? [ 'status', 'started_at', 'ended_at', - 'result' + 'result', ] : [ ]; - $attrs = collect($task->attributes); + $attrs = collect($task->attributes); - $attributes = $attrs + $attributes = $attrs ->only($dataAttrs) ->merge($attrs->only(['type', 'meta', 'payload'])) ->toArray(); - return (new NodeTask($attributes))->forceFill($attributes); - })); + return (new NodeTask($attributes))->forceFill($attributes); + })); } } diff --git a/app/Models/NodeTasks/AbstractTaskMeta.php b/app/Models/NodeTasks/AbstractTaskMeta.php index 94d71b5..65d71af 100644 --- a/app/Models/NodeTasks/AbstractTaskMeta.php +++ b/app/Models/NodeTasks/AbstractTaskMeta.php @@ -4,7 +4,8 @@ use Spatie\LaravelData\Data; -abstract class AbstractTaskMeta extends Data { +abstract class AbstractTaskMeta extends Data +{ abstract public function formattedHtml(); // TODO: makes sense for each task define it's own payload. Examples: diff --git a/app/Models/NodeTasks/AbstractTaskResult.php b/app/Models/NodeTasks/AbstractTaskResult.php index d52cd7d..ec499b3 100644 --- a/app/Models/NodeTasks/AbstractTaskResult.php +++ b/app/Models/NodeTasks/AbstractTaskResult.php @@ -2,12 +2,9 @@ namespace App\Models\NodeTasks; -use Illuminate\Database\Eloquent\Concerns\HasEvents; use Spatie\LaravelData\Data; abstract class AbstractTaskResult extends Data { - - abstract public function formattedHtml(); -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigMeta.php b/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigMeta.php index 7778f44..e384149 100644 --- a/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigMeta.php +++ b/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigMeta.php @@ -8,13 +8,12 @@ class ApplyCaddyConfigMeta extends AbstractTaskMeta { public function __construct( public int $deploymentId - ) - { + ) { // } public function formattedHtml(): string { - return "Apply Caddy Config"; + return 'Apply Caddy Config'; } } diff --git a/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigResult.php b/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigResult.php index e647453..c3b7a03 100644 --- a/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigResult.php +++ b/app/Models/NodeTasks/ApplyCaddyConfig/ApplyCaddyConfigResult.php @@ -7,13 +7,12 @@ class ApplyCaddyConfigResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthMeta.php b/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthMeta.php index 9ab26dc..3ae15d5 100644 --- a/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthMeta.php +++ b/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthMeta.php @@ -8,13 +8,12 @@ class CheckRegistryAuthMeta extends AbstractTaskMeta { public function __construct( public string $registryName - ) - { + ) { // } public function formattedHtml(): string { - return 'Check registry auth ' . $this->registryName . ''; + return 'Check registry auth '.$this->registryName.''; } } diff --git a/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthResult.php b/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthResult.php index d31bdba..25c5f8e 100644 --- a/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthResult.php +++ b/app/Models/NodeTasks/CheckRegistryAuth/CheckRegistryAuthResult.php @@ -7,13 +7,12 @@ class CheckRegistryAuthResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageMeta.php b/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageMeta.php index b11f315..1861665 100644 --- a/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageMeta.php +++ b/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageMeta.php @@ -9,8 +9,7 @@ class CheckS3StorageMeta extends AbstractTaskMeta public function __construct( public string $s3StorageId, public string $s3StorageName, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageResult.php b/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageResult.php index 7b39da1..d9ac231 100644 --- a/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageResult.php +++ b/app/Models/NodeTasks/CheckS3Storage/CheckS3StorageResult.php @@ -7,13 +7,12 @@ class CheckS3StorageResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeMeta.php b/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeMeta.php index 54d81fc..55095ae 100644 --- a/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeMeta.php +++ b/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeMeta.php @@ -8,8 +8,7 @@ class ConfirmAgentUpgradeMeta extends AbstractTaskMeta { public function __construct( public string $targetVersion - ) - { + ) { // } diff --git a/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeResult.php b/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeResult.php index 9f26eb4..9379116 100644 --- a/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeResult.php +++ b/app/Models/NodeTasks/ConfirmAgentUpgrade/ConfirmAgentUpgradeResult.php @@ -7,13 +7,12 @@ class ConfirmAgentUpgradeResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/CreateConfig/CreateConfigMeta.php b/app/Models/NodeTasks/CreateConfig/CreateConfigMeta.php index 0b5f3fb..95b3d2b 100644 --- a/app/Models/NodeTasks/CreateConfig/CreateConfigMeta.php +++ b/app/Models/NodeTasks/CreateConfig/CreateConfigMeta.php @@ -7,16 +7,15 @@ class CreateConfigMeta extends AbstractTaskMeta { public function __construct( - public int $deploymentId, + public int $deploymentId, public string $processName, public string $path, public string $hash - ) - { + ) { // } - public function formattedHtml():string + public function formattedHtml(): string { return "Create Docker Config $this->path for process {$this->processName}"; } diff --git a/app/Models/NodeTasks/CreateConfig/CreateConfigResult.php b/app/Models/NodeTasks/CreateConfig/CreateConfigResult.php index 1c489b9..fa6ff9c 100644 --- a/app/Models/NodeTasks/CreateConfig/CreateConfigResult.php +++ b/app/Models/NodeTasks/CreateConfig/CreateConfigResult.php @@ -7,16 +7,14 @@ class CreateConfigResult extends AbstractTaskResult { - public function __construct( public DockerId $docker - ) - { + ) { // } public function formattedHtml(): string { - return 'Config ID: ' . $this->docker->id . ''; + return 'Config ID: '.$this->docker->id.''; } -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/CreateNetwork/CreateNetworkMeta.php b/app/Models/NodeTasks/CreateNetwork/CreateNetworkMeta.php index a608cfc..24a71ef 100644 --- a/app/Models/NodeTasks/CreateNetwork/CreateNetworkMeta.php +++ b/app/Models/NodeTasks/CreateNetwork/CreateNetworkMeta.php @@ -9,8 +9,7 @@ class CreateNetworkMeta extends AbstractTaskMeta public function __construct( public int $networkId, public string $name, - ) { - } + ) {} public function formattedHtml(): string { diff --git a/app/Models/NodeTasks/CreateNetwork/CreateNetworkResult.php b/app/Models/NodeTasks/CreateNetwork/CreateNetworkResult.php index e199bc4..dc0aedf 100644 --- a/app/Models/NodeTasks/CreateNetwork/CreateNetworkResult.php +++ b/app/Models/NodeTasks/CreateNetwork/CreateNetworkResult.php @@ -9,12 +9,10 @@ class CreateNetworkResult extends AbstractTaskResult { public function __construct( public DockerId $docker - ) { - - } + ) {} public function formattedHtml(): string { - return 'Network ID: ' . $this->docker->id . ''; + return 'Network ID: '.$this->docker->id.''; } -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthMeta.php b/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthMeta.php index b3b3b40..23890db 100644 --- a/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthMeta.php +++ b/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthMeta.php @@ -8,8 +8,7 @@ class CreateRegistryAuthMeta extends AbstractTaskMeta { public function __construct( public string $registryName, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthResult.php b/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthResult.php index 9e4e1bf..e4f7710 100644 --- a/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthResult.php +++ b/app/Models/NodeTasks/CreateRegistryAuth/CreateRegistryAuthResult.php @@ -9,8 +9,7 @@ class CreateRegistryAuthResult extends AbstractTaskResult { public function __construct( public DockerId $docker - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageMeta.php b/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageMeta.php index 611d68d..e3138ca 100644 --- a/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageMeta.php +++ b/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageMeta.php @@ -9,8 +9,7 @@ class CreateS3StorageMeta extends AbstractTaskMeta public function __construct( public string $s3StorageId, public string $s3StorageName, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageResult.php b/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageResult.php index f649d8d..609fb72 100644 --- a/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageResult.php +++ b/app/Models/NodeTasks/CreateS3Storage/CreateS3StorageResult.php @@ -9,8 +9,7 @@ class CreateS3StorageResult extends AbstractTaskResult { public function __construct( public DockerId $docker, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateSecret/CreateSecretMeta.php b/app/Models/NodeTasks/CreateSecret/CreateSecretMeta.php index a458807..1a52cf9 100644 --- a/app/Models/NodeTasks/CreateSecret/CreateSecretMeta.php +++ b/app/Models/NodeTasks/CreateSecret/CreateSecretMeta.php @@ -11,8 +11,7 @@ public function __construct( public string $processName, public string $path, public string $hash - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateSecret/CreateSecretResult.php b/app/Models/NodeTasks/CreateSecret/CreateSecretResult.php index 232719f..bd58a54 100644 --- a/app/Models/NodeTasks/CreateSecret/CreateSecretResult.php +++ b/app/Models/NodeTasks/CreateSecret/CreateSecretResult.php @@ -9,13 +9,12 @@ class CreateSecretResult extends AbstractTaskResult { public function __construct( public DockerId $docker - ) - { + ) { // } public function formattedHtml(): string { - return 'Secret ID: ' . $this->docker->id . ''; + return 'Secret ID: '.$this->docker->id.''; } } diff --git a/app/Models/NodeTasks/CreateService/CreateServiceMeta.php b/app/Models/NodeTasks/CreateService/CreateServiceMeta.php index ebfb554..9f87142 100644 --- a/app/Models/NodeTasks/CreateService/CreateServiceMeta.php +++ b/app/Models/NodeTasks/CreateService/CreateServiceMeta.php @@ -11,8 +11,7 @@ public function __construct( public int $serviceId, public string $serviceName, public string $dockerName - ) - { + ) { // } diff --git a/app/Models/NodeTasks/CreateService/CreateServiceResult.php b/app/Models/NodeTasks/CreateService/CreateServiceResult.php index 6ea37cf..8c4d728 100644 --- a/app/Models/NodeTasks/CreateService/CreateServiceResult.php +++ b/app/Models/NodeTasks/CreateService/CreateServiceResult.php @@ -9,13 +9,12 @@ class CreateServiceResult extends AbstractTaskResult { public function __construct( public DockerId $docker - ) - { + ) { // } public function formattedHtml(): string { - return 'Service ID: ' . $this->docker->id . ''; + return 'Service ID: '.$this->docker->id.''; } } diff --git a/app/Models/NodeTasks/DeleteService/DeleteServiceMeta.php b/app/Models/NodeTasks/DeleteService/DeleteServiceMeta.php index 3295fca..b7c8fa3 100644 --- a/app/Models/NodeTasks/DeleteService/DeleteServiceMeta.php +++ b/app/Models/NodeTasks/DeleteService/DeleteServiceMeta.php @@ -7,11 +7,10 @@ class DeleteServiceMeta extends AbstractTaskMeta { public function __construct( - public int $serviceId, + public int $serviceId, public string $dockerName, public string $serviceName, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/DeleteService/DeleteServiceResult.php b/app/Models/NodeTasks/DeleteService/DeleteServiceResult.php index 0d27050..6748c49 100644 --- a/app/Models/NodeTasks/DeleteService/DeleteServiceResult.php +++ b/app/Models/NodeTasks/DeleteService/DeleteServiceResult.php @@ -7,13 +7,12 @@ class DeleteServiceResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Service deleted successfully."; + return 'Service deleted successfully.'; } } diff --git a/app/Models/NodeTasks/DockerId.php b/app/Models/NodeTasks/DockerId.php index 0c1f868..00dcb64 100644 --- a/app/Models/NodeTasks/DockerId.php +++ b/app/Models/NodeTasks/DockerId.php @@ -4,11 +4,9 @@ use Spatie\LaravelData\Data; -class DockerId extends Data { - +class DockerId extends Data +{ public function __construct( public string $id, - ) { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeMeta.php b/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeMeta.php index 8a6f070..87557be 100644 --- a/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeMeta.php +++ b/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeMeta.php @@ -9,8 +9,7 @@ class DownloadAgentUpgradeMeta extends AbstractTaskMeta public function __construct( public string $targetVersion, public string $downloadUrl - ) - { + ) { // } diff --git a/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeResult.php b/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeResult.php index 9a0c958..d3550b7 100644 --- a/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeResult.php +++ b/app/Models/NodeTasks/DownloadAgentUpgrade/DownloadAgentUpgradeResult.php @@ -9,8 +9,7 @@ class DownloadAgentUpgradeResult extends AbstractTaskResult public function __construct( public int $fileSize, public int $downloadTime - ) - { + ) { // } diff --git a/app/Models/NodeTasks/ErrorResult.php b/app/Models/NodeTasks/ErrorResult.php index c728a13..1db0966 100644 --- a/app/Models/NodeTasks/ErrorResult.php +++ b/app/Models/NodeTasks/ErrorResult.php @@ -6,13 +6,10 @@ class ErrorResult extends AbstractTaskResult { public function __construct( public string $message - ) - { - - } + ) {} public function formattedHtml(): string { return $this->message; } -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/InitSwarm/InitSwarmMeta.php b/app/Models/NodeTasks/InitSwarm/InitSwarmMeta.php index e877437..2064f6e 100644 --- a/app/Models/NodeTasks/InitSwarm/InitSwarmMeta.php +++ b/app/Models/NodeTasks/InitSwarm/InitSwarmMeta.php @@ -3,7 +3,6 @@ namespace App\Models\NodeTasks\InitSwarm; use App\Models\NodeTasks\AbstractTaskMeta; -use Spatie\LaravelData\Attributes\Validation\IPv4; class InitSwarmMeta extends AbstractTaskMeta { @@ -11,9 +10,7 @@ public function __construct( public int $swarmId, public string $name, public bool $forceNewCluster - ) { - - } + ) {} public function formattedHtml(): string { diff --git a/app/Models/NodeTasks/InitSwarm/InitSwarmResult.php b/app/Models/NodeTasks/InitSwarm/InitSwarmResult.php index 767bf19..f01c100 100644 --- a/app/Models/NodeTasks/InitSwarm/InitSwarmResult.php +++ b/app/Models/NodeTasks/InitSwarm/InitSwarmResult.php @@ -9,13 +9,10 @@ class InitSwarmResult extends AbstractTaskResult { public function __construct( public DockerId $docker - ) - { - - } + ) {} public function formattedHtml(): string { - return 'Swarm ID: ' . $this->docker->id . ''; + return 'Swarm ID: '.$this->docker->id.''; } -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/JoinSwarm/JoinSwarmMeta.php b/app/Models/NodeTasks/JoinSwarm/JoinSwarmMeta.php index ceffdeb..bf8f43b 100644 --- a/app/Models/NodeTasks/JoinSwarm/JoinSwarmMeta.php +++ b/app/Models/NodeTasks/JoinSwarm/JoinSwarmMeta.php @@ -11,8 +11,7 @@ class JoinSwarmMeta extends AbstractTaskMeta public function __construct( public readonly string $swarmId, public readonly NodeRole $role, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/JoinSwarm/JoinSwarmResult.php b/app/Models/NodeTasks/JoinSwarm/JoinSwarmResult.php index f16bd66..0af3d33 100644 --- a/app/Models/NodeTasks/JoinSwarm/JoinSwarmResult.php +++ b/app/Models/NodeTasks/JoinSwarm/JoinSwarmResult.php @@ -7,13 +7,12 @@ class JoinSwarmResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/PullDockerImage/PullDockerImageMeta.php b/app/Models/NodeTasks/PullDockerImage/PullDockerImageMeta.php index 1f5b204..0c1edee 100644 --- a/app/Models/NodeTasks/PullDockerImage/PullDockerImageMeta.php +++ b/app/Models/NodeTasks/PullDockerImage/PullDockerImageMeta.php @@ -8,8 +8,7 @@ class PullDockerImageMeta extends AbstractTaskMeta { public function __construct( public string $dockerImage - ) - { + ) { // } diff --git a/app/Models/NodeTasks/PullDockerImage/PullDockerImageResult.php b/app/Models/NodeTasks/PullDockerImage/PullDockerImageResult.php index 70a0f85..c493d97 100644 --- a/app/Models/NodeTasks/PullDockerImage/PullDockerImageResult.php +++ b/app/Models/NodeTasks/PullDockerImage/PullDockerImageResult.php @@ -9,13 +9,12 @@ class PullDockerImageResult extends AbstractTaskResult public function __construct( /* @var string[] */ public array $output - ) - { + ) { // } public function formattedHtml(): string { - return join("
\n", $this->output); + return implode("
\n", $this->output); } } diff --git a/app/Models/NodeTasks/ServiceExec/ServiceExecMeta.php b/app/Models/NodeTasks/ServiceExec/ServiceExecMeta.php index 129525e..a1e9957 100644 --- a/app/Models/NodeTasks/ServiceExec/ServiceExecMeta.php +++ b/app/Models/NodeTasks/ServiceExec/ServiceExecMeta.php @@ -9,8 +9,7 @@ class ServiceExecMeta extends AbstractTaskMeta public function __construct( public int $serviceId, public string $command, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/ServiceExec/ServiceExecResult.php b/app/Models/NodeTasks/ServiceExec/ServiceExecResult.php index 7087970..518317d 100644 --- a/app/Models/NodeTasks/ServiceExec/ServiceExecResult.php +++ b/app/Models/NodeTasks/ServiceExec/ServiceExecResult.php @@ -8,13 +8,12 @@ class ServiceExecResult extends AbstractTaskResult { public function __construct( public array $output - ) - { + ) { // } public function formattedHtml(): string { - return join('
', $this->output); + return implode('
', $this->output); } } diff --git a/app/Models/NodeTasks/TaskStatus.php b/app/Models/NodeTasks/TaskStatus.php index dcf8091..ef610cc 100644 --- a/app/Models/NodeTasks/TaskStatus.php +++ b/app/Models/NodeTasks/TaskStatus.php @@ -16,4 +16,4 @@ public function isEnded(): bool || $this->value === TaskStatus::Failed->value || $this->value === TaskStatus::Canceled->value; } -} \ No newline at end of file +} diff --git a/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkMeta.php b/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkMeta.php index 552718c..eaea838 100644 --- a/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkMeta.php +++ b/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkMeta.php @@ -8,8 +8,7 @@ class UpdateAgentSymlinkMeta extends AbstractTaskMeta { public function __construct( public string $targetVersion - ) - { + ) { // } diff --git a/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkResult.php b/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkResult.php index b202077..9d9216d 100644 --- a/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkResult.php +++ b/app/Models/NodeTasks/UpdateAgentSymlink/UpdateAgentSymlinkResult.php @@ -7,13 +7,12 @@ class UpdateAgentSymlinkResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeMeta.php b/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeMeta.php index 110b192..7c35d1d 100644 --- a/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeMeta.php +++ b/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeMeta.php @@ -7,8 +7,7 @@ class UpdateCurrentNodeMeta extends AbstractTaskMeta { public function __construct( - ) - { + ) { // } diff --git a/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeResult.php b/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeResult.php index a141f56..d43388c 100644 --- a/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeResult.php +++ b/app/Models/NodeTasks/UpdateCurrentNode/UpdateCurrentNodeResult.php @@ -7,13 +7,12 @@ class UpdateCurrentNodeResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Success."; + return 'Success.'; } } diff --git a/app/Models/NodeTasks/UpdateService/UpdateServiceMeta.php b/app/Models/NodeTasks/UpdateService/UpdateServiceMeta.php index 121383c..ddabb41 100644 --- a/app/Models/NodeTasks/UpdateService/UpdateServiceMeta.php +++ b/app/Models/NodeTasks/UpdateService/UpdateServiceMeta.php @@ -11,8 +11,7 @@ public function __construct( public int $serviceId, public string $serviceName, public string $dockerName - ) - { + ) { // } diff --git a/app/Models/NodeTasks/UpdateService/UpdateServiceResult.php b/app/Models/NodeTasks/UpdateService/UpdateServiceResult.php index 92741c2..529f7c2 100644 --- a/app/Models/NodeTasks/UpdateService/UpdateServiceResult.php +++ b/app/Models/NodeTasks/UpdateService/UpdateServiceResult.php @@ -7,13 +7,12 @@ class UpdateServiceResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "Update Succeeded."; + return 'Update Succeeded.'; } } diff --git a/app/Models/NodeTasks/UploadS3File/UploadS3FileMeta.php b/app/Models/NodeTasks/UploadS3File/UploadS3FileMeta.php index 877da96..cc09f28 100644 --- a/app/Models/NodeTasks/UploadS3File/UploadS3FileMeta.php +++ b/app/Models/NodeTasks/UploadS3File/UploadS3FileMeta.php @@ -9,8 +9,7 @@ class UploadS3FileMeta extends AbstractTaskMeta public function __construct( public string $serviceId, public string $destPath, - ) - { + ) { // } diff --git a/app/Models/NodeTasks/UploadS3File/UploadS3FileResult.php b/app/Models/NodeTasks/UploadS3File/UploadS3FileResult.php index 976dbfc..0d88fb8 100644 --- a/app/Models/NodeTasks/UploadS3File/UploadS3FileResult.php +++ b/app/Models/NodeTasks/UploadS3File/UploadS3FileResult.php @@ -7,13 +7,12 @@ class UploadS3FileResult extends AbstractTaskResult { public function __construct( - ) - { + ) { // } public function formattedHtml(): string { - return "UploadS3File - Task Result"; + return 'UploadS3File - Task Result'; } } diff --git a/app/Models/Service.php b/app/Models/Service.php index f38bc69..ba90f26 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -2,7 +2,6 @@ namespace App\Models; -use App\Models\NodeTasks\ApplyCaddyConfig\ApplyCaddyConfigMeta; use App\Models\NodeTasks\DeleteService\DeleteServiceMeta; use App\Traits\HasOwningTeam; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -12,14 +11,12 @@ use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Gate; -use Illuminate\Support\Str; -use InvalidArgumentException; class Service extends Model { - use SoftDeletes; use HasFactory; use HasOwningTeam; + use SoftDeletes; protected $fillable = [ 'name', @@ -30,7 +27,7 @@ class Service extends Model protected static function booted() { self::saved(function (Service $service) { - if (!$service->docker_name) { + if (! $service->docker_name) { $service->docker_name = $service->makeResourceName($service->name); $service->saveQuietly(); } @@ -80,7 +77,7 @@ public function tasks(): HasMany public function makeResourceName($name): string { - return dockerize_name("svc_" . $this->id . '_'. $name); + return dockerize_name('svc_'.$this->id.'_'.$name); } public function deploy(DeploymentData $deploymentData): Deployment diff --git a/app/Models/Swarm.php b/app/Models/Swarm.php index 193f9c8..454ef78 100644 --- a/app/Models/Swarm.php +++ b/app/Models/Swarm.php @@ -5,7 +5,6 @@ use App\Traits\HasOwningTeam; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; class Swarm extends Model diff --git a/app/Models/SwarmData.php b/app/Models/SwarmData.php index b9c1887..9a49a1a 100644 --- a/app/Models/SwarmData.php +++ b/app/Models/SwarmData.php @@ -24,10 +24,7 @@ public function __construct( #[DataCollectionOf(ManagerNode::class)] /* @var ManagerNode[] */ public array $managerNodes, - ) - { - - } + ) {} public function findRegistry(string $id): ?DockerRegistry { diff --git a/app/Models/SwarmData/DockerRegistry.php b/app/Models/SwarmData/DockerRegistry.php index 7439c35..4e3f496 100644 --- a/app/Models/SwarmData/DockerRegistry.php +++ b/app/Models/SwarmData/DockerRegistry.php @@ -2,12 +2,8 @@ namespace App\Models\SwarmData; -use Spatie\LaravelData\Attributes\Validation\RequiredUnless; -use Spatie\LaravelData\Attributes\Validation\RequiredWith; use Spatie\LaravelData\Attributes\Validation\RequiredWithout; -use Spatie\LaravelData\Attributes\Validation\Sometimes; use Spatie\LaravelData\Data; -use Symfony\Contracts\Service\Attribute\Required; class DockerRegistry extends Data { @@ -20,10 +16,7 @@ public function __construct( public ?string $username, #[RequiredWithout('dockerName')] public ?string $password - ) - { - - } + ) {} public function sameAs(?DockerRegistry $other): bool { diff --git a/app/Models/SwarmData/JoinTokens.php b/app/Models/SwarmData/JoinTokens.php index 8277d99..2ff989e 100644 --- a/app/Models/SwarmData/JoinTokens.php +++ b/app/Models/SwarmData/JoinTokens.php @@ -9,8 +9,5 @@ class JoinTokens extends Data public function __construct( public string $worker, public string $manager - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/SwarmData/ManagerNode.php b/app/Models/SwarmData/ManagerNode.php index 92f1883..df56694 100644 --- a/app/Models/SwarmData/ManagerNode.php +++ b/app/Models/SwarmData/ManagerNode.php @@ -9,8 +9,5 @@ class ManagerNode extends Data public function __construct( public string $nodeId, public string $addr, - ) - { - - } -} \ No newline at end of file + ) {} +} diff --git a/app/Models/SwarmData/S3Storage.php b/app/Models/SwarmData/S3Storage.php index faae1ac..0d3ff96 100644 --- a/app/Models/SwarmData/S3Storage.php +++ b/app/Models/SwarmData/S3Storage.php @@ -16,10 +16,7 @@ public function __construct( public string $bucket, public string $pathPrefix, public ?string $dockerName, - ) - { - - } + ) {} public function sameAs(S3Storage $s3Storage): bool { diff --git a/app/Models/Team.php b/app/Models/Team.php index b958194..6b56e25 100644 --- a/app/Models/Team.php +++ b/app/Models/Team.php @@ -14,8 +14,8 @@ class Team extends JetstreamTeam { - use HasFactory; use Billable; + use HasFactory; use Notifiable; /** @@ -31,7 +31,7 @@ class Team extends JetstreamTeam ]; protected $appends = [ - 'billing' + 'billing', ]; /** @@ -64,8 +64,6 @@ protected function nodes(): HasMany /** * Get the name of the team. - * - * @return string */ protected function paddleName(): string { @@ -74,15 +72,13 @@ protected function paddleName(): string /** * Get the email address of the team. - * - * @return string */ protected function paddleEmail(): string { return $this->owner->email; } - protected function getBillingAttribute(): array | null + protected function getBillingAttribute(): ?array { if ($this->subscription() === null) { return null; @@ -95,7 +91,7 @@ protected function getBillingAttribute(): array | null ])->toArray(); } - public function routeNotificationForMail(Notification $notification): array | string + public function routeNotificationForMail(Notification $notification): array|string { return [$this->customer->email => $this->customer->name]; } diff --git a/app/Notifications/TrialEndsSoonNotification.php b/app/Notifications/TrialEndsSoonNotification.php index f85029f..91c1f96 100644 --- a/app/Notifications/TrialEndsSoonNotification.php +++ b/app/Notifications/TrialEndsSoonNotification.php @@ -17,8 +17,7 @@ class TrialEndsSoonNotification extends Notification implements ShouldQueue */ public function __construct( protected Team $team, - ) - { + ) { $this->afterCommit(); } @@ -46,12 +45,12 @@ public function toMail(object $notifiable): MailMessage $dateDiff = $nextPayment->date->longRelativeToNowDiffForHumans(); return (new MailMessage) - ->subject("Your trial ends in {$dateDiff}") - ->greeting("Hello {$this->team->customer->name}!") - ->line('Your trial for team '.$this->team->name.' ends soon.') - ->line("You will be charged {$nextPayment->amount()} on {$nextPayment->date->toDateTimeString()} ({$dateDiff}).") - ->action('Manage Subscription', url(route('teams.billing.show', $this->team))) - ->line('Any other questions? Contact us at '.config('app.email')); + ->subject("Your trial ends in {$dateDiff}") + ->greeting("Hello {$this->team->customer->name}!") + ->line('Your trial for team '.$this->team->name.' ends soon.') + ->line("You will be charged {$nextPayment->amount()} on {$nextPayment->date->toDateTimeString()} ({$dateDiff}).") + ->action('Manage Subscription', url(route('teams.billing.show', $this->team))) + ->line('Any other questions? Contact us at '.config('app.email')); } /** diff --git a/app/Policies/DeploymentPolicy.php b/app/Policies/DeploymentPolicy.php index 4046270..33f9a67 100644 --- a/app/Policies/DeploymentPolicy.php +++ b/app/Policies/DeploymentPolicy.php @@ -4,7 +4,6 @@ use App\Models\Deployment; use App\Models\User; -use Illuminate\Auth\Access\Response; class DeploymentPolicy { diff --git a/app/Policies/NetworkPolicy.php b/app/Policies/NetworkPolicy.php index c2dd1b0..7a8dfbb 100644 --- a/app/Policies/NetworkPolicy.php +++ b/app/Policies/NetworkPolicy.php @@ -4,7 +4,6 @@ use App\Models\Network; use App\Models\User; -use Illuminate\Auth\Access\Response; class NetworkPolicy { diff --git a/app/Policies/NodePolicy.php b/app/Policies/NodePolicy.php index 34c85a1..c89c575 100644 --- a/app/Policies/NodePolicy.php +++ b/app/Policies/NodePolicy.php @@ -4,7 +4,6 @@ use App\Models\Node; use App\Models\User; -use Illuminate\Auth\Access\Response; class NodePolicy { diff --git a/app/Policies/NodeTaskGroupPolicy.php b/app/Policies/NodeTaskGroupPolicy.php index 29de7cd..3cf4bd4 100644 --- a/app/Policies/NodeTaskGroupPolicy.php +++ b/app/Policies/NodeTaskGroupPolicy.php @@ -1,12 +1,9 @@ belongsToTeam($taskGroup->node->team); } -} \ No newline at end of file +} diff --git a/app/Policies/ServicePolicy.php b/app/Policies/ServicePolicy.php index 154d6ba..93f9c92 100644 --- a/app/Policies/ServicePolicy.php +++ b/app/Policies/ServicePolicy.php @@ -4,7 +4,6 @@ use App\Models\Service; use App\Models\User; -use Illuminate\Auth\Access\Response; class ServicePolicy { diff --git a/app/Policies/SwarmPolicy.php b/app/Policies/SwarmPolicy.php index 622fde3..8e1c6fe 100644 --- a/app/Policies/SwarmPolicy.php +++ b/app/Policies/SwarmPolicy.php @@ -4,7 +4,6 @@ use App\Models\Swarm; use App\Models\User; -use Illuminate\Auth\Access\Response; class SwarmPolicy { diff --git a/app/Providers/JetstreamServiceProvider.php b/app/Providers/JetstreamServiceProvider.php index 5d6beda..edc8bb6 100644 --- a/app/Providers/JetstreamServiceProvider.php +++ b/app/Providers/JetstreamServiceProvider.php @@ -56,10 +56,10 @@ protected function configurePermissions(): void 'delete', ])->description('Administrator users can perform any action.'); -// Jetstream::role('editor', 'Editor', [ -// 'read', -// 'create', -// 'update', -// ])->description('Editor users have the ability to read, create, and update.'); + // Jetstream::role('editor', 'Editor', [ + // 'read', + // 'create', + // 'update', + // ])->description('Editor users have the ability to read, create, and update.'); } } diff --git a/app/Rules/RequiredIfArrayHas.php b/app/Rules/RequiredIfArrayHas.php index 5b6e27c..ec962e6 100644 --- a/app/Rules/RequiredIfArrayHas.php +++ b/app/Rules/RequiredIfArrayHas.php @@ -7,14 +7,11 @@ use Illuminate\Contracts\Validation\ValidationRule; use Override; -class RequiredIfArrayHas implements ValidationRule, DataAwareRule +class RequiredIfArrayHas implements DataAwareRule, ValidationRule { protected array $data; - public function __construct(protected string $targetArrayPath, protected string $targetValue) - { - - } + public function __construct(protected string $targetArrayPath, protected string $targetValue) {} /** * Run the validation rule. diff --git a/app/Traits/HasOwningTeam.php b/app/Traits/HasOwningTeam.php index a5cac4b..86898ac 100644 --- a/app/Traits/HasOwningTeam.php +++ b/app/Traits/HasOwningTeam.php @@ -9,8 +9,8 @@ trait HasOwningTeam { protected static function bootHasOwningTeam(): void { - if (!app()->runningInConsole()) { - static::addGlobalScope(new TeamScope()); + if (! app()->runningInConsole()) { + static::addGlobalScope(new TeamScope); } } diff --git a/app/Traits/HasTaskStatus.php b/app/Traits/HasTaskStatus.php index 4adcc68..fc4891a 100644 --- a/app/Traits/HasTaskStatus.php +++ b/app/Traits/HasTaskStatus.php @@ -2,12 +2,10 @@ namespace App\Traits; -use App\Casts\TaskPayloadCast; use App\Models\NodeTask; -use App\Models\NodeTasks; -use App\Models\NodeTasks\TaskStatus; use App\Models\NodeTaskGroup; use App\Models\NodeTaskGroupType; +use App\Models\NodeTasks\TaskStatus; use App\Models\NodeTaskType; use Illuminate\Database\Eloquent\Builder; use InvalidArgumentException; @@ -18,7 +16,7 @@ protected static function bootHasTaskStatus(): void { static::addGlobalScope('taskStatusCast', function (Builder $builder) { return $builder->withCasts([ - 'status' => TaskStatus::class + 'status' => TaskStatus::class, ])->orderBy('id'); }); } @@ -48,28 +46,28 @@ public function scopeUnsuccessful(Builder $builder): Builder return $builder->whereIn($builder->qualifyColumn('status'), [TaskStatus::Failed, TaskStatus::Canceled]); } - public function getIsPendingAttribute() : bool + public function getIsPendingAttribute(): bool { return $this->status === TaskStatus::Pending; } - public function getIsRunningAttribute() : bool + public function getIsRunningAttribute(): bool { return $this->status === TaskStatus::Running; } - public function getIsCompletedAttribute() : bool + public function getIsCompletedAttribute(): bool { return $this->status === TaskStatus::Completed; } - public function scopeOfType(Builder $query, NodeTaskType | NodeTaskGroupType $typeClass): Builder + public function scopeOfType(Builder $query, NodeTaskType|NodeTaskGroupType $typeClass): Builder { - if ($this instanceof NodeTaskGroup && !($typeClass instanceof NodeTaskGroupType)) { + if ($this instanceof NodeTaskGroup && ! ($typeClass instanceof NodeTaskGroupType)) { throw new InvalidArgumentException('typeClass must be an instance of NodeTaskGroupType'); } - if ($this instanceof NodeTask && !($typeClass instanceof NodeTaskType)) { + if ($this instanceof NodeTask && ! ($typeClass instanceof NodeTaskType)) { throw new InvalidArgumentException('typeClass must be an instance of NodeTaskType'); } @@ -80,4 +78,4 @@ public function scopeInProgress(Builder $query): Builder { return $query->whereIn($query->qualifyColumn('status'), [TaskStatus::Pending, TaskStatus::Running]); } -} \ No newline at end of file +} diff --git a/app/Util/Arrays.php b/app/Util/Arrays.php index ae81435..3b05444 100644 --- a/app/Util/Arrays.php +++ b/app/Util/Arrays.php @@ -6,7 +6,7 @@ class Arrays { - static function niceMerge(array $array1, array $array2): array + public static function niceMerge(array $array1, array $array2): array { if (Arr::isList($array1) && Arr::isList($array2)) { return [...$array1, ...$array2]; @@ -17,8 +17,8 @@ static function niceMerge(array $array1, array $array2): array $result = []; foreach ($allKeys as $key) { - $array1KeyMissing = !array_key_exists($key, $array1); - $array2KeyMissing = !array_key_exists($key, $array2); + $array1KeyMissing = ! array_key_exists($key, $array1); + $array2KeyMissing = ! array_key_exists($key, $array2); $array2KeyExists = array_key_exists($key, $array2); $array2KeyNull = $array2KeyExists && $array2[$key] === null; $array2KeyScalar = $array2KeyExists && is_scalar($array2[$key]); @@ -40,4 +40,4 @@ static function niceMerge(array $array1, array $array2): array return $result; } -} \ No newline at end of file +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 53a05d8..9b2e7cd 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -32,12 +32,12 @@ $middleware ->api(prepend: [ AgentTokenAuth::class, - EnsureTeamSubscription::class + EnsureTeamSubscription::class, ]) ->web(append: [ HandleInertiaRequests::class, AddLinkHeadersForPreloadedAssets::class, - EnsureTeamSubscription::class + EnsureTeamSubscription::class, ]) ->alias([ 'abilities' => CheckAbilities::class, diff --git a/bootstrap/helpers.php b/bootstrap/helpers.php index 3f474f9..811c725 100644 --- a/bootstrap/helpers.php +++ b/bootstrap/helpers.php @@ -2,11 +2,11 @@ use Illuminate\Support\Str; -if (!function_exists('dockerize_labels')) { +if (! function_exists('dockerize_labels')) { function dockerize_labels(array $labels): array { $result = [ - 'sh.ptah.managed' => "1", + 'sh.ptah.managed' => '1', ]; foreach ($labels as $label => $value) { @@ -21,7 +21,7 @@ function dockerize_labels(array $labels): array } } -if (!function_exists('dockerize_name')) { +if (! function_exists('dockerize_name')) { function dockerize_name(string $name): string { $name = Str::snake($name); @@ -29,7 +29,7 @@ function dockerize_name(string $name): string $name = Str::replaceMatches('/_+/', '_', $name); if (Str::length($name) > 63) { - $name = Str::substr($name, 0, 57) . '_' . Str::random(5); + $name = Str::substr($name, 0, 57).'_'.Str::random(5); } return $name; diff --git a/composer.json b/composer.json index e31c7d0..09d5484 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require-dev": { "barryvdh/laravel-debugbar": "^3.13", "fakerphp/faker": "^1.23", - "laravel/pint": "^1.13", + "laravel/pint": "^1.17", "laravel/sail": "^1.26", "mockery/mockery": "^1.6", "nunomaduro/collision": "^8.0", diff --git a/composer.lock b/composer.lock index d554ce4..d6cd783 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e059d0cb8b85d0f0fec8a31d3fb8c79d", + "content-hash": "af6d632d8486367cdc2458f075dd9e98", "packages": [ { "name": "amphp/amp", @@ -9624,16 +9624,16 @@ }, { "name": "laravel/pint", - "version": "v1.16.2", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/laravel/pint.git", - "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca" + "reference": "4dba80c1de4b81dc4c4fb10ea6f4781495eb29f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/51f1ba679a6afe0315621ad143d788bd7ded0eca", - "reference": "51f1ba679a6afe0315621ad143d788bd7ded0eca", + "url": "https://api.github.com/repos/laravel/pint/zipball/4dba80c1de4b81dc4c4fb10ea6f4781495eb29f5", + "reference": "4dba80c1de4b81dc4c4fb10ea6f4781495eb29f5", "shasum": "" }, "require": { @@ -9686,7 +9686,7 @@ "issues": "https://github.com/laravel/pint/issues", "source": "https://github.com/laravel/pint" }, - "time": "2024-07-09T15:58:08+00:00" + "time": "2024-07-23T16:40:20+00:00" }, { "name": "laravel/sail", diff --git a/config/data.php b/config/data.php index b5b4ce6..91df93f 100644 --- a/config/data.php +++ b/config/data.php @@ -1,7 +1,5 @@ 'prefer', 'options' => [ PDO::ATTR_EMULATE_PREPARES => (bool) env('DB_EMULATE_PREPARES', false), - ] + ], ], 'sqlsrv' => [ diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 2449b0a..ea955ad 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -52,7 +52,7 @@ public function unverified(): static /** * Indicate that the user should have a personal team. */ - public function withPersonalTeam(callable $callback = null): static + public function withPersonalTeam(?callable $callback = null): static { if (! Features::hasTeamFeatures()) { return $this->state([]); diff --git a/database/migrations/2024_07_01_121412_alter_swarms_add_data_column.php b/database/migrations/2024_07_01_121412_alter_swarms_add_data_column.php index 953b36c..8680090 100644 --- a/database/migrations/2024_07_01_121412_alter_swarms_add_data_column.php +++ b/database/migrations/2024_07_01_121412_alter_swarms_add_data_column.php @@ -15,7 +15,6 @@ public function up(): void $table->jsonb('data')->after('name'); }); - } /** diff --git a/database/migrations/2024_07_10_204515_update_deployments_add_redirect_rules.php b/database/migrations/2024_07_10_204515_update_deployments_add_redirect_rules.php index 5990866..2f189b9 100644 --- a/database/migrations/2024_07_10_204515_update_deployments_add_redirect_rules.php +++ b/database/migrations/2024_07_10_204515_update_deployments_add_redirect_rules.php @@ -1,9 +1,7 @@ =18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/ansi-regex": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", @@ -1275,6 +1293,18 @@ } ] }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -1317,6 +1347,60 @@ "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", "dev": true }, + "node_modules/cli-cursor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz", + "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==", + "dev": true, + "dependencies": { + "restore-cursor": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz", + "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "node_modules/cli-truncate/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1335,6 +1419,12 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1393,6 +1483,23 @@ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.11.tgz", "integrity": "sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==" }, + "node_modules/debug": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -1470,6 +1577,18 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -1544,6 +1663,35 @@ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", "dev": true }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -1750,6 +1898,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-intrinsic": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", @@ -1769,6 +1929,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/glob": { "version": "10.4.2", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.2.tgz", @@ -1864,6 +2036,30 @@ "node": ">= 0.4" } }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/husky": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.4.tgz", + "integrity": "sha512-bho94YyReb4JV7LYWRWxZ/xr6TtOTt8cMfmQ39MQYJ7f/YE268s3GdghGwi+y4zAeqewE5zYLvuhV0M0ijsDEA==", + "dev": true, + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1927,6 +2123,18 @@ "node": ">=0.12.0" } }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -1994,6 +2202,111 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/lint-staged": { + "version": "15.2.7", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.2.7.tgz", + "integrity": "sha512-+FdVbbCZ+yoh7E/RosSdqKJyUM2OEjTciH0TFNkawKgvFp1zbGlEC39RADg+xKBG1R4mhoH2j85myBQZ5wR+lw==", + "dev": true, + "dependencies": { + "chalk": "~5.3.0", + "commander": "~12.1.0", + "debug": "~4.3.4", + "execa": "~8.0.1", + "lilconfig": "~3.1.1", + "listr2": "~8.2.1", + "micromatch": "~4.0.7", + "pidtree": "~0.6.0", + "string-argv": "~0.3.2", + "yaml": "~2.4.2" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/lint-staged/node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/lint-staged/node_modules/lilconfig": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", + "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/listr2": { + "version": "8.2.4", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.2.4.tgz", + "integrity": "sha512-opevsywziHd3zHCVQGAj8zu+Z3yHNkkoYhWIGnq54RrCVwLz0MozotJEDnKsIBLvkfLGN6BLOyAeRrYI0pKA4g==", + "dev": true, + "dependencies": { + "cli-truncate": "^4.0.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^6.1.0", + "rfdc": "^1.4.1", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/listr2/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "node_modules/listr2/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/lodash-es": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", @@ -2030,6 +2343,96 @@ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, + "node_modules/log-update": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", + "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==", + "dev": true, + "dependencies": { + "ansi-escapes": "^7.0.0", + "cli-cursor": "^5.0.0", + "slice-ansi": "^7.1.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==", + "dev": true + }, + "node_modules/log-update/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dev": true, + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-update/node_modules/wrap-ansi": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.0.tgz", + "integrity": "sha512-G8ura3S+3Z2G+mkgNRq8dqaFZAuxfsxpBB8OCTGRTCtp+l/v9nbFNmCUP1BZMts3G1142MsZfn6eeUKrr4PD1Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/lru-cache": { "version": "10.2.2", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", @@ -2048,6 +2451,12 @@ "@jridgewell/sourcemap-codec": "^1.4.15" } }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2091,6 +2500,30 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mimic-function": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz", + "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mini-svg-data-uri": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", @@ -2124,6 +2557,12 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/mz": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", @@ -2177,6 +2616,33 @@ "node": ">=0.10.0" } }, + "node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/nprogress": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", @@ -2210,6 +2676,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/package-json-from-dist": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", @@ -2265,6 +2746,18 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -2445,6 +2938,21 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true }, + "node_modules/prettier": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -2530,6 +3038,37 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/restore-cursor": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", + "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==", + "dev": true, + "dependencies": { + "onetime": "^7.0.0", + "signal-exit": "^4.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz", + "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==", + "dev": true, + "dependencies": { + "mimic-function": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -2540,6 +3079,12 @@ "node": ">=0.10.0" } }, + "node_modules/rfdc": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", + "dev": true + }, "node_modules/rollup": { "version": "4.18.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", @@ -2666,6 +3211,34 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/source-map-js": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", @@ -2675,6 +3248,15 @@ "node": ">=0.10.0" } }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, "node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -2771,6 +3353,18 @@ "node": ">=8" } }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/sucrase": { "version": "3.35.0", "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", diff --git a/package.json b/package.json index ae5f33d..d548964 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "type": "module", "scripts": { "dev": "vite", - "build": "vite build && vite build --ssr" + "build": "vite build && vite build --ssr", + "prepare": "husky" }, "devDependencies": { "@formkit/auto-animate": "^0.8.2", @@ -16,13 +17,20 @@ "axios": "^1.6.4", "flowbite": "^2.3.0", "flowbite-vue": "^0.1.5", + "husky": "^9.1.4", "laravel-vite-plugin": "^1.0", + "lint-staged": "^15.2.7", "postcss": "^8.4.32", + "prettier": "^3.3.3", "tailwindcss": "^3.4.0", "vite": "^5.0", "vue": "^3.3.13" }, "dependencies": { "dayjs": "^1.11.11" + }, + "lint-staged": { + "*.{js,vue,css,md,json}": "prettier --write", + "*.php": "vendor/bin/pint" } } diff --git a/routes/api.php b/routes/api.php index 39ef222..7cce316 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,9 +1,8 @@ '/v0', 'middleware' => ['auth:sanctum']], function () { - Route::post("/services/{service}/deploy", [ServiceController::class, 'deploy'])->middleware('ability:services:deploy'); + Route::post('/services/{service}/deploy', [ServiceController::class, 'deploy'])->middleware('ability:services:deploy'); }); diff --git a/routes/web.php b/routes/web.php index 76e9a9c..8625c98 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,10 +36,10 @@ Route::post('/node-task-groups/{taskGroup}/retry', [NodeTaskGroupController::class, 'retry'])->name('node-task-groups.retry'); - Route::resource("nodes", NodeController::class); + Route::resource('nodes', NodeController::class); Route::post('/nodes/{node}/upgrade-agent', [NodeController::class, 'upgradeAgent'])->name('nodes.upgrade-agent'); - Route::resource("services", ServiceController::class); + Route::resource('services', ServiceController::class); Route::get('/services/{service}/deployments', [ServiceController::class, 'deployments'])->name('services.deployments'); Route::post('/services/{service}/deployments', [ServiceController::class, 'deploy'])->name('services.deploy'); diff --git a/tests/Feature/Deployments/DeploymentsTest.php b/tests/Feature/Deployments/DeploymentsTest.php index 2431282..faa23a6 100644 --- a/tests/Feature/Deployments/DeploymentsTest.php +++ b/tests/Feature/Deployments/DeploymentsTest.php @@ -7,7 +7,6 @@ use App\Models\User; use Illuminate\Database\Eloquent\Casts\Json; - describe('Secret Vars', function () { describe('Deployment Data', function () { beforeEach(function () { @@ -69,8 +68,8 @@ 'secretVars' => DeploymentData\SecretVars::from([ 'vars' => [ new DeploymentData\EnvVar('foo', 'var'), - ] - ]) + ], + ]), ])); $deployment = $this->service->deploy(DeploymentData::make([ @@ -78,8 +77,8 @@ 'vars' => [ new DeploymentData\EnvVar('foo', 'var'), new DeploymentData\EnvVar('bar', 'var'), - ] - ]) + ], + ]), ])); expect($deployment->data->secretVars->dockerName)->toEqual("svc_{$this->service->id}_dpl_{$deployment->id}_secret_vars"); @@ -148,8 +147,8 @@ 'secretVars' => DeploymentData\SecretVars::from([ 'vars' => [ new DeploymentData\EnvVar('foo', null), - ] - ]) + ], + ]), ])); $task = $deployment->taskGroup->tasks()->where('type', NodeTaskType::UpdateService)->sole(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 1489387..ee63ad0 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,7 +4,4 @@ use Illuminate\Foundation\Testing\TestCase as BaseTestCase; -abstract class TestCase extends BaseTestCase -{ - -} +abstract class TestCase extends BaseTestCase {} diff --git a/tests/Unit/Util/ArraysTest.php b/tests/Unit/Util/ArraysTest.php index 7a472b7..edda33d 100644 --- a/tests/Unit/Util/ArraysTest.php +++ b/tests/Unit/Util/ArraysTest.php @@ -2,24 +2,24 @@ describe('niceMerge', function () { test('merges numeric arrays', function () { - $result = \App\Util\Arrays::niceMerge([1,2,3], [4,5,6]); + $result = \App\Util\Arrays::niceMerge([1, 2, 3], [4, 5, 6]); - expect($result)->toEqual([1,2,3,4,5,6]); + expect($result)->toEqual([1, 2, 3, 4, 5, 6]); }); test('merges associative arrays', function () { $result = \App\Util\Arrays::niceMerge([ 'hello' => 'world', - 'non-matching key array 1' => 'from array 1' + 'non-matching key array 1' => 'from array 1', ], [ 'hello' => 'universe', - 'from array 2' => 'non-matching value array 2' + 'from array 2' => 'non-matching value array 2', ]); expect($result)->toEqual([ 'hello' => 'universe', 'non-matching key array 1' => 'from array 1', - 'from array 2' => 'non-matching value array 2' + 'from array 2' => 'non-matching value array 2', ]); }); @@ -40,7 +40,7 @@ 'hello' => 'universe', 'nested key from array 2' => 'non-matching value from array 2', 'list' => [4, 5, 6], - ] + ], ]); expect($result)->toEqual([