From 17f2d102743c3a848c10fe72f1b368142770dc97 Mon Sep 17 00:00:00 2001 From: goughes Date: Fri, 9 Nov 2018 20:58:15 +0100 Subject: [PATCH] First pass at installing wmagent with pip in docker --- wmagent/Dockerfile | 28 +++++++++++++- wmagent/bintray-apache-couchdb-rpm.repo | 6 +++ wmagent/oracle_install.sh | 51 +++++++++++++++++++++++++ wmagent/pydistutils.cfg | 2 + 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 wmagent/bintray-apache-couchdb-rpm.repo create mode 100644 wmagent/oracle_install.sh create mode 100644 wmagent/pydistutils.cfg diff --git a/wmagent/Dockerfile b/wmagent/Dockerfile index c048112..fc97fa7 100644 --- a/wmagent/Dockerfile +++ b/wmagent/Dockerfile @@ -4,6 +4,19 @@ FROM gitlab-registry.cern.ch/cmsdocks/dmwm:wmcore_base_test #RUN echo "Updating the base system - 2017-06-16" #RUN yum -y install cern-get-sso-cookie && yum clean all +# We need pip and virtualenv +RUN yum -y install python2-pip python-virtualenv + +# WMAgent RPM dependencies +RUN yum -y install gcc openssl-devel libcurl-devel mariadb mariadb-devel jemalloc + +# Condor Installation - we probaby should build this ourselves +RUN yum -y install condor + +# Install CouchDB +COPY bintray-apache-couchdb-rpm.repo /etc/yum.repos.d/bintray-apache-couchdb-rpm.repo +RUN yum -y install couchdb + RUN echo "Adding the AFS cmst1:zh user" RUN groupadd -g 1399 zh RUN adduser -u 31961 -g 1399 cmst1 @@ -24,6 +37,13 @@ RUN chown -R 31961:1399 /data/srv/ # Switch user USER cmst1 +# Install Oracle +COPY oracle_install.sh /home/cmst1/oracle_install.sh +RUN sh /home/cmst1/oracle_install.sh +RUN rm -f /home/cmst1/oracle_install.sh + +ENV ORACLE_HOME=/data/srv/depend/oracle + # setup a fake service certificate RUN ls -l /data #WORKDIR /data/certs @@ -37,7 +57,13 @@ WORKDIR /data/srv # Install cms-bot and WMCore RUN echo "Installing WMAgent" -RUN sh deploy-wmagent.sh -w 1.1.15.patch5 -d HG1808g -t testbed-docker +#RUN sh deploy-wmagent.sh -w 1.1.15.patch5 -d HG1808g -t testbed-docker + +# Set up the wmagent virtualenv +COPY pydistutils.cfg /home/cmst1/.pydistutils.cfg +RUN virtualenv wmagent +RUN /bin/bash -c "source wmagent/bin/activate; pip --no-cache-dir install wmagent; deactivate" +#RUN pip install wmagent RUN echo "Installation completed!" #Finished diff --git a/wmagent/bintray-apache-couchdb-rpm.repo b/wmagent/bintray-apache-couchdb-rpm.repo new file mode 100644 index 0000000..a58afd9 --- /dev/null +++ b/wmagent/bintray-apache-couchdb-rpm.repo @@ -0,0 +1,6 @@ +[bintray--apache-couchdb-rpm] +name=bintray--apache-couchdb-rpm +baseurl=http://apache.bintray.com/couchdb-rpm/el$releasever/$basearch/ +gpgcheck=0 +repo_gpgcheck=0 +enabled=1 diff --git a/wmagent/oracle_install.sh b/wmagent/oracle_install.sh new file mode 100644 index 0000000..6a709a6 --- /dev/null +++ b/wmagent/oracle_install.sh @@ -0,0 +1,51 @@ +# This script is based off of the spec file for the CMS oracle rpm +# https://github.com/cms-sw/cmsdist/blob/comp_gcc630/oracle.spec + +set -x +INSTALLDIR=/data/srv/depend/oracle +CLIENTDIR=$INSTALLDIR/instantclient_11_2 + +mkdir -p $INSTALLDIR +cd $INSTALLDIR + +# Grab instant client from cmsrep +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/20150918-instantclient-basic-linux.x64-11.2.0.4.0.zip +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/20150918-instantclient-basiclite-linux.x64-11.2.0.4.0.zip +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/20150918-instantclient-jdbc-linux.x64-11.2.0.4.0.zip +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/20150918-instantclient-sdk-linux.x64-11.2.0.4.0.zip +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/20150918-instantclient-sqlplus-linux.x64-11.2.0.4.0.zip +wget http://cmsrep.cern.ch/cmssw/oracle-mirror/oracle-license + +# Unzip the files +for f in $(ls *.zip); do + unzip -o $f +done + +# Delete the zips +rm -f $INSTALLDIR/*.zip + +# Set up directory structure and move files to appropriate places +mkdir -p $INSTALLDIR/{bin,lib,java,demo,include,doc} +mv $CLIENTDIR/*_README $CLIENTDIR/sdk/*_README $INSTALLDIR/doc +mv $CLIENTDIR/lib* $INSTALLDIR/lib +mv $CLIENTDIR/glogin.sql $INSTALLDIR/bin +mv $CLIENTDIR/*.jar $CLIENTDIR/sdk/*.zip $INSTALLDIR/java +mv $CLIENTDIR/sdk/demo/* $INSTALLDIR/demo +mv $CLIENTDIR/sdk/include/* $INSTALLDIR/include + +cd $CLIENTDIR +for f in sqlplus adrci genezi uidrvci sdk/ott; do + [ -f $f ] || continue + mv $f $INSTALLDIR/bin +done + +cd $INSTALLDIR/lib +for f in lib*.{dylib,so}.[0-9]*; do + [ -f $f ] || continue + dest=$(echo $f | sed 's/\.[.0-9]*$//') + rm -f $dest + ln -s $f $dest +done + +# Cleanup +rm -rf $CLIENTDIR diff --git a/wmagent/pydistutils.cfg b/wmagent/pydistutils.cfg new file mode 100644 index 0000000..d8c2896 --- /dev/null +++ b/wmagent/pydistutils.cfg @@ -0,0 +1,2 @@ +[build_ext] +include_dirs=/data/srv/depend/oracle/include