feat: add static ipv4 ipv6 support
This commit is contained in:
@@ -78,25 +78,25 @@ class Kernel extends ConsoleKernel
|
||||
dispatch($job);
|
||||
})->name('container-status-' . $server->id)->everyMinute()->onOneServer();
|
||||
if ($server->isLogDrainEnabled()) {
|
||||
$schedule
|
||||
->call(function () use ($server) {
|
||||
$randomSeconds = rand(1, 40);
|
||||
$job = new CheckLogDrainContainerJob($server);
|
||||
$job->delay($randomSeconds);
|
||||
dispatch($job);
|
||||
})->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();
|
||||
// $schedule->job(new CheckLogDrainContainerJob($server))->everyMinute()->onOneServer();
|
||||
$schedule
|
||||
->call(function () use ($server) {
|
||||
$randomSeconds = rand(1, 40);
|
||||
$job = new CheckLogDrainContainerJob($server);
|
||||
$job->delay($randomSeconds);
|
||||
dispatch($job);
|
||||
})->name('log-drain-container-check-' . $server->id)->everyMinute()->onOneServer();
|
||||
}
|
||||
}
|
||||
foreach ($servers as $server) {
|
||||
$schedule
|
||||
->call(function () use ($server) {
|
||||
$randomSeconds = rand(1, 40);
|
||||
$job = new ServerStatusJob($server);
|
||||
$job->delay($randomSeconds);
|
||||
dispatch($job);
|
||||
})->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();
|
||||
// $schedule->job(new ServerStatusJob($server))->everyMinute()->onOneServer();
|
||||
$schedule
|
||||
->call(function () use ($server) {
|
||||
$randomSeconds = rand(1, 40);
|
||||
$job = new ServerStatusJob($server);
|
||||
$job->delay($randomSeconds);
|
||||
dispatch($job);
|
||||
})->name('server-status-job-' . $server->id)->everyMinute()->onOneServer();
|
||||
}
|
||||
}
|
||||
private function instance_auto_update($schedule)
|
||||
|
||||
@@ -1223,6 +1223,19 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
||||
if ((bool)$this->application->settings->is_consistent_container_name_enabled) {
|
||||
$custom_compose = convert_docker_run_to_compose($this->application->custom_docker_run_options);
|
||||
if (count($custom_compose) > 0) {
|
||||
$ipv4 = data_get($custom_compose, 'ip.0');
|
||||
$ipv6 = data_get($custom_compose, 'ip6.0');
|
||||
data_forget($custom_compose, 'ip');
|
||||
data_forget($custom_compose, 'ip6');
|
||||
if ($ipv4 || $ipv6) {
|
||||
data_forget($docker_compose['services'][$this->application->uuid], 'networks');
|
||||
}
|
||||
if ($ipv4) {
|
||||
$docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv4_address'] = $ipv4;
|
||||
}
|
||||
if ($ipv6) {
|
||||
$docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv6_address'] = $ipv6;
|
||||
}
|
||||
$docker_compose['services'][$this->container_name] = array_merge_recursive($docker_compose['services'][$this->container_name], $custom_compose);
|
||||
}
|
||||
} else {
|
||||
@@ -1230,6 +1243,19 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
||||
data_forget($docker_compose, 'services.' . $this->container_name);
|
||||
$custom_compose = convert_docker_run_to_compose($this->application->custom_docker_run_options);
|
||||
if (count($custom_compose) > 0) {
|
||||
$ipv4 = data_get($custom_compose, 'ip.0');
|
||||
$ipv6 = data_get($custom_compose, 'ip6.0');
|
||||
data_forget($custom_compose, 'ip');
|
||||
data_forget($custom_compose, 'ip6');
|
||||
if ($ipv4 || $ipv6) {
|
||||
data_forget($docker_compose['services'][$this->application->uuid], 'networks');
|
||||
}
|
||||
if ($ipv4) {
|
||||
$docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv4_address'] = $ipv4;
|
||||
}
|
||||
if ($ipv6) {
|
||||
$docker_compose['services'][$this->application->uuid]['networks'][$this->destination->network]['ipv6_address'] = $ipv6;
|
||||
}
|
||||
$docker_compose['services'][$this->application->uuid] = array_merge_recursive($docker_compose['services'][$this->application->uuid], $custom_compose);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,10 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
|
||||
public function handle()
|
||||
{
|
||||
if (!$this->server->isFunctional()) {
|
||||
return 'Server is not ready.';
|
||||
};
|
||||
|
||||
$applications = $this->server->applications();
|
||||
$skip_these_applications = collect([]);
|
||||
foreach ($applications as $application) {
|
||||
@@ -57,10 +61,6 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
||||
$applications = $applications->filter(function ($value, $key) use ($skip_these_applications) {
|
||||
return !$skip_these_applications->pluck('id')->contains($value->id);
|
||||
});
|
||||
|
||||
if (!$this->server->isFunctional()) {
|
||||
return 'Server is not ready.';
|
||||
};
|
||||
try {
|
||||
if ($this->server->isSwarm()) {
|
||||
$containers = instant_remote_process(["docker service inspect $(docker service ls -q) --format '{{json .}}'"], $this->server, false);
|
||||
|
||||
Reference in New Issue
Block a user