use same args for remoteProcess and instantRemoteProcess

This commit is contained in:
Andras Bacsai
2023-05-03 09:38:53 +02:00
parent 3e475d87eb
commit ad671cfcf1
7 changed files with 27 additions and 18 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Livewire\Server;
use App\Enums\ActivityTypes;
use App\Models\Server;
use Illuminate\Support\Facades\Validator;
use Livewire\Component;
@@ -28,15 +29,22 @@ class Form extends Component
public function installDocker()
{
$config = base64_encode('{ "live-restore": true }');
instantRemoteProcess($this->server, [
"curl https://releases.rancher.com/install-docker/23.0.sh | sh"
]);
remoteProcess([
"curl https://releases.rancher.com/install-docker/23.0.sh | sh",
"echo '{$config}' | base64 -d > /etc/docker/daemon.json",
"systemctl restart docker"
], $this->server, ActivityTypes::INLINE->value);
}
public function checkServer()
{
$this->uptime = instantRemoteProcess($this->server, ['uptime']);
$this->dockerVersion = instantRemoteProcess($this->server, ['docker version|head -2|grep -i version'], false);
$this->dockerComposeVersion = instantRemoteProcess($this->server, ['docker compose version|head -2|grep -i version'], false);
try {
$this->uptime = instantRemoteProcess(['uptime'], $this->server);
$this->dockerVersion = instantRemoteProcess(['docker version|head -2|grep -i version'], $this->server, false);
$this->dockerComposeVersion = instantRemoteProcess(['docker compose version|head -2|grep -i version'], $this->server, false);
} catch (\Exception $e) {
$this->addError('server.ip', $e->getMessage());
}
}
public function submit()
{