2023-06-02 13:15:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Server\Proxy;
|
|
|
|
|
2023-07-14 11:38:24 +00:00
|
|
|
use App\Actions\Proxy\StartProxy;
|
2023-06-02 13:15:12 +00:00
|
|
|
use App\Models\Server;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Deploy extends Component
|
|
|
|
{
|
|
|
|
public Server $server;
|
|
|
|
public $proxy_settings = null;
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-07-28 12:44:26 +00:00
|
|
|
public function start_proxy()
|
2023-06-02 13:15:12 +00:00
|
|
|
{
|
|
|
|
if (
|
2023-06-20 18:19:31 +00:00
|
|
|
$this->server->proxy->last_applied_settings &&
|
|
|
|
$this->server->proxy->last_saved_settings !== $this->server->proxy->last_applied_settings
|
2023-06-02 13:15:12 +00:00
|
|
|
) {
|
2023-07-28 19:36:19 +00:00
|
|
|
$this->emit('saveConfiguration', $server);
|
2023-06-02 13:15:12 +00:00
|
|
|
}
|
2023-07-14 11:38:24 +00:00
|
|
|
$activity = resolve(StartProxy::class)($this->server);
|
2023-06-02 13:15:12 +00:00
|
|
|
$this->emit('newMonitorActivity', $activity->id);
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-06-02 13:15:12 +00:00
|
|
|
public function stop()
|
|
|
|
{
|
|
|
|
instant_remote_process([
|
|
|
|
"docker rm -f coolify-proxy",
|
|
|
|
], $this->server);
|
2023-06-20 18:19:31 +00:00
|
|
|
$this->server->proxy->status = 'exited';
|
2023-06-02 13:15:12 +00:00
|
|
|
$this->server->save();
|
|
|
|
$this->emit('proxyStatusUpdated');
|
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
}
|