fix
This commit is contained in:
@@ -2,21 +2,28 @@
|
||||
|
||||
namespace App\Actions\Server;
|
||||
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Models\Server;
|
||||
|
||||
class InstallDocker
|
||||
{
|
||||
public function __invoke(Server $server)
|
||||
{
|
||||
$dockerVersion = '23.0';
|
||||
$config = base64_encode('{ "live-restore": true }');
|
||||
$activity = remote_process([
|
||||
"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"
|
||||
"echo ####### Installing Prerequisites...",
|
||||
"command -v jq >/dev/null || apt-get update",
|
||||
"command -v jq >/dev/null || apt install -y jq",
|
||||
"echo ####### Installing/updating Docker Engine...",
|
||||
"curl https://releases.rancher.com/install-docker/{$dockerVersion}.sh | sh",
|
||||
"echo ####### Configuring Docker Engine (merging existing configuration with the required)...",
|
||||
"test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json \"/etc/docker/daemon.json.original-`date +\"%Y%m%d-%H%M%S\"`\" || echo '{$config}' | base64 -d > /etc/docker/daemon.json",
|
||||
"echo '{$config}' | base64 -d > /etc/docker/daemon.json.coolify",
|
||||
"cat <<< $(jq . /etc/docker/daemon.json.coolify) > /etc/docker/daemon.json.coolify",
|
||||
"cat <<< $(jq -s '.[0] * .[1]' /etc/docker/daemon.json /etc/docker/daemon.json.coolify) > /etc/docker/daemon.json",
|
||||
"echo ####### Restarting Docker Engine...",
|
||||
"systemctl restart docker",
|
||||
"echo ####### Done!"
|
||||
], $server);
|
||||
|
||||
return $activity;
|
||||
|
||||
@@ -39,16 +39,15 @@ class Form extends Component
|
||||
if (!$this->uptime) {
|
||||
$this->uptime = 'Server not reachable.';
|
||||
throw new \Exception('Server not reachable.');
|
||||
} else {
|
||||
if (!$this->server->settings->is_validated) {
|
||||
$this->server->settings->is_validated = true;
|
||||
$this->server->settings->save();
|
||||
$this->emit('serverValidated');
|
||||
}
|
||||
}
|
||||
$this->dockerVersion = instant_remote_process(['docker version|head -2|grep -i version'], $this->server, false);
|
||||
if (!$this->dockerVersion) {
|
||||
$this->dockerVersion = 'Not installed.';
|
||||
} else {
|
||||
$this->server->settings->is_docker_installed = true;
|
||||
$this->server->settings->is_validated = true;
|
||||
$this->server->settings->save();
|
||||
$this->emit('serverValidated');
|
||||
}
|
||||
$this->dockerComposeVersion = instant_remote_process(['docker compose version|head -2|grep -i version'], $this->server, false);
|
||||
if (!$this->dockerComposeVersion) {
|
||||
|
||||
@@ -35,6 +35,5 @@ class CoolifyTask implements ShouldQueue
|
||||
]);
|
||||
|
||||
$remote_process();
|
||||
// @TODO: Remove file at $this->activity->getExtraProperty('private_key_location') after process is finished
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class LocalPersistentVolume extends BaseModel
|
||||
class LocalPersistentVolume extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
||||
@@ -7,7 +7,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class ServerSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'server_id'
|
||||
'server_id',
|
||||
'is_docker_installed',
|
||||
];
|
||||
public function server()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user