diff --git a/monitor/server/Dockerfile b/monitor/server/Dockerfile index 9716c58..4c487cf 100644 --- a/monitor/server/Dockerfile +++ b/monitor/server/Dockerfile @@ -1,62 +1,53 @@ # === STAGE 1: BUILDER (For installing uv and resolving/installing dependencies) === -FROM python:3.11-slim as builder -#USER root -WORKDIR /app - -# 1. Install uv as a standalone, fast package manager -# We use pipx to install it outside of the main environment -ENV PATH="/root/.local/bin:$PATH" -RUN pip install --upgrade pip \ - && pip install --no-cache-dir pipx \ - && pipx install uv +FROM python:3.14-slim as builder -# 2. install vim for quick edits directly on the image (for shell-mode only) -##RUN apt-get update && apt-get install -y --no-install-recommends vim-tiny \ -## && rm -rf /var/lib/apt/lists/* +# 1. Install uv as a standalone binary (prevents 'root' user pip warnings) +COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ +USER root +WORKDIR /app -# 3. Use uv to create the production environment and install required modules -# 'uv venv' creates the venv; 'uv pip sync' installs locked dependencies fast -RUN uv venv --system-site-packages .venv && \ +# 3. Use uv to create the production environment +RUN uv venv .venv && \ . .venv/bin/activate && \ - uv pip install webpie pythreader jinja2 \ - uv clean - -# 4. copy local files as needed + uv pip install --no-cache-dir --python .venv/bin/python webpie pythreader jinja2 legacy-cgi +# 4. Prepare app environment as needed ADD start.sh /app/start.sh RUN mkdir app samples # === STAGE 2: RUNNER (The minimal, clean production image) === -FROM python:3.11-slim as runner +FROM python:3.14-slim as runner -# 1. Set the working directory +# 1. Setup environment WORKDIR /app +ENV PATH="/app/.venv/bin:$PATH" -# 2. Copy the *clean virtual environment* and application files from the builder stage +#### 2. Interactive mode only (to be removed for the production image): ###### +## Install vim for quick edits directly on the image (for shell-mode only debugging) +#RUN apt-get update && \ +# mkdir -p /usr/share/man/man1 && \ +# apt-get install -y -qq --no-install-recommends vim-tiny && \ +# rm -rf /var/lib/apt/lists/* +# +##.. test data from /var/cache/consistency-dump - usually not needed +#ADD reports /reports +####( END of section to be removed for production image )###### + +# 3. Copy the *clean virtual environment* and application files from the builder stage # This drastically reduces the size of the final image by excluding build tools and cache COPY --from=builder app /app/ - -ADD start.sh /root/start.sh -RUN mkdir -p /var/cache/consistency-dump /var/cache/consistency-temp /reports/unmerged ADD app ./app -###.. test data from /var/cache/consistency-dump - usually not needed -#ADD app/reports /reports - -RUN chmod +x *.sh - - -# 3. Ensure the virtual environment is used -ENV PATH="/app/.venv/bin:$PATH" - - -# 4. Define how the container starts +# 4. Final setup EXPOSE 8400 -ENTRYPOINT ["/root/start.sh"] +RUN mkdir -p /var/cache/consistency-dump /var/cache/consistency-temp /reports/unmerged \ + && chmod +x *.sh +# 5. Define how the container starts - enable EITHER (a) OR (b) +# a) For production mode: start app right away +ENTRYPOINT ["/app/start.sh"] -# 5. For interactive mode: comment out the ENTRYPOINT line above -#COPY --from=builder /usr/bin/vi /usr/bin/vi -CMD [ "/bin/bash", "--login" ] +# b) For interactive / testing mode: comment out the ENTRYPOINT line above +#CMD [ "/bin/bash", "--login" ] diff --git a/monitor/server/app/ce_index.html b/monitor/server/app/ce_index.html index f4a08a2..8de1593 100644 --- a/monitor/server/app/ce_index.html +++ b/monitor/server/app/ce_index.html @@ -144,6 +144,7 @@ Detected (old) Confirmed Declared + Lost Action status @@ -191,6 +192,7 @@ {% if not missing_stats["detected"] is none %}{{missing_stats["detected"]}}(...){% endif %} {{missing_stats["confirmed"]|none_as_blank}} {{missing_stats["acted_on"]|none_as_blank}} + {{missing_stats["perm_lost"]|none_as_blank}} {{missing_stats['action_status']|none_as_blank}} diff --git a/monitor/server/app/ce_rse.html b/monitor/server/app/ce_rse.html index 4d529e4..fc584fb 100644 --- a/monitor/server/app/ce_rse.html +++ b/monitor/server/app/ce_rse.html @@ -24,7 +24,7 @@ Detected (old)ConfirmedQuarantinedAction status - Detected (old)ConfirmedDeclaredAction status + Detected (old)ConfirmedDeclaredPerm'ly LostAction status DetectedConfirmedRemovedAction status {% for t, info in cc_runs %} @@ -67,6 +67,7 @@ {{missing_stats["confirmed"]|none_as_blank}} {{missing_stats["acted_on"]|none_as_blank}} + {{missing_stats["perm_lost"]|none_as_blank}} {{missing_stats['action_status']|none_as_blank}} {%- if missing_stats['aborted_reason'] %}: {{missing_stats["aborted_reason"]}} @@ -140,12 +141,11 @@ var empty_data = [ {% for t, info in cc_runs|reverse %} {{',' if not loop.first }} - [ - new Date({{info["start_time_milliseconds"]}}), + [ + new Date({{info["start_time_milliseconds"]}}), {{info["detected_empty"] if info["detected_empty"] is not none else "null"}}, {{info["confirmed_empty"] if info["confirmed_empty"] is not none else "null"}}, - {{info["acted_empty"] if info["acted_empty"] is not none else "null"}}, - {{info["perm_lost"] if info["perm_lost"] is not none else "null"}} + {{info["acted_empty"] if info["acted_empty"] is not none else "null"}} ] {% endfor %} ]; @@ -218,6 +218,7 @@ missingTable.addColumn('date', 'Date'); missingTable.addColumn('number', 'Detected missing'); missingTable.addColumn('number', 'Acted missing'); + missingTable.addColumn('number', 'Permanently lost'); missingTable.addRows(missing_data); var dark_chart = new google.visualization.LineChart(document.getElementById('dark_chart')); diff --git a/monitor/server/build.sh b/monitor/server/build.sh index 9578ea7..3fdab57 100755 --- a/monitor/server/build.sh +++ b/monitor/server/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -export MONITOR_VERSION=rucio-con-mon:2.0.2 +export MONITOR_VERSION=rucio-con-mon:2.1.2 export HARBOR=registry.cern.ch/cmsrucio podman build -t $HARBOR/$MONITOR_VERSION . diff --git a/monitor/server/push.sh b/monitor/server/push.sh deleted file mode 100755 index 5c24950..0000000 --- a/monitor/server/push.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -tag=$1 - -docker tag rucio-con-mon ivmfnal/rucio_consistency_monitor:$tag -docker push ivmfnal/rucio_consistency_monitor:$tag - diff --git a/monitor/server/run.sh b/monitor/server/run.sh index 5cb5f69..fea9db1 100755 --- a/monitor/server/run.sh +++ b/monitor/server/run.sh @@ -1,4 +1,5 @@ #!/bin/bash +#.. 260326 GL: This is an old file, most likely not used at all (still uses docker!) prefix=rucio-con app=mon diff --git a/monitor/server/start.sh b/monitor/server/start.sh index fcbd6d6..b12a42e 100755 --- a/monitor/server/start.sh +++ b/monitor/server/start.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo start.sh: version 2.0.2 +echo start.sh: version 2.1.2 CC_DATA=/reports WM_DATA=/reports/unmerged