diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index a09ebeada..ed9694536 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -318,10 +318,15 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted private function backup_standalone_mongodb(string $databaseWithCollections): void { try { + ray($this->database->toArray()); $url = $this->database->get_db_url(useInternal: true); if ($databaseWithCollections === 'all') { $commands[] = "mkdir -p " . $this->backup_dir; - $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --gzip --archive > $this->backup_location"; + if (str($this->database->image)->startsWith('mongo:4.0')) { + $commands[] = "docker exec $this->container_name mongodump --uri=$url --gzip --archive > $this->backup_location"; + } else { + $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --gzip --archive > $this->backup_location"; + } } else { if (str($databaseWithCollections)->contains(':')) { $databaseName = str($databaseWithCollections)->before(':'); @@ -332,9 +337,17 @@ class DatabaseBackupJob implements ShouldQueue, ShouldBeEncrypted } $commands[] = "mkdir -p " . $this->backup_dir; if ($collectionsToExclude->count() === 0) { - $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --db $databaseName --gzip --archive > $this->backup_location"; + if (str($this->database->image)->startsWith('mongo:4.0')) { + $commands[] = "docker exec $this->container_name mongodump --uri=$url --gzip --archive > $this->backup_location"; + } else { + $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --db $databaseName --gzip --archive > $this->backup_location"; + } } else { - $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --db $databaseName --gzip --excludeCollection " . $collectionsToExclude->implode(' --excludeCollection ') . " --archive > $this->backup_location"; + if (str($this->database->image)->startsWith('mongo:4.0')) { + $commands[] = "docker exec $this->container_name mongodump --uri=$url --gzip --excludeCollection " . $collectionsToExclude->implode(' --excludeCollection ') . " --archive > $this->backup_location"; + } else { + $commands[] = "docker exec $this->container_name mongodump --authenticationDatabase=admin --uri=$url --db $databaseName --gzip --excludeCollection " . $collectionsToExclude->implode(' --excludeCollection ') . " --archive > $this->backup_location"; + } } } $this->backup_output = instant_remote_process($commands, $this->server); diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php index 996131f37..e14cd6113 100644 --- a/app/Livewire/Project/Shared/GetLogs.php +++ b/app/Livewire/Project/Shared/GetLogs.php @@ -91,15 +91,35 @@ class GetLogs extends Component if ($this->container) { if ($this->showTimeStamps) { if ($this->server->isSwarm()) { - $sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} -t {$this->container}"); + $command = "docker service logs -n {$this->numberOfLines} -t {$this->container}"; + if ($this->server->isNonRoot()) { + $command = parseCommandsByLineForSudo(collect($command), $this->server); + $command = $command[0]; + } + $sshCommand = generateSshCommand($this->server, $command); } else { - $sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}"); + $command = "docker logs -n {$this->numberOfLines} -t {$this->container}"; + if ($this->server->isNonRoot()) { + $command = parseCommandsByLineForSudo(collect($command), $this->server); + $command = $command[0]; + } + $sshCommand = generateSshCommand($this->server, $command); } } else { if ($this->server->isSwarm()) { - $sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} {$this->container}"); + $command = "docker service logs -n {$this->numberOfLines} {$this->container}"; + if ($this->server->isNonRoot()) { + $command = parseCommandsByLineForSudo(collect($command), $this->server); + $command = $command[0]; + } + $sshCommand = generateSshCommand($this->server, $command); } else { - $sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}"); + $command = "docker logs -n {$this->numberOfLines} {$this->container}"; + if ($this->server->isNonRoot()) { + $command = parseCommandsByLineForSudo(collect($command), $this->server); + $command = $command[0]; + } + $sshCommand = generateSshCommand($this->server, $command); } } if ($refresh) { diff --git a/app/Livewire/Storage/Create.php b/app/Livewire/Storage/Create.php index d1af807d5..1b2510f5d 100644 --- a/app/Livewire/Storage/Create.php +++ b/app/Livewire/Storage/Create.php @@ -16,13 +16,13 @@ class Create extends Component public string $endpoint; public S3Storage $storage; protected $rules = [ - 'name' => 'nullable|min:3|max:255', + 'name' => 'required|min:3|max:255', 'description' => 'nullable|min:3|max:255', 'region' => 'required|max:255', 'key' => 'required|max:255', 'secret' => 'required|max:255', 'bucket' => 'required|max:255', - 'endpoint' => 'nullable|url|max:255', + 'endpoint' => 'required|url|max:255', ]; protected $validationAttributes = [ 'name' => 'Name', diff --git a/config/constants.php b/config/constants.php index 091c60996..53f43ae5a 100644 --- a/config/constants.php +++ b/config/constants.php @@ -32,6 +32,7 @@ return [ 'basic' => env('LIMIT_SERVER_BASIC', 2), 'pro' => env('LIMIT_SERVER_PRO', 10), 'ultimate' => env('LIMIT_SERVER_ULTIMATE', 25), + 'dynamic' => env('LIMIT_SERVER_DYNAMIC', 2), ], 'email' => [ 'zero' => true, @@ -39,6 +40,7 @@ return [ 'basic' => true, 'pro' => true, 'ultimate' => true, + 'dynamic' => true, ], ], ]; diff --git a/config/sentry.php b/config/sentry.php index 75705bd93..6629fefab 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.272', + 'release' => '4.0.0-beta.273', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index cf5c01c23..a5706892f 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Dashboard