update
This commit is contained in:
parent
f6344b0aad
commit
19ef66abd4
2 changed files with 19 additions and 1 deletions
|
@ -82,6 +82,10 @@ class PhyreServerResource extends Resource
|
||||||
->action(function ($record) {
|
->action(function ($record) {
|
||||||
$record->healthCheck();
|
$record->healthCheck();
|
||||||
}),
|
}),
|
||||||
|
Tables\Actions\Action::make('Update Server')
|
||||||
|
->action(function ($record) {
|
||||||
|
$record->updateServer();
|
||||||
|
}),
|
||||||
Tables\Actions\Action::make('Sync Resources')
|
Tables\Actions\Action::make('Sync Resources')
|
||||||
->action(function ($record) {
|
->action(function ($record) {
|
||||||
$record->syncResources();
|
$record->syncResources();
|
||||||
|
|
|
@ -6,6 +6,7 @@ use App\ApiSDK\PhyreApiSDK;
|
||||||
use App\Events\ModelPhyreServerCreated;
|
use App\Events\ModelPhyreServerCreated;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use phpseclib3\Net\SSH2;
|
||||||
|
|
||||||
class PhyreServer extends Model
|
class PhyreServer extends Model
|
||||||
{
|
{
|
||||||
|
@ -79,7 +80,7 @@ class PhyreServer extends Model
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // Sync Hosting Plans
|
// // Sync Hosting Plans
|
||||||
// $getHostingPlans = HostingPlan::all();
|
// $getHostingPlans = HostingPlan::all();
|
||||||
|
@ -90,6 +91,19 @@ class PhyreServer extends Model
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateServer()
|
||||||
|
{
|
||||||
|
$ssh = new SSH2($this->ip);
|
||||||
|
if ($ssh->login($this->username, $this->password)) {
|
||||||
|
|
||||||
|
$output = $ssh->exec('rm -rf /usr/local/phyre/update/update-web-panel.sh');
|
||||||
|
$output = $ssh->exec('cd /usr/local/phyre/update && wget https://raw.githubusercontent.com/CloudVisionApps/PhyrePanel/main/update/update-web-panel.sh');
|
||||||
|
$output = $ssh->exec('chmod +x /usr/local/phyre/update/update-web-panel.sh');
|
||||||
|
$output = $ssh->exec('cd /usr/local/phyre/update && ./update-web-panel.sh');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function healthCheck()
|
public function healthCheck()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue