fixes
This commit is contained in:
@@ -53,6 +53,8 @@ class Deploy extends Component
|
||||
|
||||
public function stop()
|
||||
{
|
||||
dispatch(new ContainerStopJob($this->application->id, $this->destination->server));
|
||||
instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server);
|
||||
$this->application->status = get_container_status(server: $this->application->destination->server, container_id: $this->application->uuid);
|
||||
$this->application->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ class Status extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
protected $listeners = [
|
||||
'applicationStatusChanged' => 'pollingStatus',
|
||||
];
|
||||
public function pollingStatus()
|
||||
{
|
||||
$this->application->refresh();
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Component;
|
||||
use LocalStorage;
|
||||
|
||||
class PrivateKey extends Component
|
||||
{
|
||||
@@ -19,8 +20,7 @@ class PrivateKey extends Component
|
||||
'private_key_id' => $private_key_id
|
||||
]);
|
||||
// Delete the old ssh mux file to force a new one to be created
|
||||
Storage::disk('local')->delete(".ssh/ssh_mux_{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}");
|
||||
|
||||
LocalStorage::ssh_mux()->delete("{$server->first()->ip}_{$server->first()->port}_{$server->first()->user}");
|
||||
return redirect()->route('server.show', $this->parameters['server_uuid']);
|
||||
}
|
||||
public function mount()
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
namespace App\Http\Livewire\Settings;
|
||||
|
||||
use App\Enums\ActivityTypes;
|
||||
use App\Models\InstanceSettings as ModelsInstanceSettings;
|
||||
use App\Models\Server;
|
||||
use Livewire\Component;
|
||||
use Spatie\Url\Url;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Form extends Component
|
||||
{
|
||||
@@ -44,5 +48,59 @@ class Form extends Component
|
||||
}
|
||||
$this->validate();
|
||||
$this->settings->save();
|
||||
if (isset($this->settings->fqdn)) {
|
||||
if (config('app.env') == 'local') {
|
||||
$server = Server::findOrFail(1);
|
||||
$dynamic_config_path = '/data/coolify/proxy/dynamic';
|
||||
} else {
|
||||
$server = Server::findOrFail(0);
|
||||
$dynamic_config_path = '/traefik/dynamic';
|
||||
}
|
||||
$url = Url::fromString($this->settings->fqdn);
|
||||
$host = $url->getHost();
|
||||
$schema = $url->getScheme();
|
||||
$entryPoints = [
|
||||
0 => 'http',
|
||||
];
|
||||
if ($schema === 'https') {
|
||||
$entryPoints[] = 'https';
|
||||
}
|
||||
$traefik_dynamic_conf = [
|
||||
'http' =>
|
||||
[
|
||||
'routers' =>
|
||||
[
|
||||
'coolify' =>
|
||||
[
|
||||
'entryPoints' => $entryPoints,
|
||||
'service' => 'coolify',
|
||||
'rule' => "Host(`{$host}`)",
|
||||
],
|
||||
],
|
||||
'services' =>
|
||||
[
|
||||
'coolify' =>
|
||||
[
|
||||
'loadBalancer' =>
|
||||
[
|
||||
'servers' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'url' => 'http://coolify:80',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
$yaml = Yaml::dump($traefik_dynamic_conf);
|
||||
$base64 = base64_encode($yaml);
|
||||
remote_process([
|
||||
"mkdir -p $dynamic_config_path",
|
||||
"echo '$base64' | base64 -d > $dynamic_config_path/coolify.yaml",
|
||||
], $server, ActivityTypes::INLINE->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user