Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 32 additions & 41 deletions monitor/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
2 changes: 2 additions & 0 deletions monitor/server/app/ce_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<th>Detected (old)</th>
<th>Confirmed</th>
<th>Declared</th>
<th>Lost</th>
<th>Action status</th>
</tr>

Expand Down Expand Up @@ -191,6 +192,7 @@
<td id="nmissing_{{rse}}_td">{% if not missing_stats["detected"] is none %}{{missing_stats["detected"]}}(...){% endif %}</td>
<td>{{missing_stats["confirmed"]|none_as_blank}}</td>
<td>{{missing_stats["acted_on"]|none_as_blank}}</td>
<td>{{missing_stats["perm_lost"]|none_as_blank}}</td>
<td class="{{missing_stats['action_status']|none_as_blank}}">
{{missing_stats['action_status']|none_as_blank}}
</td>
Expand Down
11 changes: 6 additions & 5 deletions monitor/server/app/ce_rse.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</tr>
<tr>
<th>Detected (old)</th><th>Confirmed</th><th>Quarantined</th><th>Action status</th>
<th>Detected (old)</th><th>Confirmed</th><th>Declared</th><th>Action status</th>
<th>Detected (old)</th><th>Confirmed</th><th>Declared</th><th>Perm'ly Lost</th><th>Action status</th>
<th>Detected</th><th>Confirmed</th><th>Removed</th><th>Action status</th>
</tr>
{% for t, info in cc_runs %}
Expand Down Expand Up @@ -67,6 +67,7 @@
</td>
<td>{{missing_stats["confirmed"]|none_as_blank}}</td>
<td>{{missing_stats["acted_on"]|none_as_blank}}</td>
<td>{{missing_stats["perm_lost"]|none_as_blank}}</td>
<td class="{{missing_stats['action_status']|none_as_blank}}">
{{missing_stats['action_status']|none_as_blank}}
{%- if missing_stats['aborted_reason'] %}: {{missing_stats["aborted_reason"]}}
Expand Down Expand Up @@ -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 %}
];
Expand Down Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion monitor/server/build.sh
Original file line number Diff line number Diff line change
@@ -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 .
Expand Down
7 changes: 0 additions & 7 deletions monitor/server/push.sh

This file was deleted.

1 change: 1 addition & 0 deletions monitor/server/run.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion monitor/server/start.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down