Skip to content

Commit

Permalink
Updating for CentOS8.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderrichards committed Dec 9, 2019
1 parent a19a364 commit 6d36981
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 24 deletions.
33 changes: 18 additions & 15 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
# syntax = docker/dockerfile:1.0-experimental
FROM centos:7
ARG dirac_version=v6r21p7
from centos:8
ARG dirac_version=v6r22p6
ARG lcgtools_version=v14r1
ARG python_version=27
ARG productionsystem_version=master

RUN yum install -y centos-release-scl
RUN yum install -y rh-python36
RUN yum install -y wget git gcc
RUN yum clean all
RUN dnf swap -y coreutils-single coreutils # Fix for wrapper coreutils
RUN dnf install -y gcc git wget python2 python3 python3-devel
RUN alternatives --set python /usr/bin/python2 # Set unversioned python command to python2 for DIRAC scripts
RUN python3 -m pip install --upgrade pip setuptools wheel
RUN python3 -m pip install --upgrade productionsystem@git+https://github.com/alexanderrichards/ProductionSystem.git@$productionsystem_version
RUN dnf clean all

# DIRAC setup
RUN mkdir -p /root/dirac_ui

WORKDIR /root/dirac_ui

RUN wget -np -O dirac-install https://raw.githubusercontent.com/DIRACGrid/DIRAC/integration/Core/scripts/dirac-install.py
RUN chmod u+x dirac-install
RUN ./dirac-install -r $dirac_version -i $python_version -g $lcgtools_version
RUN ./dirac-install --dirac-os -r $dirac_version -i $python_version -g $lcgtools_version
RUN --mount=type=secret,id=proxy,dst=/tmp/x509up_u0 . /root/dirac_ui/bashrc && dirac-configure -F -S GridPP -C dips://dirac01.grid.hep.ph.ic.ac.uk:9135/Configuration/Server -I
# These two lines are necessary as git commands broken in DIRACOS so need to check out first then pip install else could do commented out line below
RUN git clone -b $productionsystem_version https://github.com/alexanderrichards/ProductionSystem.git
RUN . /root/dirac_ui/bashrc && python -m pip install --upgrade ProductionSystem/
#RUN . /root/dirac_ui/bashrc && python -m pip install -v --trusted-host github.com --upgrade productionsystem@git+https://github.com/alexanderrichards/ProductionSystem.git@$productionsystem_version
RUN rm -f dirac-install

WORKDIR /root

RUN echo "virtualenv venv3" | scl enable rh-python36 -
RUN . venv3/bin/activate && pip install --upgrade pip setuptools wheel
RUN --mount=type=ssh . venv3/bin/activate && pip install productionsystem@git+git://github.com/alexanderrichards/ProductionSystem.git@$productionsystem_version
RUN . dirac_ui/bashrc && python -m pip install --upgrade pip setuptools wheel
RUN --mount=type=ssh . dirac_ui/bashrc && python -m pip install --upgrade productionsystem@git+git://github.com/alexanderrichards/ProductionSystem.git@$productionsystem_version
## setup cron jobs - maybe not needed if mounting from outside.


WORKDIR /root

COPY startup.sh /root/startup.sh

Expand Down
6 changes: 4 additions & 2 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/usr/bin/env bash
DOCKER_BUILDKIT=1 docker build --ssh default --no-cache --progress=plain --secret id=proxy,src=/tmp/x509up_u$ID -t alexanderrichards/productionsystem:latest .
#!/bin/bash
(. ~/dirac_ui/bashrc && dirac-proxy-init -x)
#DOCKER_BUILDKIT=1 docker build --no-cache --progress=plain --secret id=proxy,src=/tmp/x509up_u`id -u` -t alexanderrichards/productionsystem:latest .
DOCKER_BUILDKIT=1 docker build --progress=plain --secret id=proxy,src=/tmp/x509up_u`id -u` -t alexanderrichards/productionsystem:latest .
46 changes: 39 additions & 7 deletions build/startup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
#!/usr/bin/env bash
#!/bin/bash

trap "stop_daemon $1 && exit 0" SIGTERM

function stop_daemon {
case "$1" in
dirac)
echo "*** Stopping DIRAC daemon. ***"
(. /root/dirac_ui/bashrc && dirac-daemon.py stop)
;;
monitoring)
echo "*** Stopping monitoring daemon. ***"
monitoring-daemon.py stop
;;
webapp)
echo "*** Stopping web app daemon. ***"
webapp-daemon.py stop
;;
all)
stop_daemon dirac
stop_daemon monitoring
stop_daemon webapp
;;
*)
echo "Unknown parameter: $1"
echo "Expected: {dirac|monitoring|webapp|all}"
exit 1
esac
}

function start_daemon {
case "$1" in
Expand All @@ -8,16 +36,16 @@ function start_daemon {
;;
monitoring)
echo "*** Starting monitoring daemon. ***"
(. /root/venv3/bin/activate && monitoring-daemon.py start)
monitoring-daemon.py start
;;
webapp)
echo "*** Starting web app daemon. ***"
(. /root/venv3/bin/activate && webapp-daemon.py start)
webapp-daemon.py start
;;
all)
start_daemon dirac
start_daemon monitoring
start_daemon webapp
start_daemon dirac
start_daemon monitoring
start_daemon webapp
;;
*)
echo "Unknown parameter: $1"
Expand All @@ -27,4 +55,8 @@ function start_daemon {
}

start_daemon $1
/bin/bash
# Allow time to receive and process SIGTERM handler
while true
do
sleep 5
done

0 comments on commit 6d36981

Please sign in to comment.