mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-03 06:56:15 +00:00
Isolate Users (#431)
* WIP to isolate users * Resolved issue with SSH AsUser Updated Isolated User Script to use Server User for Team Access Updated Path creation script to simplify for running as the isolated user * Included the server user * PHPMyAdmin script updated Wordpress Script Updated Updated Execute Script to support executing as isolated users * Issue Resolution & Resolved Failing Unit Tests * Fix for isolated_username vs user * Run the deploy as the isolated user * queue updates for isolated user * Support isolated users in cronjobs * script tests for isolated users * Queue tests for isolated users * Cronjob tests for isolated user * Removed default queue command for laravel apps * add default user to factory * laravel pint fixes * ensure echos are consistent * removed unneeded parameter * update * fix queues for isolated users * revert addslashes --------- Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
@ -33,6 +33,8 @@ public function getWidgets(): array
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
$users = $this->server->getSshUsers();
|
||||
|
||||
return [
|
||||
Action::make('read-the-docs')
|
||||
->label('Read the Docs')
|
||||
@ -46,25 +48,22 @@ protected function getHeaderActions(): array
|
||||
->modalWidth(MaxWidth::ExtraLarge)
|
||||
->form([
|
||||
TextInput::make('command')
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get())['command'])
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get(), $this->server)['command'])
|
||||
->helperText(fn () => view('components.link', [
|
||||
'href' => 'https://vitodeploy.com/servers/cronjobs',
|
||||
'external' => true,
|
||||
'text' => 'How the command should look like?',
|
||||
])),
|
||||
Select::make('user')
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get())['user'])
|
||||
->options([
|
||||
'vito' => $this->server->ssh_user,
|
||||
'root' => 'root',
|
||||
]),
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get(), $this->server)['user'])
|
||||
->options(array_combine($users, $users)),
|
||||
Select::make('frequency')
|
||||
->options(config('core.cronjob_intervals'))
|
||||
->reactive()
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get())['frequency']),
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get(), $this->server)['frequency']),
|
||||
TextInput::make('custom')
|
||||
->label('Custom Frequency (Cron)')
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get())['custom'])
|
||||
->rules(fn (callable $get) => CreateCronJob::rules($get(), $this->server)['custom'])
|
||||
->visible(fn (callable $get) => $get('frequency') === 'custom')
|
||||
->placeholder('0 * * * *'),
|
||||
])
|
||||
|
@ -133,6 +133,13 @@ protected function getHeaderActions(): array
|
||||
->rules(fn (Get $get) => CreateSite::rules($this->server, $get())['version']),
|
||||
// WordPress
|
||||
$this->wordpressFields(),
|
||||
TextInput::make('user')
|
||||
->label('Username')
|
||||
->hintIcon('heroicon-o-information-circle')
|
||||
->hintIconTooltip(
|
||||
'Optional. If provided, a new user will be created and the site will be owned by this user.'
|
||||
)
|
||||
->rules(fn (Get $get) => CreateSite::rules($this->server, $get())['user']),
|
||||
])
|
||||
->action(function (array $data) {
|
||||
$this->authorize('create', [Site::class, $this->server]);
|
||||
|
@ -47,17 +47,17 @@ protected function getHeaderActions(): array
|
||||
->label('New Queue')
|
||||
->form([
|
||||
TextInput::make('command')
|
||||
->rules(CreateQueue::rules($this->server)['command'])
|
||||
->rules(CreateQueue::rules($this->site)['command'])
|
||||
->helperText('Example: php /home/vito/your-site/artisan queue:work'),
|
||||
Select::make('user')
|
||||
->rules(fn (callable $get) => CreateQueue::rules($this->server)['user'])
|
||||
->rules(fn (callable $get) => CreateQueue::rules($this->site)['user'])
|
||||
->options([
|
||||
'vito' => $this->server->ssh_user,
|
||||
'root' => 'root',
|
||||
$this->site->user => $this->site->user,
|
||||
]),
|
||||
TextInput::make('numprocs')
|
||||
->default(1)
|
||||
->rules(CreateQueue::rules($this->server)['numprocs'])
|
||||
->rules(CreateQueue::rules($this->site)['numprocs'])
|
||||
->helperText('Number of processes'),
|
||||
Grid::make()
|
||||
->schema([
|
||||
|
@ -50,6 +50,9 @@ public function infolist(Infolist $infolist): Infolist
|
||||
->inlineLabel()
|
||||
->hintIcon('heroicon-o-information-circle')
|
||||
->hintIconTooltip('Site unique identifier to use in the API'),
|
||||
TextEntry::make('user')
|
||||
->label('Site User')
|
||||
->inlineLabel(),
|
||||
TextEntry::make('created_at')
|
||||
->label('Created At')
|
||||
->formatStateUsing(fn ($record) => $record->created_at_by_timezone)
|
||||
|
Reference in New Issue
Block a user