Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e0ab5b5961 | ||
|
|
560734d72c | ||
|
|
18589823f3 | ||
|
|
ab2b3fd9ef | ||
|
|
123d9b306f | ||
|
|
ca3445103d | ||
| 18f3de1ba9 | |||
| 52571c651f | |||
|
|
b9712643de | ||
| e954402959 |
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.1.23'
|
app.version: '0.1.27'
|
||||||
|
|||||||
@@ -138,6 +138,7 @@
|
|||||||
"uptime": "Uptime",
|
"uptime": "Uptime",
|
||||||
"cpu": "CPU",
|
"cpu": "CPU",
|
||||||
"memory": "Memoire",
|
"memory": "Memoire",
|
||||||
|
"ports": "Ports",
|
||||||
"noData": "Aucune donnee disponible"
|
"noData": "Aucune donnee disponible"
|
||||||
},
|
},
|
||||||
"deploy": {
|
"deploy": {
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ onMounted(loadApplication)
|
|||||||
<!-- Health metrics -->
|
<!-- Health metrics -->
|
||||||
<div v-if="healthByEnvId[env.id!]" class="mt-4 border-t border-neutral-200 py-3">
|
<div v-if="healthByEnvId[env.id!]" class="mt-4 border-t border-neutral-200 py-3">
|
||||||
<p class="text-sm font-bold uppercase tracking-wider mb-2">{{ t('environments.health.title') }}</p>
|
<p class="text-sm font-bold uppercase tracking-wider mb-2">{{ t('environments.health.title') }}</p>
|
||||||
<div class="grid grid-cols-2 sm:grid-cols-5 gap-3">
|
<div class="grid grid-cols-2 sm:grid-cols-6 gap-3">
|
||||||
<div>
|
<div>
|
||||||
<p class="text-xs text-neutral-400">{{ t('environments.health.status') }}</p>
|
<p class="text-xs text-neutral-400">{{ t('environments.health.status') }}</p>
|
||||||
<span
|
<span
|
||||||
@@ -456,6 +456,19 @@ onMounted(loadApplication)
|
|||||||
<span class="text-neutral-400">({{ healthByEnvId[env.id!].memoryPercent }}%)</span>
|
<span class="text-neutral-400">({{ healthByEnvId[env.id!].memoryPercent }}%)</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<p class="text-xs text-neutral-400">{{ t('environments.health.ports') }}</p>
|
||||||
|
<div v-if="healthByEnvId[env.id!].ports?.length" class="mt-1 flex flex-wrap gap-1">
|
||||||
|
<span
|
||||||
|
v-for="(p, i) in healthByEnvId[env.id!].ports"
|
||||||
|
:key="i"
|
||||||
|
class="inline-block rounded bg-neutral-100 px-2 py-0.5 text-xs font-mono text-neutral-700"
|
||||||
|
>
|
||||||
|
{{ p.hostPort }}:{{ p.containerPort }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<p v-else class="text-sm text-neutral-400 mt-1">-</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center gap-4 mt-4">
|
<div class="flex justify-center gap-4 mt-4">
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ type DashboardResponse = {
|
|||||||
applications: DashboardApplication[]
|
applications: DashboardApplication[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PortMapping = {
|
||||||
|
hostPort: string
|
||||||
|
containerPort: string
|
||||||
|
protocol: string
|
||||||
|
}
|
||||||
|
|
||||||
type EnvironmentHealth = {
|
type EnvironmentHealth = {
|
||||||
status: string
|
status: string
|
||||||
version: string
|
version: string
|
||||||
@@ -24,4 +30,5 @@ type EnvironmentHealth = {
|
|||||||
memoryUsage: string
|
memoryUsage: string
|
||||||
memoryLimit: string
|
memoryLimit: string
|
||||||
memoryPercent: number
|
memoryPercent: number
|
||||||
|
ports: PortMapping[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,16 @@ FROM php:8.4-fpm AS production
|
|||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
|
libicu-dev libpq-dev libpng-dev libzip-dev libxml2-dev \
|
||||||
nginx supervisor docker.io \
|
nginx supervisor docker.io curl \
|
||||||
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
|
&& docker-php-ext-install -j$(nproc) intl pdo_pgsql zip gd opcache \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Docker Compose plugin
|
||||||
|
RUN DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name"' | sed 's/.*"v\(.*\)".*/\1/') \
|
||||||
|
&& mkdir -p /usr/local/lib/docker/cli-plugins \
|
||||||
|
&& curl -SL "https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64" -o /usr/local/lib/docker/cli-plugins/docker-compose \
|
||||||
|
&& chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
|
||||||
|
|
||||||
# PHP production config
|
# PHP production config
|
||||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
|
|||||||
@@ -26,4 +26,6 @@ final class EnvironmentHealth
|
|||||||
public string $memoryUsage = '';
|
public string $memoryUsage = '';
|
||||||
public string $memoryLimit = '';
|
public string $memoryLimit = '';
|
||||||
public float $memoryPercent = 0.0;
|
public float $memoryPercent = 0.0;
|
||||||
|
/** @var list<array{hostPort: string, containerPort: string, protocol: string}> */
|
||||||
|
public array $ports = [];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ final class DockerService
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array{status: string, image: string, version: string, startedAt: string}
|
* @return array{status: string, image: string, version: string, startedAt: string, ports: list<array{hostPort: string, containerPort: string, protocol: string}>}
|
||||||
*/
|
*/
|
||||||
public function getContainerStatus(string $containerName): array
|
public function getContainerStatus(string $containerName): array
|
||||||
{
|
{
|
||||||
@@ -33,12 +33,13 @@ final class DockerService
|
|||||||
'image' => '',
|
'image' => '',
|
||||||
'version' => '',
|
'version' => '',
|
||||||
'startedAt' => '',
|
'startedAt' => '',
|
||||||
|
'ports' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new Process([
|
$process = new Process([
|
||||||
'docker', 'inspect',
|
'docker', 'inspect',
|
||||||
'--format', '{{.State.Status}}||{{.Config.Image}}||{{.State.StartedAt}}',
|
'--format', '{{.State.Status}}||{{.Config.Image}}||{{.State.StartedAt}}||{{json .NetworkSettings.Ports}}',
|
||||||
$containerName,
|
$containerName,
|
||||||
]);
|
]);
|
||||||
$process->setTimeout(10);
|
$process->setTimeout(10);
|
||||||
@@ -50,10 +51,11 @@ final class DockerService
|
|||||||
'image' => '',
|
'image' => '',
|
||||||
'version' => '',
|
'version' => '',
|
||||||
'startedAt' => '',
|
'startedAt' => '',
|
||||||
|
'ports' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('||', trim($process->getOutput()));
|
$parts = explode('||', trim($process->getOutput()), 4);
|
||||||
|
|
||||||
if (\count($parts) < 3) {
|
if (\count($parts) < 3) {
|
||||||
return [
|
return [
|
||||||
@@ -61,6 +63,7 @@ final class DockerService
|
|||||||
'image' => '',
|
'image' => '',
|
||||||
'version' => '',
|
'version' => '',
|
||||||
'startedAt' => '',
|
'startedAt' => '',
|
||||||
|
'ports' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,11 +73,32 @@ final class DockerService
|
|||||||
$version = substr($image, strrpos($image, ':') + 1);
|
$version = substr($image, strrpos($image, ':') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ports = [];
|
||||||
|
if (isset($parts[3])) {
|
||||||
|
$portsJson = json_decode($parts[3], true);
|
||||||
|
if (\is_array($portsJson)) {
|
||||||
|
foreach ($portsJson as $containerPort => $bindings) {
|
||||||
|
if (!\is_array($bindings)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
[$port, $protocol] = explode('/', $containerPort) + [1 => 'tcp'];
|
||||||
|
foreach ($bindings as $binding) {
|
||||||
|
$ports[] = [
|
||||||
|
'hostPort' => $binding['HostPort'] ?? '',
|
||||||
|
'containerPort' => $port,
|
||||||
|
'protocol' => $protocol,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'status' => $parts[0],
|
'status' => $parts[0],
|
||||||
'image' => $image,
|
'image' => $image,
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
'startedAt' => $parts[2],
|
'startedAt' => $parts[2],
|
||||||
|
'ports' => $ports,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ final readonly class EnvironmentHealthProvider implements ProviderInterface
|
|||||||
$dto->memoryUsage = $stats['memoryUsage'];
|
$dto->memoryUsage = $stats['memoryUsage'];
|
||||||
$dto->memoryLimit = $stats['memoryLimit'];
|
$dto->memoryLimit = $stats['memoryLimit'];
|
||||||
$dto->memoryPercent = $stats['memoryPercent'];
|
$dto->memoryPercent = $stats['memoryPercent'];
|
||||||
|
$dto->ports = $status['ports'];
|
||||||
|
|
||||||
return $dto;
|
return $dto;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user