fix: validation
This commit is contained in:
@@ -12,10 +12,12 @@ class Status extends Component
|
|||||||
|
|
||||||
public function get_status()
|
public function get_status()
|
||||||
{
|
{
|
||||||
|
if (data_get($this->server,'settings.is_usable')) {
|
||||||
dispatch_sync(new ProxyContainerStatusJob(
|
dispatch_sync(new ProxyContainerStatusJob(
|
||||||
server: $this->server
|
server: $this->server
|
||||||
));
|
));
|
||||||
$this->server->refresh();
|
$this->server->refresh();
|
||||||
$this->emit('proxyStatusUpdated');
|
$this->emit('proxyStatusUpdated');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Storage;
|
|||||||
use Illuminate\Support\Sleep;
|
use Illuminate\Support\Sleep;
|
||||||
use Spatie\Activitylog\Models\Activity;
|
use Spatie\Activitylog\Models\Activity;
|
||||||
|
|
||||||
/**
|
|
||||||
* Run a Remote Process, which SSH's asynchronously into a machine to run the command(s).
|
|
||||||
* @TODO Change 'root' to 'coolify' when it's able to run Docker commands without sudo
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function remote_process(
|
function remote_process(
|
||||||
array $command,
|
array $command,
|
||||||
Server $server,
|
Server $server,
|
||||||
@@ -167,17 +162,23 @@ function validateServer(Server $server)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
refresh_server_connection($server->privateKey);
|
refresh_server_connection($server->privateKey);
|
||||||
$uptime = instant_remote_process(['uptime'], $server);
|
$uptime = instant_remote_process(['uptime'], $server, false);
|
||||||
if (!$uptime) {
|
if (!$uptime) {
|
||||||
$uptime = 'Server not reachable.';
|
$server->settings->is_reachable = false;
|
||||||
throw new \Exception('Server not reachable.');
|
return [
|
||||||
|
"uptime" => null,
|
||||||
|
"dockerVersion" => null,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$server->settings->is_reachable = true;
|
$server->settings->is_reachable = true;
|
||||||
|
|
||||||
$dockerVersion = instant_remote_process(['docker version|head -2|grep -i version'], $server, false);
|
$dockerVersion = instant_remote_process(['docker version|head -2|grep -i version'], $server, false);
|
||||||
if (!$dockerVersion) {
|
if (!$dockerVersion) {
|
||||||
$dockerVersion = 'Not installed.';
|
$dockerVersion = null;
|
||||||
throw new \Exception('Docker not installed.');
|
return [
|
||||||
|
"uptime" => $uptime,
|
||||||
|
"dockerVersion" => null,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
$server->settings->is_usable = true;
|
$server->settings->is_usable = true;
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user