Merge branch 'pelican-dev:main' into feature/node-sftp-alias

This commit is contained in:
Boy132 2024-06-05 08:47:20 +02:00 committed by GitHub
commit 328e159c6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 35 additions and 23 deletions

View File

@ -118,7 +118,7 @@ class AppSettingsCommand extends Command
} }
if ($this->variables['QUEUE_CONNECTION'] !== 'sync') { if ($this->variables['QUEUE_CONNECTION'] !== 'sync') {
Artisan::call('p:environment:queue-service', [ $this->call('p:environment:queue-service', [
'--use-redis' => $redisUsed, '--use-redis' => $redisUsed,
]); ]);
} }

View File

@ -98,7 +98,7 @@ class DatabaseSettingsCommand extends Command
} elseif ($this->variables['DB_CONNECTION'] === 'sqlite') { } elseif ($this->variables['DB_CONNECTION'] === 'sqlite') {
$this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask( $this->variables['DB_DATABASE'] = $this->option('database') ?? $this->ask(
'Database Path', 'Database Path',
config('database.connections.sqlite.database', database_path('database.sqlite')) config('database.connections.sqlite.database', 'database.sqlite')
); );
} }

View File

@ -19,17 +19,18 @@ class QueueWorkerServiceCommand extends Command
public function handle(): void 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'; $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?')) { $fileExists = file_exists($path);
$this->line('Creation of queue worker service file aborted.'); 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; return;
} }
$user = $this->option('user') ?? $this->ask('User', 'www-data'); $user = $this->option('user') ?? $this->ask('Webserver User', 'www-data');
$group = $this->option('group') ?? $this->ask('Group', 'www-data'); $group = $this->option('group') ?? $this->ask('Webserver Group', 'www-data');
$afterRedis = $this->option('use-redis') ? '\nAfter=redis-server.service' : ''; $afterRedis = $this->option('use-redis') ? '\nAfter=redis-server.service' : '';
@ -45,7 +46,7 @@ Description=Pelican Queue Service$afterRedis
User=$user User=$user
Group=$group Group=$group
Restart=always 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 StartLimitInterval=180
StartLimitBurst=30 StartLimitBurst=30
RestartSec=5s RestartSec=5s
@ -60,13 +61,24 @@ WantedBy=multi-user.target
return; return;
} }
$result = Process::run("systemctl enable --now $serviceName.service"); if ($fileExists) {
if ($result->failed()) { $result = Process::run("systemctl restart $serviceName.service");
$this->error('Error enabling service: ' . $result->errorOutput()); 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.');
} }
} }

View File

@ -30,7 +30,7 @@ class MakeUserCommand extends Command
public function handle(): int public function handle(): int
{ {
try { try {
DB::select('select 1 where 1'); DB::connection()->getPdo();
} catch (Exception $exception) { } catch (Exception $exception) {
$this->error($exception->getMessage()); $this->error($exception->getMessage());

View File

@ -532,7 +532,6 @@ class EditServer extends EditRecord
$text = Forms\Components\TextInput::make('variable_value') $text = Forms\Components\TextInput::make('variable_value')
->hidden($this->shouldHideComponent(...)) ->hidden($this->shouldHideComponent(...))
->maxLength(191)
->rules([ ->rules([
fn (ServerVariable $serverVariable): Closure => function (string $attribute, $value, Closure $fail) use ($serverVariable) { fn (ServerVariable $serverVariable): Closure => function (string $attribute, $value, Closure $fail) use ($serverVariable) {
$validator = Validator::make(['validatorkey' => $value], [ $validator = Validator::make(['validatorkey' => $value], [

View File

@ -40,7 +40,7 @@ const ModalContent = ({ ...props }: RequiredModalProps) => {
label={'Ignored Files & Directories'} label={'Ignored Files & Directories'}
description={` description={`
Enter the files or folders to ignore while generating this backup. Leave blank to use 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 Wildcard matching of files and folders is supported in addition to negating a rule by
prefixing the path with an exclamation point. prefixing the path with an exclamation point.
`} `}

View File

@ -91,13 +91,14 @@ export default () => {
<FileManagerBreadcrumbs withinFileEditor isNewFile={action !== 'edit'} /> <FileManagerBreadcrumbs withinFileEditor isNewFile={action !== 'edit'} />
</div> </div>
</ErrorBoundary> </ErrorBoundary>
{hash.replace(/^#/, '').endsWith('.panelignore') && ( {hash.replace(/^#/, '').endsWith('.pelicanignore') && (
<div css={tw`mb-4 p-4 border-l-4 bg-neutral-900 rounded border-cyan-400`}> <div css={tw`mb-4 p-4 border-l-4 bg-neutral-900 rounded border-cyan-400`}>
<p css={tw`text-neutral-300 text-sm`}> <p css={tw`text-neutral-300 text-sm`}>
You&apos;re editing a <code css={tw`font-mono bg-black rounded py-px px-1`}>.panelignore</code>{' '} You&apos;re editing a{' '}
file. Any files or directories listed in here will be excluded from backups. Wildcards are <code css={tw`font-mono bg-black rounded py-px px-1`}>.pelicanignore</code> directories listed
supported by using an asterisk (<code css={tw`font-mono bg-black rounded py-px px-1`}>*</code>). in here will be excluded from backups. Wildcards are supported by using an supported by using an
You can negate a prior rule by prepending an exclamation point ( asterisk (<code css={tw`font-mono bg-black rounded py-px px-1`}>*</code>). You can negate a
prior rule by prepending an exclamation point (
<code css={tw`font-mono bg-black rounded py-px px-1`}>!</code>). <code css={tw`font-mono bg-black rounded py-px px-1`}>!</code>).
</p> </p>
</div> </div>

View File

@ -168,7 +168,7 @@ const TaskDetailsModal = ({ schedule, task }: Props) => {
<FormikFieldWrapper <FormikFieldWrapper
name={'payload'} name={'payload'}
description={ description={
'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .panelignore file will be used. If you have reached your backup limit, the oldest backup will be rotated.' 'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pelicanignore file will be used. If you have reached your backup limit, the oldest backup will be rotated.'
} }
> >
<FormikField as={Textarea} name={'payload'} rows={6} /> <FormikField as={Textarea} name={'payload'} rows={6} />