- When you restart the proxy on an instance domain, the proxy stops and is removed, but never restarted. So you loose access over the domain and have to go in over IP and Port. This is because we are doing the restart directly in the UI instead of in the background via a job, and the proxy is serving the UI domain.
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Jobs;
 | 
						|
 | 
						|
use App\Actions\Proxy\CheckProxy;
 | 
						|
use App\Actions\Proxy\StartProxy;
 | 
						|
use App\Actions\Proxy\StopProxy;
 | 
						|
use App\Models\Server;
 | 
						|
use Illuminate\Bus\Queueable;
 | 
						|
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
 | 
						|
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
						|
use Illuminate\Foundation\Bus\Dispatchable;
 | 
						|
use Illuminate\Queue\InteractsWithQueue;
 | 
						|
use Illuminate\Queue\Middleware\WithoutOverlapping;
 | 
						|
use Illuminate\Queue\SerializesModels;
 | 
						|
 | 
						|
class RestartProxyJob implements ShouldBeEncrypted, ShouldQueue
 | 
						|
{
 | 
						|
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 | 
						|
 | 
						|
    public $tries = 1;
 | 
						|
 | 
						|
    public $timeout = 60;
 | 
						|
 | 
						|
    public function middleware(): array
 | 
						|
    {
 | 
						|
        return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
 | 
						|
    }
 | 
						|
 | 
						|
    public function __construct(public Server $server) {}
 | 
						|
 | 
						|
    public function handle()
 | 
						|
    {
 | 
						|
        try {
 | 
						|
            StopProxy::run($this->server);
 | 
						|
 | 
						|
            $this->server->proxy->force_stop = false;
 | 
						|
            $this->server->save();
 | 
						|
            StartProxy::run($this->server, force: true);
 | 
						|
 | 
						|
            CheckProxy::run($this->server, true);
 | 
						|
        } catch (\Throwable $e) {
 | 
						|
            return handleError($e);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |