feat: intégrer viewLogs et viewServices comme dépendances Go compilées dans CORE

- go.mod/go.sum : require + replace pour viewLogs et viewServices (chemins locaux)
- main.go : enregistrement loader.RegisterModule(viewlogs.New()) + viewservices.New()
- Dockerfile : build context parent proxmoxPanel/ pour accéder aux 3 repos
- docker-compose.yml : context: .. + dockerfile: core/backend/Dockerfile
- nginx.conf : locations /viewLogs/ et /viewServices/ proxyfiées vers backend:3001

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-22 04:35:27 +01:00
parent ec7d120ef6
commit cbf87a87fc
5 changed files with 42 additions and 8 deletions

View file

@ -1,18 +1,22 @@
# ── Étape 1 : Build du binaire Go ────────────────────────────────────────── # ── Étape 1 : Build du binaire Go ──────────────────────────────────────────
# Build context = proxmoxPanel/ (parent de core/)
FROM golang:1.26-alpine AS builder FROM golang:1.26-alpine AS builder
# Dépendances de compilation (git pour les modules Go) # Dépendances de compilation (git pour les modules Go)
RUN apk add --no-cache git RUN apk add --no-cache git
WORKDIR /build WORKDIR /workspace
# Copier les fichiers de dépendances en premier (optimise le cache Docker) # Copier les sources des trois modules
COPY go.mod go.sum ./ COPY core/backend/ ./core/backend/
COPY viewLogs/ ./viewLogs/
COPY viewServices/ ./viewServices/
WORKDIR /workspace/core/backend
# Télécharger les dépendances
RUN go mod download RUN go mod download
# Copier tout le code source
COPY . .
# Compiler le binaire de façon statique # Compiler le binaire de façon statique
# -ldflags="-s -w" : supprime les infos de debug pour réduire la taille # -ldflags="-s -w" : supprime les infos de debug pour réduire la taille
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \

View file

@ -3,6 +3,8 @@ module git.geronzi.fr/proxmoxPanel/core/backend
go 1.26.1 go 1.26.1
require ( require (
git.geronzi.fr/proxmoxPanel/viewLogs v0.0.0
git.geronzi.fr/proxmoxPanel/viewServices v0.0.0
github.com/go-chi/chi/v5 v5.2.5 github.com/go-chi/chi/v5 v5.2.5
github.com/golang-jwt/jwt/v5 v5.3.1 github.com/golang-jwt/jwt/v5 v5.3.1
github.com/gorilla/websocket v1.5.3 github.com/gorilla/websocket v1.5.3
@ -10,6 +12,11 @@ require (
modernc.org/sqlite v1.47.0 modernc.org/sqlite v1.47.0
) )
replace (
git.geronzi.fr/proxmoxPanel/viewLogs => ../../viewLogs
git.geronzi.fr/proxmoxPanel/viewServices => ../../viewServices
)
require ( require (
github.com/dustin/go-humanize v1.0.1 // indirect github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.6.0 // indirect github.com/google/uuid v1.6.0 // indirect

View file

@ -17,6 +17,8 @@ import (
sshpool "git.geronzi.fr/proxmoxPanel/core/backend/internal/ssh" sshpool "git.geronzi.fr/proxmoxPanel/core/backend/internal/ssh"
"git.geronzi.fr/proxmoxPanel/core/backend/internal/websocket" "git.geronzi.fr/proxmoxPanel/core/backend/internal/websocket"
"git.geronzi.fr/proxmoxPanel/core/backend/modules" "git.geronzi.fr/proxmoxPanel/core/backend/modules"
viewlogs "git.geronzi.fr/proxmoxPanel/viewLogs"
viewservices "git.geronzi.fr/proxmoxPanel/viewServices"
"github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware" "github.com/go-chi/chi/v5/middleware"
@ -68,6 +70,8 @@ func main() {
// ── Chargement des modules actifs ────────────────────────────────────── // ── Chargement des modules actifs ──────────────────────────────────────
loader := modules.NewLoader(database, sshPool, encryptor) loader := modules.NewLoader(database, sshPool, encryptor)
loader.RegisterModule(viewlogs.New())
loader.RegisterModule(viewservices.New())
if err := loader.LoadActive(); err != nil { if err := loader.LoadActive(); err != nil {
log.Fatalf("Erreur chargement modules : %v", err) log.Fatalf("Erreur chargement modules : %v", err)
} }

View file

@ -7,8 +7,8 @@ services:
# ── Backend Go (API + WebSocket) ──────────────────────────────────────── # ── Backend Go (API + WebSocket) ────────────────────────────────────────
backend: backend:
build: build:
context: ./backend context: ..
dockerfile: Dockerfile dockerfile: core/backend/Dockerfile
container_name: proxmoxpanel-backend container_name: proxmoxpanel-backend
restart: unless-stopped restart: unless-stopped
expose: expose:

View file

@ -60,6 +60,25 @@ http {
proxy_send_timeout 3600s; proxy_send_timeout 3600s;
} }
# Proxy modules backend Go
location /viewLogs/ {
proxy_pass http://backend:3001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /viewServices/ {
proxy_pass http://backend:3001;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# URLs propres : /dashboard /dashboard.html # URLs propres : /dashboard /dashboard.html
location / { location / {
try_files $uri $uri.html $uri/ /index.html; try_files $uri $uri.html $uri/ /index.html;