Skip to content

Commit 78c74f2

Browse files
bziemonsGeogouz
authored andcommitted
feat(Containers): webui: switch to virtualenv for j2 installation
Issue: rucio#458 feat(Containers): ui: switch to virtualenv for rucio and webui pip installation Issue: rucio#458 feat(Containers): server: switch to virtualenv for rucio pip installation Issue: rucio#458 feat(Containers): probes: switch to virtualenv for rucio pip installation Issue: rucio#458 feat(Containers): init: switch to virtualenv for rucio pip installation Issue: rucio#458 feat(Containers): fts-cron: switch to virtualenv for j2 installation Issue: rucio#458 feat(Containers): fs: switch to clients image virtualenv Issue: rucio#458 feat(Containers): dev: switch to virtualenv for dependencies installation Issue: rucio#458 feat(Containers): daemons: switch to virtualenv for rucio pip installation Issue: rucio#458 feat(Containers): clients: switch to virtualenv for rucio pip installation Issue: rucio#458
1 parent 44bf636 commit 78c74f2

19 files changed

+115
-135
lines changed

clients/Dockerfile

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ RUN dnf -y install yum-utils epel-release.noarch && \
99
gfal2-all \
1010
python3-gfal2-util \
1111
python3-gfal2 \
12-
python3-pip \
1312
nordugrid-arc-client \
1413
nordugrid-arc-plugins-gfal \
1514
nordugrid-arc-plugins-globus \
@@ -19,17 +18,13 @@ RUN dnf -y install yum-utils epel-release.noarch && \
1918
xrootd-client && \
2019
dnf clean all && \
2120
rm -rf /var/cache/dnf
22-
23-
# Downgrade setuptools to avoid compatibility issues
24-
# TODO: remove once https://github.com/rucio/containers/issues/458 is resolved
25-
RUN dnf -y install https://vault.almalinux.org/9.6/BaseOS/x86_64/os/Packages/python3-setuptools-53.0.0-13.el9_6.1.noarch.rpm
26-
27-
# Upgrade pip & setuptools and install Rucio
28-
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
29-
python3 -m pip install --no-cache-dir --upgrade setuptools && \
30-
python3 -m pip install --no-cache-dir --pre rucio-clients[argcomplete]==$TAG && \
31-
python3 -m pip install --no-cache-dir jinja2 j2cli pyyaml
3221

22+
# Create venv, upgrade pip & setuptools and install Rucio
23+
RUN python3 -m venv --system-site-packages /opt/rucio && \
24+
/opt/rucio/bin/pip install --no-cache-dir --upgrade pip && \
25+
/opt/rucio/bin/pip install --no-cache-dir --upgrade setuptools && \
26+
/opt/rucio/bin/pip install --no-cache-dir --pre rucio-clients[argcomplete]==$TAG && \
27+
/opt/rucio/bin/pip install --no-cache-dir jinja2 j2cli pyyaml
3328

3429
# Add a separate user and change ownership of config dir to that user
3530
RUN groupadd -g 1000 user && \
@@ -47,15 +42,16 @@ ADD --chown=user:user rucio.default.cfg /opt/user/rucio.default.cfg
4742
ADD init_rucio.sh /etc/profile.d/rucio_init.sh
4843
ADD --chown=user;user ./entrypoint.sh /opt/user/entrypoint.sh
4944

50-
ENV PATH $PATH:/opt/rucio/bin
45+
# prepends venv with python to PATH, because there might be scripts depending on python being the correct executable
46+
ENV PATH /opt/rucio/bin:$PATH
5147

5248
ARG POLICY_PACKAGE_REQUIREMENTS
5349
ARG USER=root
5450
USER root
5551
RUN if [ -n "$POLICY_PACKAGE_REQUIREMENTS" ]; then \
5652
dnf install -y git && \
5753
for package in $(echo $POLICY_PACKAGE_REQUIREMENTS | tr "," "\n"); do \
58-
python3 -m pip install --no-cache-dir $package; \
54+
/opt/rucio/bin/pip install --no-cache-dir $package; \
5955
done; \
6056
dnf remove -y git && \
6157
dnf autoremove && \

clients/init_rucio.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ shopt -s checkwinsize
77
if [ ! -f /opt/rucio/etc/rucio.cfg ]; then
88
echo "File rucio.cfg not found. It will generate one."
99
mkdir -p /opt/rucio/etc/
10-
python3 /usr/local/rucio_client/merge_rucio_configs.py \
10+
python3 /opt/rucio/rucio/tools/merge_rucio_configs.py \
1111
-s /opt/user/rucio.default.cfg \
1212
--use-env \
1313
-d /opt/rucio/etc/rucio.cfg

daemons/Dockerfile

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ RUN dnf install -y epel-release.noarch && \
2424
patch \
2525
python-gfal2 \
2626
procps-ng \
27-
python-pip \
2827
python-mod_wsgi \
2928
sendmail \
3029
sendmail-cf \
@@ -34,6 +33,8 @@ RUN dnf install -y epel-release.noarch && \
3433
dnf clean all && \
3534
rm -rf /var/cache/dnf
3635

36+
RUN update-crypto-policies --set DEFAULT:SHA1
37+
3738
# cx_oracle requires `gcc` and Python headers, not present by default on arm64
3839
ARG TARGETARCH
3940
RUN if [ $TARGETARCH = "arm64" ]; then \
@@ -48,21 +49,18 @@ RUN rpm -i https://download.oracle.com/otn_software/linux/instantclient/1912000/
4849
echo "/usr/lib/oracle/19/client64/lib" >/etc/ld.so.conf.d/oracle.conf; \
4950
ldconfig
5051

51-
# Downgrade setuptools to avoid compatibility issues
52-
# TODO: remove once https://github.com/rucio/containers/issues/458 is resolved
53-
RUN dnf -y install https://vault.almalinux.org/9.6/BaseOS/x86_64/os/Packages/python3-setuptools-53.0.0-13.el9_6.1.noarch.rpm
54-
55-
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
56-
python3 -m pip install --no-cache-dir --upgrade setuptools
57-
RUN python3 -m pip install --no-cache-dir --pre rucio[oracle,mysql,postgresql,globus]==$TAG
52+
RUN python3 -m venv --system-site-packages /opt/rucio && \
53+
/opt/rucio/bin/pip install --no-cache-dir --upgrade pip && \
54+
/opt/rucio/bin/pip install --no-cache-dir --upgrade setuptools && \
55+
/opt/rucio/bin/pip install --no-cache-dir --pre rucio[oracle,mysql,postgresql,globus]==$TAG && \
56+
/opt/rucio/bin/pip install --no-cache-dir j2cli && \
57+
mkdir -p /var/log/rucio
5858

59-
RUN python3 -m pip install --no-cache-dir j2cli
60-
ADD rucio.config.default.cfg /tmp/
61-
ADD start-daemon.sh /
62-
63-
RUN update-crypto-policies --set DEFAULT:SHA1
59+
COPY rucio.config.default.cfg /tmp/
60+
COPY start-daemon.sh /
6461

65-
RUN mkdir /var/log/rucio
62+
# prepends venv with python to PATH, because there might be scripts depending on python being the correct executable
63+
ENV PATH /opt/rucio/bin:$PATH
6664

6765
VOLUME /var/log/rucio
6866
VOLUME /opt/rucio/etc
@@ -73,7 +71,7 @@ USER root
7371
RUN if [ -n "$POLICY_PACKAGE_REQUIREMENTS" ]; then \
7472
dnf install -y git && \
7573
for package in $(echo $POLICY_PACKAGE_REQUIREMENTS | tr "," "\n"); do \
76-
python3 -m pip install --no-cache-dir $package; \
74+
/opt/rucio/bin/pip install --no-cache-dir $package; \
7775
done; \
7876
dnf remove -y git && \
7977
dnf autoremove && \

daemons/start-daemon.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if [ -f /opt/rucio/etc/rucio.cfg ]; then
44
echo "rucio.cfg already mounted."
55
else
66
echo "rucio.cfg not found. will generate one."
7-
python3 /usr/local/rucio/tools/merge_rucio_configs.py \
7+
python3 /opt/rucio/rucio/tools/merge_rucio_configs.py \
88
-s /tmp/rucio.config.default.cfg $RUCIO_OVERRIDE_CONFIGS \
99
--use-env \
1010
-d /opt/rucio/etc/rucio.cfg
@@ -46,7 +46,7 @@ then
4646

4747
if [ -s ${tmp_bin_file} ]
4848
then
49-
if patch -p2 -d "/usr/local/bin/" < ${tmp_bin_file}
49+
if patch -p2 -d "/opt/rucio/bin/" < ${tmp_bin_file}
5050
then
5151
echo "Patch ${patchfile}/bin applied."
5252
else
@@ -85,7 +85,7 @@ echo "starting daemon with: $RUCIO_DAEMON $RUCIO_DAEMON_ARGS"
8585
echo ""
8686

8787
if [ -z "$RUCIO_ENABLE_LOGS" ]; then
88-
eval "exec /usr/bin/python3 /usr/local/bin/rucio-$RUCIO_DAEMON $RUCIO_DAEMON_ARGS"
88+
eval "exec rucio-$RUCIO_DAEMON $RUCIO_DAEMON_ARGS"
8989
else
90-
eval "exec /usr/bin/python3 /usr/local/bin/rucio-$RUCIO_DAEMON $RUCIO_DAEMON_ARGS >> /var/log/rucio/daemon.log 2>> /var/log/rucio/error.log"
90+
eval "exec rucio-$RUCIO_DAEMON $RUCIO_DAEMON_ARGS >> /var/log/rucio/daemon.log 2>> /var/log/rucio/error.log"
9191
fi

dev/Dockerfile

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ RUN dnf -y install yum-utils epel-release.noarch && \
4141
nmap-ncat \
4242
openssh-clients \
4343
openssl-devel \
44-
python3-setuptools \
45-
python3-pip \
4644
python3-devel \
4745
python3-mod_wsgi \
4846
python3-m2crypto \
@@ -62,22 +60,19 @@ RUN curl https://rclone.org/install.sh | bash
6260
RUN git clone --depth 1 --branch "$TAG" https://github.com/rucio/rucio.git /tmp/rucio && rm -rf /tmp/rucio/.git
6361

6462
ENV RUCIOHOME=/opt/rucio
65-
RUN mkdir -p $RUCIOHOME && \
66-
mkdir -p $RUCIOHOME/etc/multi_vo/tst/etc && \
67-
mkdir -p $RUCIOHOME/etc/multi_vo/ts2/etc
63+
RUN python3 -m venv --system-site-packages "$RUCIOHOME" && \
64+
mkdir -p "$RUCIOHOME/etc/multi_vo/tst/etc" \
65+
"$RUCIOHOME/etc/multi_vo/ts2/etc" \
66+
"$RUCIOHOME/lib/rucio" \
67+
"$RUCIOHOME/tools"
6868
WORKDIR $RUCIOHOME
69-
RUN mkdir -p \
70-
bin \
71-
etc \
72-
lib/rucio \
73-
tools
69+
ENV PATH=$RUCIOHOME/bin:$PATH
7470

75-
RUN python3 -m pip install --no-cache --upgrade pip && \
76-
python3 -m pip install --no-cache --upgrade setuptools wheel && \
77-
python3 -m pip install --no-cache --upgrade -r /tmp/rucio/requirements/requirements.dev.txt ; \
78-
ln -s $RUCIOHOME/lib/rucio /usr/local/lib/python3.9/site-packages/rucio
79-
80-
RUN python3 -m pip install --no-cache --upgrade fts3
71+
RUN "$RUCIOHOME/bin/pip" install --no-cache --upgrade pip && \
72+
"$RUCIOHOME/bin/pip" install --no-cache --upgrade setuptools wheel && \
73+
"$RUCIOHOME/bin/pip" install --no-cache --upgrade -r /tmp/rucio/requirements/requirements.dev.txt && \
74+
"$RUCIOHOME/bin/pip" install --no-cache --upgrade fts3 && \
75+
ln -s ../../rucio "$RUCIOHOME/lib/python3.9/site-packages/rucio"
8176

8277
COPY .pep8 .pep8
8378
COPY .flake8 .flake8
@@ -109,25 +104,23 @@ RUN chmod 777 /var/log/rucio/trace && \
109104
echo "" > /etc/httpd/conf.d/welcome.conf && \
110105
echo "" > /etc/httpd/conf.d/zgridsite.conf
111106

112-
COPY logshow restartweb run_daemons create_monit_data /usr/local/bin/
107+
COPY logshow restartweb run_daemons create_monit_data $RUCIOHOME/bin/
113108
COPY monit-entrypoint.sh /monit-entrypoint.sh
114109

115110
COPY dashboards/* $RUCIOHOME/etc/dashboards/
116111
COPY rse_repository.json $RUCIOHOME/etc/rse_repository.json
117112

118113
RUN rm -r /tmp/rucio && \
119-
chmod +x /usr/local/bin/logshow && \
120-
chmod +x /usr/local/bin/restartweb && \
121-
chmod +x /usr/local/bin/run_daemons && \
122-
chmod +x /usr/local/bin/create_monit_data && \
123-
chmod +x $RUCIOHOME/etc/dashboards/import_dashboards.sh && \
124-
chmod +x /monit-entrypoint.sh && \
125-
ln -fs /usr/bin/python3 /usr/bin/python
114+
chmod +x "$RUCIOHOME/bin/logshow" \
115+
"$RUCIOHOME/bin/restartweb" \
116+
"$RUCIOHOME/bin/run_daemons" \
117+
"$RUCIOHOME/bin/create_monit_data" \
118+
"$RUCIOHOME/etc/dashboards/import_dashboards.sh" \
119+
/monit-entrypoint.sh
126120

127121
RUN update-crypto-policies --set DEFAULT:SHA1
128122

129123
EXPOSE 443
130-
ENV PATH $PATH:$RUCIOHOME/bin
131124
RUN mkdir /tmp/prometheus && chown apache:apache /tmp/prometheus/
132125
ENV PROMETHEUS_MULTIPROC_DIR /tmp/prometheus
133126
CMD ["httpd","-D","FOREGROUND"]

fs/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN dnf -y install \
1313
rm -rf /var/cache/dnf
1414

1515
ENV HOME=/opt/app-root/src \
16-
PATH=/opt/app-root/src/bin:/opt/app-root/bin:/opt/rh/devtoolset-9/root/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
16+
PATH=/opt/app-root/src/bin:/opt/app-root/bin:/opt/rh/devtoolset-9/root/usr/bin/:/opt/rucio/bin:$PATH
1717
ENV BASH_ENV=/opt/app-root/etc/scl_enable \
1818
ENV=/opt/app-root/etc/scl_enable
1919

@@ -23,7 +23,6 @@ RUN git clone --recursive https://github.com/rucio/fuse-posix.git
2323
WORKDIR /opt/fuse-posix
2424
RUN /bin/bash ./build.sh
2525

26-
ENV PATH $PATH:/opt/rucio/bin
2726
RUN pip3 install argcomplete
2827
RUN /etc/profile.d/rucio_init.sh
2928

fts-cron/Dockerfile_cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN dnf update -y && \
1515
dnf clean all && \
1616
rm -rf /var/cache/dnf
1717

18-
RUN dnf -y install -y httpd python-pip python-mod_wsgi libaio gcc python-devel mod_ssl openssl-devel python3-m2crypto libnsl patch xrootd-client && \
18+
RUN dnf -y install -y httpd python-mod_wsgi libaio gcc python-devel mod_ssl openssl-devel python3-m2crypto libnsl patch xrootd-client && \
1919
dnf clean all && \
2020
rm -rf /var/cache/dnf
2121

@@ -26,7 +26,7 @@ RUN chmod +x /usr/bin/kubectl
2626
# Install VOMS and FTS clients for delegating proxies
2727
RUN dnf -y install ca-certificates.noarch ca-policy-lcg fetch-crl voms-clients-cpp fts-rest-cli \
2828
wlcg-iam-lsc-atlas wlcg-iam-vomses-atlas wlcg-iam-lsc-cms wlcg-iam-vomses-cms \
29-
python-setuptools python-requests && \
29+
python-requests && \
3030
dnf clean all && \
3131
rm -rf /var/cache/dnf
3232

@@ -35,14 +35,13 @@ RUN yum -y install wget && \
3535
yum clean all && \
3636
rm -rf /var/cache/yum
3737

38-
# Downgrade setuptools to avoid compatibility issues
39-
# TODO: remove once https://github.com/rucio/containers/issues/458 is resolved
40-
RUN dnf -y install https://vault.almalinux.org/9.6/BaseOS/x86_64/os/Packages/python3-setuptools-53.0.0-13.el9_6.1.noarch.rpm
38+
RUN python3 -m venv --system-site-packages /opt/rucio && \
39+
/opt/rucio/bin/pip install --no-cache-dir --upgrade pip && \
40+
/opt/rucio/bin/pip install --no-cache-dir --upgrade setuptools && \
41+
/opt/rucio/bin/pip install --no-cache-dir j2cli
4142

42-
43-
RUN python3 -m pip install --no-cache-dir --upgrade pip
44-
RUN python3 -m pip install --no-cache-dir --upgrade setuptools
45-
RUN python3 -m pip install --no-cache-dir j2cli
43+
# prepends venv with python to PATH, because there might be scripts depending on python being the correct executable
44+
ENV PATH /opt/rucio/bin:$PATH
4645

4746
RUN mkdir -p /opt/rucio/certs/
4847
RUN mkdir -p /opt/rucio/kubeconfig/

fts-cron/Dockerfile_java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN dnf update -y && \
1414
dnf clean all && \
1515
rm -rf /var/cache/dnf
1616

17-
RUN dnf -y install httpd python-pip python-mod_wsgi libaio gcc python-devel mod_ssl openssl-devel python3-m2crypto libnsl patch xrootd-client && \
17+
RUN dnf -y install httpd python-mod_wsgi libaio gcc python-devel mod_ssl openssl-devel python3-m2crypto libnsl patch xrootd-client && \
1818
dnf clean all && \
1919
rm -rf /var/cache/dnf
2020

@@ -25,17 +25,17 @@ RUN chmod +x /usr/bin/kubectl
2525
# Install VOMS and FTS clients for delegating proxies
2626
RUN dnf -y install ca-certificates.noarch ca-policy-lcg fetch-crl voms-clients-java fts-rest-cli \
2727
wlcg-iam-lsc-atlas wlcg-iam-vomses-atlas wlcg-iam-lsc-cms wlcg-iam-vomses-cms \
28-
python-pip python-setuptools python-requests && \
28+
python-requests && \
2929
dnf clean all && \
3030
rm -rf /var/cache/dnf
3131

32-
# Downgrade setuptools to avoid compatibility issues
33-
# TODO: remove once https://github.com/rucio/containers/issues/458 is resolved
34-
RUN dnf -y install https://vault.almalinux.org/9.6/BaseOS/x86_64/os/Packages/python3-setuptools-53.0.0-13.el9_6.1.noarch.rpm
32+
RUN python3 -m venv --system-site-packages /opt/rucio && \
33+
/opt/rucio/bin/pip install --no-cache-dir --upgrade pip && \
34+
/opt/rucio/bin/pip install --no-cache-dir --upgrade setuptools && \
35+
/opt/rucio/bin/pip install --no-cache-dir j2cli
3536

36-
RUN python3 -m pip install --no-cache-dir --upgrade pip
37-
RUN python3 -m pip install --no-cache-dir --upgrade setuptools
38-
RUN python3 -m pip install --no-cache-dir j2cli
37+
# prepends venv with python to PATH, because there might be scripts depending on python being the correct executable
38+
ENV PATH /opt/rucio/bin:$PATH
3939

4040
RUN mkdir -p /opt/rucio/certs/
4141
RUN mkdir -p /opt/rucio/kubeconfig/

init/Dockerfile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,22 @@ RUN dnf install -y epel-release.noarch && \
1414
mod_ssl \
1515
procps-ng \
1616
python-devel \
17-
python3-m2crypto \
18-
python-pip && \
17+
python3-m2crypto && \
1918
dnf clean all && \
2019
rm -rf /var/cache/dnf
2120

2221
RUN rpm -i https://download.oracle.com/otn_software/linux/instantclient/1912000/oracle-instantclient19.12-basiclite-19.12.0.0.0-1.x86_64.rpm; \
2322
echo "/usr/lib/oracle/19/client64/lib" >/etc/ld.so.conf.d/oracle.conf; \
2423
ldconfig
2524

26-
# Downgrade setuptools to avoid compatibility issues
27-
# TODO: remove once https://github.com/rucio/containers/issues/458 is resolved
28-
RUN dnf -y install https://vault.almalinux.org/9.6/BaseOS/x86_64/os/Packages/python3-setuptools-53.0.0-13.el9_6.1.noarch.rpm
25+
RUN python3 -m venv --system-site-packages /opt/rucio && \
26+
/opt/rucio/bin/pip install --no-cache-dir --upgrade pip && \
27+
/opt/rucio/bin/pip install --no-cache-dir --upgrade setuptools && \
28+
/opt/rucio/bin/pip install --pre rucio[oracle,mysql,postgresql]==$TAG && \
29+
/opt/rucio/bin/pip install --no-cache-dir jinja2 j2cli pyyaml
2930

30-
RUN python3 -m pip install --no-cache-dir --upgrade pip
31-
RUN python3 -m pip install --no-cache-dir --upgrade setuptools
32-
RUN python3 -m pip install --pre rucio[oracle,mysql,postgresql]==$TAG
33-
RUN python3 -m pip install jinja2 j2cli pyyaml
31+
# prepends venv with python to PATH, because there might be scripts depending on python being the correct executable
32+
ENV PATH /opt/rucio/bin:$PATH
3433

3534
RUN mkdir -p /opt/rucio/etc
3635

@@ -45,7 +44,7 @@ USER root
4544
RUN if [ -n "$POLICY_PACKAGE_REQUIREMENTS" ]; then \
4645
dnf install -y git && \
4746
for package in $(echo $POLICY_PACKAGE_REQUIREMENTS | tr "," "\n"); do \
48-
python3 -m pip install --no-cache-dir $package; \
47+
/opt/rucio/bin/pip install --no-cache-dir $package; \
4948
done; \
5049
dnf remove -y git && \
5150
dnf autoremove && \

init/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if [ -f /opt/rucio/etc/rucio.cfg ]; then
44
echo "rucio.cfg already mounted."
55
else
6-
python3 /usr/local/rucio/tools/merge_rucio_configs.py \
6+
python3 /opt/rucio/rucio/tools/merge_rucio_configs.py \
77
-s /tmp/rucio.config.default.cfg $RUCIO_OVERRIDE_CONFIGS \
88
--use-env \
99
-d /opt/rucio/etc/rucio.cfg

0 commit comments

Comments
 (0)