Merge remote-tracking branch 'origin/v4-next' into patricio-deploy-proxy

This commit is contained in:
Joao Patricio
2023-05-03 09:32:09 +01:00
13 changed files with 64 additions and 42 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,30 @@ 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, false);
if (!$this->uptime) {
$this->uptime = 'Server not reachable.';
throw new \Exception('Server not reachable.');
}
$this->dockerVersion = instantRemoteProcess(['docker version|head -2|grep -i version'], $this->server, false);
if (!$this->dockerVersion) {
$this->dockerVersion = 'Not installed.';
}
$this->dockerComposeVersion = instantRemoteProcess(['docker compose version|head -2|grep -i version'], $this->server, false);
if (!$this->dockerComposeVersion) {
$this->dockerComposeVersion = 'Not installed.';
}
} catch (\Exception $e) {
}
}
public function submit()
{