-
Notifications
You must be signed in to change notification settings - Fork 48
Build Alma9 base images for WMCore services, specifically MSUnmerged #1604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1ce38ba
cmsweb-alma9-base, dmwm-base alma9 with py3.12, msunmerged alma9
d-ylee 67362fe
Renamed Dockerfiles, separate dmwm-alma9-base
d-ylee 6dafe2c
Added alma9-gfal2 build image, add certs to cmsweb-alma9-base
d-ylee 4c3f22b
Updated base image versions in gfal and msunmerged
d-ylee 3ad0631
Updated base images for dmwm-alma9-base, gfal, msunmerged
d-ylee 0c7207b
Revert back to using Python 3.9
d-ylee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| FROM cern/alma9-base:latest | ||
| LABEL author="Dennis Lee dylee@fnal.gov" | ||
|
|
||
| # Install EPEL repository (required for voms, fetch-crl and CA-related packages) | ||
| RUN dnf -y install epel-release && dnf -y upgrade && \ | ||
| dnf install -y http://linuxsoft.cern.ch/wlcg/el9/x86_64/wlcg-repo-1.0.0-1.el9.noarch.rpm && \ | ||
| dnf clean all | ||
|
|
||
| # Upgrade packages from the base image and install CMSWEB required packages | ||
| RUN dnf -y install fetch-crl cern-get-certificate CERN-CA-certs ca-certificates \ | ||
| wlcg-voms-cms && \ | ||
| dnf clean all | ||
|
|
||
| # Required OS packages | ||
| RUN dnf -y install vim less procps python3-pycurl pip && dnf clean all | ||
| RUN ln -s /usr/bin/python3 /usr/bin/python | ||
|
|
||
| RUN update-ca-trust | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| FROM registry.cern.ch/cmsweb/cmsweb-alma9-base:20250506 AS cmsweb-base | ||
| FROM registry.cern.ch/cmsweb/exporters AS exporters | ||
| FROM almalinux:latest | ||
| LABEL org.opencontainers.image.authors="Alan Malta alan.malta@cern.ch" | ||
|
|
||
| # base image stuff: certificates, monitoring, exporters, etc | ||
| RUN mkdir /etc/grid-security | ||
| COPY --from=cmsweb-base /etc/grid-security/certificates /etc/grid-security/certificates | ||
| COPY --from=cmsweb-base /etc/grid-security/vomsdir /etc/grid-security/vomsdir | ||
| COPY --from=exporters /data/cmsweb-ping /usr/bin/cmsweb-ping | ||
| COPY --from=exporters /data/process_exporter /usr/bin/process_exporter | ||
| COPY --from=exporters /data/cpy_exporter /usr/bin/cpy_exporter | ||
|
|
||
| # Required OS packages | ||
| RUN dnf -y upgrade && \ | ||
| dnf -y install --skip-broken curl libcurl && \ | ||
| dnf -y install sudo vim less procps && \ | ||
| dnf -y install python3.12 python3.12-pip python3-pycurl pip && \ | ||
| dnf clean all | ||
| RUN ln -s /usr/bin/python3.12 /usr/bin/python | ||
|
|
||
| ENV WDIR=/data | ||
| ADD run.sh $WDIR/run.sh | ||
| ADD monitor.sh $WDIR/monitor.sh | ||
| ADD manage $WDIR/manage | ||
| WORKDIR /data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| FROM registry.cern.ch/cmsweb/dmwm-base:alma9-py3.12-20250506 | ||
| LABEL org.opencontainers.image.authors="Alan Malta alan.malta@cern.ch" | ||
|
|
||
| # Specific MSUnmerged requirements from epel repository | ||
| RUN dnf install epel-release -y && dnf clean all && \ | ||
| dnf -y install python3-gfal2-util gfal2-plugin-http gfal2-plugin-dcap gfal2-plugin-file \ | ||
| gfal2-plugin-srm gfal2-plugin-xrootd gfal2-plugin-gridftp gfal2-plugin-sftp && \ | ||
| dnf clean all | ||
|
|
||
| # Specific run.sh for MSUnmerged | ||
| ENV WDIR=/data | ||
| WORKDIR $WDIR | ||
| ADD run.sh $WDIR/run.sh | ||
|
|
||
| # TAG to be passed at build time through `--build-arg TAG=<PYPI_TAG>`. Default: None | ||
| ARG TAG=None | ||
| # We already installed gfal2 via dnf, so first install only non-gfal2 service dependencies | ||
| # FIXME: it is probably best to remove it from the requirements.txt file | ||
| RUN curl -ksLO https://raw.githubusercontent.com/dmwm/WMCore/$TAG/requirements.txt | ||
| RUN cat requirements.txt | grep dbs3-client > req.txt | ||
| RUN cat requirements.txt | grep msunmerged | grep -v gfal2 >> req.txt | ||
| # Create venv based on environment python, | ||
| # install modified requirements, | ||
| # and install MSUnmerged itself, without any dependencies | ||
| RUN python -m venv .venv && \ | ||
| .venv/bin/pip install -r req.txt && \ | ||
| .venv/bin/pip install --no-deps msunmerged==$TAG | ||
|
|
||
| # add venv to the path to use the proper python3 | ||
| ENV PATH="/data/.venv/bin:$PATH" | ||
|
|
||
| # and now setup run.sh and manage scripts accordingly | ||
| RUN sed -i -e "s,-config.py,-config-unmerged.py,g" /data/run.sh | ||
| RUN sed -i -e "s,config.py,config-unmerged.py,g" /data/manage | ||
| ENV USER=_reqmgr2ms | ||
| RUN useradd ${USER} && install -o ${USER} -d ${WDIR} | ||
| RUN echo "%$USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
| USER ${USER} | ||
| RUN sudo chown -R $USER.$USER $WDIR | ||
| CMD ["python3"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a clean base image. I would suggest discussing this with Aroosha to see if there is anything that we can reuse from different images, or if CMSWEB could actually adopt this image as base for other services.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alan,
I would recommend against adopting pypi/alma-base as the base image for other services for several reasons:
Lack of Generality: A base image should be minimal and serve as a common foundation for all services, regardless of the programming language or specific team requirements. alma-base is tailored to the needs of the WM group and includes packages such as
curl-minimal, libcurl-minimal, vim, python3-pycurl, pip, sudo, and less. These are not broadly applicable—for example,Pythonis irrelevant for Go-based applications, and tools likevimare unnecessary unless one intends to log into containers for interactive editing, which we generally discourage.On-Demand Tooling: Tools like
vimorcurlshould be installed on demand within a pod when needed for debugging or maintenance. This can be done easily using standard package managers (yum, dnf, apt-get, etc.). This approach keeps the base image lean and reduces the surface area for potential vulnerabilities, while still allowing flexibility for developers. Once debugging or inspection is complete, the pod should be terminated and allowed to restart in a clean state, in line with the stateless nature of Kubernetes workloads.Security implications: Each package added to a base image introduces additional dependencies and potential vulnerabilities. If a service does not require these tools, including them unnecessarily increases risk and image size without clear benefit.
While the alma-base image may be appropriate for the WM group's specific needs, I would suggest that we not promote it as the standard base for all services.
As a side note, the only consistently shared requirement across our services appears to be access to CA certificates. However, the CMSWEB team has recently transitioned to retrieving these from Kubernetes nodes, now that CERN IT provides them via cluster configuration. This might even allow us to remove them from the CMSWEB base image in the future, though that's a separate discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree with basically everything that you said.
I think the base image needs to provide requirements that we have for CERN-related systems only (mostly CAs as you pointed out). Nonetheless, if this one is still more inflated than it needs, it is already progress compared to the CC7 base image that many of the services still rely on.