lasthourcloud/app/Actions/Server/InstallDocker.php

25 lines
658 B
PHP
Raw Normal View History

2023-05-04 07:11:11 +00:00
<?php
namespace App\Actions\Server;
use App\Enums\ActivityTypes;
use App\Models\Server;
class InstallDocker
{
public function __invoke(Server $server)
{
$config = base64_encode('{ "live-restore": true }');
2023-05-24 13:25:08 +00:00
$activity = remote_process([
2023-05-04 07:11:11 +00:00
"echo Installing Docker...",
"curl https://releases.rancher.com/install-docker/23.0.sh | sh",
"echo Configuring Docker...",
"echo '{$config}' | base64 -d > /etc/docker/daemon.json",
"echo Restarting Docker...",
"systemctl restart docker"
], $server, ActivityTypes::INLINE->value);
return $activity;
}
}