Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: get logs with non-root user

Andras Bacsaife22dfc531bd
diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.php
index 996131f374..e14cd6113a 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) {