mirror of
https://github.com/coollabsio/coolify.git
synced 2026-09-27 17:55:59 -04:00
feat(v5): expose corrosion and firewall diagnostics
This commit is contained in:
@@ -12,7 +12,7 @@ class StartCaddyIngress
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
private const FIREWALL_RULE_ID = 'v5-caddy-ingress:80';
|
||||
private const FIREWALL_PORTS = [80, 443];
|
||||
|
||||
public function __construct(private readonly FluxClient $fluxClient) {}
|
||||
|
||||
@@ -30,14 +30,17 @@ class StartCaddyIngress
|
||||
|
||||
$configuration = GenerateCaddyIngressConfiguration::run($this->applications($server));
|
||||
$output = $this->fluxClient->applyIngress($hostId, 'caddy', $configuration['caddyfile'], $this->ingressApps($configuration['apps']));
|
||||
$this->fluxClient->applyFirewallRule($hostId, [
|
||||
'id' => self::FIREWALL_RULE_ID,
|
||||
'namespace' => 'default',
|
||||
'src' => '0.0.0.0/0',
|
||||
'dst' => 'coolify-v5-caddy',
|
||||
'proto' => 'tcp',
|
||||
'port' => 80,
|
||||
]);
|
||||
|
||||
foreach (self::FIREWALL_PORTS as $port) {
|
||||
$this->fluxClient->applyFirewallRule($hostId, [
|
||||
'id' => "v5-caddy-ingress:{$port}",
|
||||
'namespace' => 'default',
|
||||
'src' => '0.0.0.0/0',
|
||||
'dst' => 'coolify-v5-caddy',
|
||||
'proto' => 'tcp',
|
||||
'port' => $port,
|
||||
]);
|
||||
}
|
||||
|
||||
if ($server->exists) {
|
||||
$server->update([
|
||||
|
||||
@@ -10,7 +10,7 @@ class StopCaddyIngress
|
||||
{
|
||||
use AsAction;
|
||||
|
||||
private const FIREWALL_RULE_ID = 'v5-caddy-ingress:80';
|
||||
private const FIREWALL_PORTS = [80, 443];
|
||||
|
||||
public function __construct(private readonly FluxClient $fluxClient) {}
|
||||
|
||||
@@ -23,7 +23,10 @@ class StopCaddyIngress
|
||||
}
|
||||
|
||||
$output = $this->fluxClient->stopIngress($hostId, 'caddy');
|
||||
$this->fluxClient->revokeFirewallRule($hostId, self::FIREWALL_RULE_ID);
|
||||
|
||||
foreach (self::FIREWALL_PORTS as $port) {
|
||||
$this->fluxClient->revokeFirewallRule($hostId, "v5-caddy-ingress:{$port}");
|
||||
}
|
||||
|
||||
if ($server->exists) {
|
||||
$server->update(['ingress_status' => 'exited']);
|
||||
|
||||
Reference in New Issue
Block a user