Skip to content
Snippets Groups Projects
Commit 318237a7 authored by Julien Leduc's avatar Julien Leduc
Browse files

Cleaning up run scripts for containers: going along Dockerfile and in...

Cleaning up run scripts for containers: going along Dockerfile and in /opt/run/bin: /shared still available for local scripts developments.
parent 607292a5
No related branches found
No related tags found
No related merge requests found
Showing
with 13 additions and 243 deletions
......@@ -58,8 +58,8 @@ RUN yum -y install cgdb less psmisc lynx strace ltrace cta-cli && yum clean all
# Add pod specific configuration
ADD ${BASEDIR}/config ${LOCALORCHESTRATIONDIR}
# Add orchestration init scripts locally
ADD ${ORCHESTRATIONDIR}/init ${LOCALORCHESTRATIONDIR}
# Add orchestration run scripts locally
ADD ${BASEDIR}/opt /opt
# Docker image run setup
ADD ${BASEDIR}/run.sh /
......
......@@ -9,7 +9,7 @@ yum -y install cta-frontend cta-debuginfo cta-catalogueutils ceph-common
yes | cp -r /opt/ci/ctafrontend/etc /
/shared/bin/init_objectstore.sh
/opt/run/bin/init_objectstore.sh
. /tmp/objectstore-rc.sh
echo "ObjectStore BackendPath $OBJECTSTOREURL" > /etc/cta/cta-frontend.conf
......@@ -17,7 +17,7 @@ echo "Catalogue NumberOfConnections 1" >>/etc/cta/cta-frontend.conf
echo "Log URL file:/cta-frontend.log" >>/etc/cta/cta-frontend.conf
/shared/bin/init_database.sh
/opt/run/bin/init_database.sh
. /tmp/database-rc.sh
echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
......
......@@ -9,12 +9,12 @@ yum -y install cta-objectstore-tools cta-doc mt-st mtx lsscsi sg3_utils cta-cata
yum clean packages
echo "Using this configuration for library:"
/shared/bin/init_library.sh
/opt/run/bin/init_library.sh
cat /tmp/library-rc.sh
. /tmp/library-rc.sh
echo "Creating objectstore"
/shared/bin/init_objectstore.sh
/opt/run/bin/init_objectstore.sh
. /tmp/objectstore-rc.sh
if [ "$OBJECTSTORETYPE" == "file" ]; then
......@@ -33,7 +33,7 @@ else
fi
echo "Creating DB"
/shared/bin/init_database.sh
/opt/run/bin/init_database.sh
. /tmp/database-rc.sh
if [ "$DATABASETYPE" == "sqlite" ]; then
......
......@@ -7,11 +7,11 @@ yum-config-manager --enable castor
# Install missing RPMs
yum -y install mt-st mtx lsscsi sg3_utils cta-taped cta-debuginfo castor-rmc-server
/shared/bin/init_pod.sh
/opt/run/bin/init_pod.sh
# source library configuration file
echo "Using this configuration for library:"
/shared/bin/init_library.sh
/opt/run/bin/init_library.sh
cat /tmp/library-rc.sh
. /tmp/library-rc.sh
......
......@@ -7,10 +7,10 @@ yum-config-manager --enable castor
# Install missing RPMs
yum -y install mt-st mtx lsscsi sg3_utils cta-taped cta-debuginfo castor-rmc-server ceph-common
/shared/bin/init_pod.sh
/opt/run/bin/init_pod.sh
echo "Using this configuration for library:"
/shared/bin/init_library.sh
/opt/run/bin/init_library.sh
cat /tmp/library-rc.sh
. /tmp/library-rc.sh
......@@ -21,11 +21,11 @@ mkdir -p /etc/castor
tpconfig="${DRIVENAMES[${driveslot}]} ${LIBRARYNAME} /dev/${DRIVEDEVICES[${driveslot}]} smc${driveslot}"
/shared/bin/init_objectstore.sh
/opt/run/bin/init_objectstore.sh
. /tmp/objectstore-rc.sh
echo "Configuring database"
/shared/bin/init_database.sh
/opt/run/bin/init_database.sh
. /tmp/database-rc.sh
echo ${DATABASEURL} >/etc/cta/cta_catalogue_db.conf
......
#!/bin/bash
cat <<EOF > /etc/cta/cta-cli.conf
# The CTA frontend address in the form <FQDN>:<TCPPort>
# solved by kubernetes DNS server so KIS...
${frontend}
EOF
# sleep forever but exit immediately when pod is deleted
exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
#!/bin/sh
echo "ObjectStore BackendPath $objectstore" > /etc/cta/cta-frontend.conf
echo "Catalogue NumberOfConnections 1" >>/etc/cta/cta-frontend.conf
echo ${catdb} >/etc/cta/cta_catalogue_db.conf
useradd cta
# disable kerberos5 check for the admin privileges
sed -i -e "s/krb5/unix/" /usr/lib64/libXrdCtaOfs.so
runuser --shell='/bin/bash' --session-command='cd ~cta; xrootd -n cta -c /etc/xrootd/xrootd-cta.cfg -I v4' cta
#!/bin/sh
# copy library configuration from persistent volume to shared volume
mkdir -p /shared/${INSTANCE_NAME}
cp -f /library/config ${LIBRARY_CONFIG}
echo "Using this configuration for library:"
cat ${LIBRARY_CONFIG}
. ${LIBRARY_CONFIG}
rm -rf ${objectstore}
mkdir -p ${objectstore}
cta-objectstore-initialize ${objectstore}
chmod -R 777 ${objectstore}
rm -rf ${catdbdir}
mkdir -p ${catdbdir}
sqlite3 ${catdbdir}/${catdbfile} < `rpm -ql cta-doc|grep sqlite`
chmod -R 777 ${catdbdir}
# library management
# BEWARE STORAGE SLOTS START @1 and DRIVE SLOTS START @0!!
echo "Labelling tapes using the first drive in ${LIBRARYNAME}: ${DRIVENAMES[0]} on /dev/${DRIVEDEVICES[0]}:"
for ((i=0; i<${#TAPES[@]}; i++)); do
vid=${TAPES[${i}]}
tapeslot=$((${i}+1)) # tape slot is 1 for tape[0] and so on...
echo -n "${vid} in slot ${tapeslot} "
mtx -f /dev/${LIBRARYDEVICE} load ${tapeslot} 0
cd /tmp
echo "VOL1${vid} CASTOR 3">label.file
dd if=label.file of=/dev/${DRIVEDEVICES[0]} bs=80 count=1
mt -f /dev/${DRIVEDEVICES[0]} rewind
mtx -f /dev/${LIBRARYDEVICE} unload ${tapeslot} 0
echo "OK"
done
exit 0
#!/bin/bash
echo -n "Fixing reverse DNS for $(hostname): "
sed -i -c "s/^\($(hostname -i)\)\s\+.*$/\1 $(hostname -s).$(grep search /etc/resolv.conf | cut -d\ -f2) $(hostname -s)/" /etc/hosts
echo "DONE"
echo -n "Yum should resolve names using IPv4 DNS: "
echo "ip_resolve=IPv4" >> /etc/yum.conf
echo "DONE"
#!/bin/sh
# initialize pod
/shared/bin/init_pod.sh
eoshost=`hostname -f`
eosInstanceName=`hostname -s`
TAPE_FS_ID=65535
CTA_BIN=/usr/bin/cta
CTA_KT=/etc/eoscta-cli.keytab
CTA_PROC_DIR=/eos/${eosInstanceName}/proc/cta
CTA_WF_DIR=${CTA_PROC_DIR}/workflow
CTA_TEST_DIR=/eos/${eosInstanceName}/cta
# prepare CTA cli commands environment
echo ${frontend} > /etc/cta/cta-cli.conf
# setup eos host and instance name
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/sysconfig/eos
sed -i -e "s/DUMMY_INSTANCE_TO_REPLACE/${eosInstanceName}/" /etc/sysconfig/eos
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.mgm
sed -i -e "s/DUMMY_INSTANCE_TO_REPLACE/${eosInstanceName}/" /etc/xrd.cf.mgm
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.mq
sed -i -e "s/DUMMY_HOST_TO_REPLACE/${eoshost}/" /etc/xrd.cf.fst
# prepare eos startup
# skip systemd for eos initscripts
export SYSTEMCTL_SKIP_REDIRECT=1
echo y | xrdsssadmin -k ${eosInstanceName} -u daemon -g daemon add /etc/eos.keytab
chmod 400 /etc/eos.keytab
chown daemon:daemon /etc/eos.keytab
mkdir -p /run/lock/subsys
mkdir -p /var/eos/config/${eoshost}
chown daemon:root /var/eos/config/${eoshost}
touch /var/eos/config/${eoshost}/default.eoscf
chown daemon:daemon /var/eos/config/${eoshost}/default.eoscf
#/etc/init.d/eos master mgm
#/etc/init.d/eos master mq
touch /var/eos/eos.mq.master
touch /var/eos/eos.mgm.rw
echo "Configured mq mgm on localhost as master"
source /etc/sysconfig/eos
mkdir -p /fst
chown daemon:daemon /fst/
# start and setup eos for xrdcp to the ${CTA_TEST_DIR}
#/etc/init.d/eos start
/usr/bin/xrootd -n mq -c /etc/xrd.cf.mq -l /var/log/eos/xrdlog.mq -b -Rdaemon
/usr/bin/xrootd -n mgm -c /etc/xrd.cf.mgm -m -l /var/log/eos/xrdlog.mgm -b -Rdaemon
/usr/bin/xrootd -n fst -c /etc/xrd.cf.fst -l /var/log/eos/xrdlog.fst -b -Rdaemon
eos vid enable sss
eos vid enable unix
EOS_MGM_URL="root://${eoshost}" eosfstregister -r /fst default:1
eos node set ${eoshost} on
eos space set default on
eos attr -r set default=replica /eos
eos attr -r set sys.forced.nstripes=1 /eos
eos fs add -m ${TAPE_FS_ID} tape localhost:1234 /does_not_exist tape
eos mkdir ${CTA_PROC_DIR}
eos mkdir ${CTA_WF_DIR}
eos attr set CTA_TapeFsId=${TAPE_FS_ID} ${CTA_WF_DIR}
eos mkdir ${CTA_TEST_DIR}
eos chmod 777 ${CTA_TEST_DIR}
eos attr set CTA_StorageClass=ctaStorageClass ${CTA_TEST_DIR}
# hack before it is fixed in EOS
TAPE_FS_ID_TOSET=`eos attr ls ${CTA_WF_DIR} | grep CTA_TapeFsId= | tr '"' ' ' | cut -d ' ' -f 2`
eos attr set CTA_TapeFsId=${TAPE_FS_ID_TOSET} ${CTA_TEST_DIR}
# Link the attributes of CTA worklow directory to the test directory
eos attr link ${CTA_WF_DIR} ${CTA_TEST_DIR}
# test EOS
# eos slow behind us and we need to give it time to be ready
# 5 secs is not enough
sleep 10
eos -b node ls
xrdcp /etc/group root://${eoshost}:/${CTA_TEST_DIR}/testFile
# prepare EOS workflow
eos space config default space.wfe=on
# ATTENTION
# for sss authorisation unix has to be replaced by sss
# Set the worfklow rule for archiving files to tape
eos attr set sys.workflow.closew.default="bash:shell:cta XrdSecPROTOCOL=unix XrdSecSSSKT=${CTA_KT} ${CTA_BIN} archive --user <eos::wfe::rusername> --group <eos::wfe::rgroupname> --diskid <eos::wfe::fid> --instance eoscta --srcurl <eos::wfe::turl> --size <eos::wfe::size> --checksumtype <eos::wfe::checksumtype> --checksumvalue <eos::wfe::checksum> --storageclass <eos::wfe::cxattr:CTA_StorageClass> --diskfilepath <eos::wfe::path> --diskfileowner <eos::wfe::username> --diskfilegroup <eos::wfe::groupname> --recoveryblob:base64 <eos::wfe::base64:metadata> --diskpool default --throughput 10000 --stderr" ${CTA_WF_DIR}
# Set the worflow rule for creating tape file replicas in the EOS namespace
eos attr set sys.workflow.archived.default="bash:shell:cta eos file tag <eos::wfe::path> +<eos::wfe::cxattr:CTA_TapeFsId>" ${CTA_WF_DIR}
# Set the worfklow rule for retrieving file from tape
eos attr set sys.workflow.prepare.default="bash:shell:cta XrdSecPROTOCOL=unix XrdSecSSSKT=${CTA_KT} ${CTA_BIN} retrieve --user <eos::wfe::rusername> --group <eos::wfe::rgroupname> --id <eos::wfe::fxattr:sys.archiveFileId> --dsturl '<eos::wfe::turl>\&eos.injection=1\&eos.workflow=CTA_retrieve' --diskfilepath <eos::wfe::path> --diskfileowner <eos::wfe::username> --diskfilegroup <eos::wfe::groupname> --recoveryblob:base64 <eos::wfe::base64:metadata> --diskpool default --throughput 10001 --stderr" ${CTA_WF_DIR}
# Set the workflow rule for the closew event of the CTA_retrieve workflow.
# Using the CTA_retrieve workflow will prevent the default workflow from
# receiving the closew event. Triggering the default workflow in this way would
# haved causes the unwanted action of copying the disk file to tape again.
# The action of the CTA_retrieve workflow when triggered by the closew event is
# to set the CTA_retrieved_timestamp attribute.
eos attr set sys.workflow.closew.CTA_retrieve="bash:shell:cta eos attr set 'CTA_retrieved_timestamp=\"\`date\`\"' <eos::wfe::path>" ${CTA_WF_DIR}
touch /shared/${INSTANCE_NAME}/mgm_ready
/bin/bash
#!/bin/sh
/shared/bin/init_pod.sh
# source library configuration file
echo "Using this configuration for library:"
cat ${LIBRARY_CONFIG}
. ${LIBRARY_CONFIG}
# to get rmcd logs to stdout
mkfifo /var/log/castor/rmcd_legacy.log
for ((;;)); do cat </var/log/castor/rmcd_legacy.log; done &
disown
ln -s /dev/${LIBRARYDEVICE} /dev/smc
/usr/bin/rmcd -f /dev/smc
#!/bin/sh
/shared/bin/init_pod.sh
# source library configuration file
echo "Using this configuration for library:"
cat ${LIBRARY_CONFIG}
. ${LIBRARY_CONFIG}
ln -s /dev/${LIBRARYDEVICE} /dev/smc
#/usr/bin/rmcd -f /dev/smc&
mkdir -p /etc/castor
tpconfig="${DRIVENAMES[${driveslot}]} ${LIBRARYNAME} /dev/${DRIVEDEVICES[${driveslot}]} smc0"
# cta-tapserverd setup
# to be drop later
echo "${tpconfig}" > /etc/castor/TPCONFIG
echo "TapeServer ObjectStoreBackendPath $objectstore" >/etc/castor/castor.conf
echo "TapeServer BufSize 5242880" >>/etc/castor/castor.conf
echo "TapeServer NbBufs 10" >>/etc/castor/castor.conf
echo "TapeServer EOSRemoteHostAndPort ${eoshost}" >>/etc/castor/castor.conf
# cta-taped setup
echo "taped BufferCount 10" > /etc/cta/cta.conf
echo "general ObjectStoreURL ${objectstore}" >> /etc/cta/cta.conf
echo "${tpconfig}" > /etc/cta/TPCONFIG
echo ${catdb} >/etc/cta/cta_catalogue_db.conf
/bin/cta-taped --stdout --foreground
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment