diff --git a/backend/app/database.py b/backend/app/database.py index 94dba97..6cfd5ba 100644 --- a/backend/app/database.py +++ b/backend/app/database.py @@ -13,6 +13,7 @@ class Settings(BaseSettings): keycloak_client_id: str keycloak_client_secret: str keycloak_redirect_uri: str + app_version: str = "dev" class Config: env_file = ".env" diff --git a/backend/app/main.py b/backend/app/main.py index e307272..3414e54 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -28,4 +28,4 @@ app.include_router(params.router, prefix="/configs", tags=["params"]) @app.get("/health") def health() -> dict: - return {"status": "ok"} + return {"status": "ok", "version": settings.app_version} diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index afc4686..bb3e61c 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -1,4 +1,4 @@ -import { ReactNode } from 'react' +import { ReactNode, useEffect, useState } from 'react' import { useNavigate, useLocation } from 'react-router-dom' import Box from '@mui/material/Box' import Drawer from '@mui/material/Drawer' @@ -13,6 +13,7 @@ import Tooltip from '@mui/material/Tooltip' import DnsIcon from '@mui/icons-material/Dns' import LogoutIcon from '@mui/icons-material/Logout' import { useAuth } from '../store/auth' +import api from '../api' const DRAWER_WIDTH = 240 @@ -22,6 +23,11 @@ export default function Layout({ children, title }: Props) { const navigate = useNavigate() const location = useLocation() const { user, logout } = useAuth() + const [version, setVersion] = useState(null) + + useEffect(() => { + api.get('/health').then((r) => setVersion(r.data.version)).catch(() => {}) + }, []) return ( @@ -47,7 +53,10 @@ export default function Layout({ children, title }: Props) { - {user?.username} + + {user?.username} + {version && v{version}} + diff --git a/helm/shorefront/templates/backend-deployment.yaml b/helm/shorefront/templates/backend-deployment.yaml index e9dc362..8428e1f 100644 --- a/helm/shorefront/templates/backend-deployment.yaml +++ b/helm/shorefront/templates/backend-deployment.yaml @@ -110,6 +110,11 @@ spec: secretKeyRef: name: shorefront-secret key: KEYCLOAK_CLIENT_SECRET + - name: APP_VERSION + valueFrom: + configMapKeyRef: + name: shorefront-config + key: APP_VERSION ports: - containerPort: 8000 resources: diff --git a/helm/shorefront/templates/configmap.yaml b/helm/shorefront/templates/configmap.yaml index 2a51d5a..9e19929 100644 --- a/helm/shorefront/templates/configmap.yaml +++ b/helm/shorefront/templates/configmap.yaml @@ -14,3 +14,4 @@ data: KEYCLOAK_REALM: {{ .Values.keycloak.realm | quote }} KEYCLOAK_CLIENT_ID: {{ .Values.keycloak.clientId | quote }} KEYCLOAK_REDIRECT_URI: {{ .Values.keycloak.redirectUri | quote }} + APP_VERSION: {{ .Values.containers.version | quote }} diff --git a/helm/shorefront/values.yaml b/helm/shorefront/values.yaml index a8cce1b..38bf0fa 100644 --- a/helm/shorefront/values.yaml +++ b/helm/shorefront/values.yaml @@ -42,4 +42,4 @@ keycloak: redirectUri: https://shorefront.baumann.gr/api/auth/oidc/callback containers: - version: "0.010" + version: "0.012"