From b3176c4dfaa8836f44f1000aef4e5a6e6267c101 Mon Sep 17 00:00:00 2001 From: Blomios Date: Tue, 19 May 2026 16:58:44 +0200 Subject: [PATCH] feat: add port clickable --- README.md | 24 ++++++++++++++++++--- agent/src/main.rs | 4 ++++ proto/agent/v1/agent.proto | 9 ++++---- server/internal/grpc/gateway.go | 4 ++++ web/src/routes/+page.svelte | 38 ++++++++++++++++++++++++--------- 5 files changed, 62 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 87fb66c..8363522 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ Interface web pour gérer les containers Docker de plusieurs machines depuis un seul endroit. -- Visualisation en temps réel de tous les containers par host -- Actions : start, stop, restart, remove -- Streaming de logs en direct +- Visualisation en temps réel de tous les containers, groupés par host et par projet compose +- Actions : start, stop, restart sur un container ou sur tout un projet compose +- Streaming de logs en direct (par container ou pour tout un projet simultanément) +- Auto-update automatique et manuel des images Docker +- Gestion des volumes, images et réseaux +- Liens directs vers les services exposés (clic sur un port) - Gestion des agents depuis l'interface admin - PWA installable sur mobile @@ -71,8 +74,11 @@ curl -fsSL https://gitea.anthonybouteiller.ovh/blomios/Containarr/raw/branch/mai environment: CONTAINARR_SERVER_URL: "http://:9090" CONTAINARR_AGENT_TOKEN: "" + CONTAINARR_HOST_IP: "" # ex: 192.168.1.95 — utilisé pour les liens de ports ``` +> `CONTAINARR_HOST_IP` est optionnel mais recommandé : sans lui, l'IP affichée sera l'adresse réseau Docker interne, et les liens vers les services exposés ne fonctionneront pas correctement. + ### 4. Lancer ```bash @@ -83,6 +89,18 @@ L'agent apparaît dans l'interface dans les secondes qui suivent. --- +## Auto-update + +Containarr peut surveiller et mettre à jour automatiquement les images Docker de vos containers. + +- **Par container** : clic sur l'icône ↻ d'un container → activer l'auto-update et choisir l'intervalle de vérification +- **Par projet** : même bouton au niveau du groupe projet → applique la policy à tous les containers du projet +- **Mise à jour manuelle** : bouton "Mettre à jour maintenant" dans le panneau auto-update + +Les mises à jour utilisent l'API Docker directement (pull de la nouvelle image + recréation du container avec la même configuration). + +--- + ## Ports | Port | Usage | diff --git a/agent/src/main.rs b/agent/src/main.rs index c44da2c..7f5656a 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -69,6 +69,7 @@ async fn run(url: &str, token: &str, hostname: &str, docker: DockerClient) -> Re hostname: hostname.to_string(), arch: std::env::consts::ARCH.to_string(), os: std::env::consts::OS.to_string(), + ip_address: std::env::var("CONTAINARR_HOST_IP").unwrap_or_default(), })), }) .await?; @@ -845,9 +846,11 @@ mod tests { hostname: "host".to_string(), arch: "x86_64".to_string(), os: "linux".to_string(), + ip_address: "192.168.1.10".to_string(), }; assert_eq!(hs.token, "tok"); assert_eq!(hs.hostname, "host"); + assert_eq!(hs.ip_address, "192.168.1.10"); } #[test] @@ -858,6 +861,7 @@ mod tests { hostname: "h".to_string(), arch: "arm64".to_string(), os: "linux".to_string(), + ip_address: String::new(), })), }; assert!(matches!( diff --git a/proto/agent/v1/agent.proto b/proto/agent/v1/agent.proto index 7e106bc..01effc6 100644 --- a/proto/agent/v1/agent.proto +++ b/proto/agent/v1/agent.proto @@ -28,10 +28,11 @@ message ContainerInfo { // ── Agent → Server ──────────────────────────────────────────────────────────── message AgentHandshake { - string token = 1; - string hostname = 2; - string arch = 3; - string os = 4; + string token = 1; + string hostname = 2; + string arch = 3; + string os = 4; + string ip_address = 5; } message ImageInfo { diff --git a/server/internal/grpc/gateway.go b/server/internal/grpc/gateway.go index 19ee58f..94df5c1 100644 --- a/server/internal/grpc/gateway.go +++ b/server/internal/grpc/gateway.go @@ -53,6 +53,10 @@ func (g *Gateway) Tunnel(stream agentv1.AgentGateway_TunnelServer) error { ipAddress = host } } + // If the agent advertises its own LAN IP, prefer it over the peer address. + if hs.IpAddress != "" { + ipAddress = hs.IpAddress + } agentID := existing.ID slog.Info("agent connected", "id", agentID, "hostname", hs.Hostname, "ip", ipAddress) diff --git a/web/src/routes/+page.svelte b/web/src/routes/+page.svelte index 3ce7612..7a5a2c7 100644 --- a/web/src/routes/+page.svelte +++ b/web/src/routes/+page.svelte @@ -898,9 +898,14 @@
{#each uniquePorts(container.ports) as port} - + {port.host_port}:{port.container_port} - + {/each}
@@ -941,10 +946,14 @@ {#if uniquePorts(container.ports).length > 0}
{#each uniquePorts(container.ports) as port} - + {port.host_port}:{port.container_port} - + {/each}
{/if} @@ -1005,9 +1014,14 @@
{#each uniquePorts(container.ports) as port} - + {port.host_port}:{port.container_port} - + {/each}
@@ -1048,10 +1062,14 @@ {#if uniquePorts(container.ports).length > 0}
{#each uniquePorts(container.ports) as port} - + {port.host_port}:{port.container_port} - + {/each}
{/if}