From 29cc92f0dc1b535f1fd2eff4bf17a83bbd23dc56 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 08:33:54 +0200 Subject: [PATCH 1/9] replace db check in MakeUserCommand --- app/Console/Commands/User/MakeUserCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/User/MakeUserCommand.php b/app/Console/Commands/User/MakeUserCommand.php index 53082e324..20de2ec20 100644 --- a/app/Console/Commands/User/MakeUserCommand.php +++ b/app/Console/Commands/User/MakeUserCommand.php @@ -30,7 +30,7 @@ class MakeUserCommand extends Command public function handle(): int { try { - DB::select('select 1 where 1'); + DB::connection()->getPdo(); } catch (Exception $exception) { $this->error($exception->getMessage()); From 201563a13b4764cdd5bee8f9a64f2a19f720f071 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 11:20:40 +0200 Subject: [PATCH 2/9] remove maxLength from variable_value input --- app/Filament/Resources/ServerResource/Pages/EditServer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Filament/Resources/ServerResource/Pages/EditServer.php b/app/Filament/Resources/ServerResource/Pages/EditServer.php index 932610d59..ec93fa9c6 100644 --- a/app/Filament/Resources/ServerResource/Pages/EditServer.php +++ b/app/Filament/Resources/ServerResource/Pages/EditServer.php @@ -532,7 +532,6 @@ class EditServer extends EditRecord $text = Forms\Components\TextInput::make('variable_value') ->hidden($this->shouldHideComponent(...)) - ->maxLength(191) ->rules([ fn (ServerVariable $serverVariable): Closure => function (string $attribute, $value, Closure $fail) use ($serverVariable) { $validator = Validator::make(['validatorkey' => $value], [ From cff54f1969f489edc0e69e3dd9d8f040320c8f67 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 13:01:24 +0200 Subject: [PATCH 3/9] show output when running `p:environment:queue-service` --- app/Console/Commands/Environment/AppSettingsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/Environment/AppSettingsCommand.php b/app/Console/Commands/Environment/AppSettingsCommand.php index a1d272837..4f2e93119 100644 --- a/app/Console/Commands/Environment/AppSettingsCommand.php +++ b/app/Console/Commands/Environment/AppSettingsCommand.php @@ -118,7 +118,7 @@ class AppSettingsCommand extends Command } if ($this->variables['QUEUE_CONNECTION'] !== 'sync') { - Artisan::call('p:environment:queue-service', [ + $this->call('p:environment:queue-service', [ '--use-redis' => $redisUsed, ]); } From d81c9faac60a57c2548422bd9966c7d20b1a99aa Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 13:01:52 +0200 Subject: [PATCH 4/9] improve prompts --- .../Commands/Environment/QueueWorkerServiceCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index 49d4cbfec..3fe3da4c9 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -19,7 +19,7 @@ class QueueWorkerServiceCommand extends Command public function handle(): void { - $serviceName = $this->option('service-name') ?? $this->ask('Service name', 'pelican-queue'); + $serviceName = $this->option('service-name') ?? $this->ask('Queue worker Service name', 'pelican-queue'); $path = '/etc/systemd/system/' . $serviceName . '.service'; if (file_exists($path) && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { @@ -28,8 +28,8 @@ class QueueWorkerServiceCommand extends Command return; } - $user = $this->option('user') ?? $this->ask('User', 'www-data'); - $group = $this->option('group') ?? $this->ask('Group', 'www-data'); + $user = $this->option('user') ?? $this->ask('Webserver User', 'www-data'); + $group = $this->option('group') ?? $this->ask('Webserver Group', 'www-data'); $afterRedis = $this->option('use-redis') ? '\nAfter=redis-server.service' : ''; From 07282668264265f5478dd0916565fd3d659eeac4 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 13:14:54 +0200 Subject: [PATCH 5/9] restart queue service if service already exists --- .../Environment/QueueWorkerServiceCommand.php | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index 3fe3da4c9..68f2c6750 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -19,11 +19,12 @@ class QueueWorkerServiceCommand extends Command public function handle(): void { - $serviceName = $this->option('service-name') ?? $this->ask('Queue worker Service name', 'pelican-queue'); + $serviceName = $this->option('service-name') ?? $this->ask('Queue worker service name', 'pelican-queue'); $path = '/etc/systemd/system/' . $serviceName . '.service'; - if (file_exists($path) && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { - $this->line('Creation of queue worker service file aborted.'); + $fileExists = file_exists($path); + if ($fileExists && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) { + $this->line('Creation of queue worker service file aborted because serive file already exists.'); return; } @@ -60,13 +61,24 @@ WantedBy=multi-user.target return; } - $result = Process::run("systemctl enable --now $serviceName.service"); - if ($result->failed()) { - $this->error('Error enabling service: ' . $result->errorOutput()); + if ($fileExists) { + $result = Process::run("systemctl restart $serviceName.service"); + if ($result->failed()) { + $this->error('Error restarting service: ' . $result->errorOutput()); - return; + return; + } + + $this->line('Queue worker service file updated successfully.'); + } else { + $result = Process::run("systemctl enable --now $serviceName.service"); + if ($result->failed()) { + $this->error('Error enabling service: ' . $result->errorOutput()); + + return; + } + + $this->line('Queue worker service file created successfully.'); } - - $this->line('Queue worker service file created successfully.'); } } From 1c66681c0e04d4bc36b8d3b0606df1b7e8b70604 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 13:26:05 +0200 Subject: [PATCH 6/9] make default sqlite database path relative --- app/Console/Commands/Environment/DatabaseSettingsCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/Environment/DatabaseSettingsCommand.php b/app/Console/Commands/Environment/DatabaseSettingsCommand.php index e9369a965..b06671f54 100644 --- a/app/Console/Commands/Environment/DatabaseSettingsCommand.php +++ b/app/Console/Commands/Environment/DatabaseSettingsCommand.php @@ -98,7 +98,7 @@ class DatabaseSettingsCommand extends Command } elseif ($this->variables['DB_CONNECTION'] === 'sqlite') { $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( 'Database Path', - config('database.connections.sqlite.database', database_path('database.sqlite')) + config('database.connections.sqlite.database', 'database.sqlite') ); } From bb03ddda5040f826cd3bcb6d4e863e27a7783645 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 17:26:19 +0200 Subject: [PATCH 7/9] listen on all queues --- app/Console/Commands/Environment/QueueWorkerServiceCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php index 68f2c6750..93fe6223f 100644 --- a/app/Console/Commands/Environment/QueueWorkerServiceCommand.php +++ b/app/Console/Commands/Environment/QueueWorkerServiceCommand.php @@ -46,7 +46,7 @@ Description=Pelican Queue Service$afterRedis User=$user Group=$group Restart=always -ExecStart=/usr/bin/php $basePath/artisan queue:work --queue=high,standard,low --tries=3 +ExecStart=/usr/bin/php $basePath/artisan queue:work --tries=3 StartLimitInterval=180 StartLimitBurst=30 RestartSec=5s From 91d8dbd084ac51b8429cf08c67aa2e673b7528de Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 17:48:02 +0200 Subject: [PATCH 8/9] replace `panelignore` with `pelicanignore` --- .../scripts/components/server/backups/CreateBackupButton.tsx | 2 +- .../scripts/components/server/files/FileEditContainer.tsx | 4 ++-- .../scripts/components/server/schedules/TaskDetailsModal.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/scripts/components/server/backups/CreateBackupButton.tsx b/resources/scripts/components/server/backups/CreateBackupButton.tsx index d0cb98fd5..9dded0f79 100644 --- a/resources/scripts/components/server/backups/CreateBackupButton.tsx +++ b/resources/scripts/components/server/backups/CreateBackupButton.tsx @@ -40,7 +40,7 @@ const ModalContent = ({ ...props }: RequiredModalProps) => { label={'Ignored Files & Directories'} description={` Enter the files or folders to ignore while generating this backup. Leave blank to use - the contents of the .panelignore file in the root of the server directory if present. + the contents of the .pelicanignore file in the root of the server directory if present. Wildcard matching of files and folders is supported in addition to negating a rule by prefixing the path with an exclamation point. `} diff --git a/resources/scripts/components/server/files/FileEditContainer.tsx b/resources/scripts/components/server/files/FileEditContainer.tsx index b0c7546a1..117412698 100644 --- a/resources/scripts/components/server/files/FileEditContainer.tsx +++ b/resources/scripts/components/server/files/FileEditContainer.tsx @@ -91,10 +91,10 @@ export default () => { - {hash.replace(/^#/, '').endsWith('.panelignore') && ( + {hash.replace(/^#/, '').endsWith('.pelicanignore') && (

- You're editing a .panelignore{' '} + You're editing a .pelicanignore{' '} file. Any files or directories listed in here will be excluded from backups. Wildcards are supported by using an asterisk (*). You can negate a prior rule by prepending an exclamation point ( diff --git a/resources/scripts/components/server/schedules/TaskDetailsModal.tsx b/resources/scripts/components/server/schedules/TaskDetailsModal.tsx index 578c207c0..6dcd9e932 100644 --- a/resources/scripts/components/server/schedules/TaskDetailsModal.tsx +++ b/resources/scripts/components/server/schedules/TaskDetailsModal.tsx @@ -168,7 +168,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => { From d996019204e560b73c00975c295e5d788e00f8f8 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 4 Jun 2024 17:49:04 +0200 Subject: [PATCH 9/9] fix eslint --- .../components/server/files/FileEditContainer.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/scripts/components/server/files/FileEditContainer.tsx b/resources/scripts/components/server/files/FileEditContainer.tsx index 117412698..83a3dde66 100644 --- a/resources/scripts/components/server/files/FileEditContainer.tsx +++ b/resources/scripts/components/server/files/FileEditContainer.tsx @@ -94,10 +94,11 @@ export default () => { {hash.replace(/^#/, '').endsWith('.pelicanignore') && (

- You're editing a .pelicanignore{' '} - file. Any files or directories listed in here will be excluded from backups. Wildcards are - supported by using an asterisk (*). - You can negate a prior rule by prepending an exclamation point ( + You're editing a{' '} + .pelicanignore directories listed + in here will be excluded from backups. Wildcards are supported by using an supported by using an + asterisk (*). You can negate a + prior rule by prepending an exclamation point ( !).