Skip to content
Snippets Groups Projects
Commit 617050bb authored by Thomas Juerges's avatar Thomas Juerges
Browse files

L2SS-218 Refined the clean-up script

parent 88538150
No related branches found
No related tags found
1 merge request!33Resolve L2SS-218 "Move existing tooling to bootstrap dir"
#! /usr/bin/env bash -e
HOME_DIR=/opt/lofar2.0
HOME_DIR=${LOFAR20_DIR:-${PWD}}
if [ ! -d ${HOME_DIR}/bootstrap ]; then
# HOME_DIR/bootstrap needs to exist for this script to work.
echo -e "$(basename ${0}):\n\nERROR\n\tCannot run this script because the \"bootstrap\" cannot be found!\n\n"
exit 1
fi
trap ' exit ${?} ' ABRT EXIT HUP INT TERM QUIT ERR
trap ' popd; exit ${?} ' ABRT EXIT HUP INT TERM QUIT ERR
function pull_images()
{
pushd ${HOME_DIR}/tango/docker-compose && make pull
pushd ${HOME_DIR}/docker-compose && make pull
popd
}
function build_lofar_images()
{
pushd ${HOME_DIR}/tango/docker-compose && make build
pushd ${HOME_DIR}/docker-compose && make build
popd
}
function remove_tango_dir()
{
pushd ${HOME_DIR} && rm -rf tango
popd
rm -rf ${HOME_DIR}
}
function remove_images()
{
${HOME_DIR}/delete_all_docker_images.sh YES_DELETE_ALL
${HOME_DIR}/bootstrap/sbin/delete_all_docker_images.sh YES_DELETE_ALL
}
function pull_tango()
{
git clone https://git.astron.nl/lofar2.0/tango.git ${HOME_DIR}/tango
git clone https://git.astron.nl/lofar2.0/tango.git ${HOME_DIR}
}
function stop_images()
{
pushd ${HOME_DIR}/tango/docker-compose && make stop
pushd ${HOME_DIR}/docker-compose && make stop
popd
}
function clean_images()
{
pushd ${HOME_DIR}/tango/docker-compose && make clean
pushd ${HOME_DIR}/docker-compose && make clean
popd
}
function start_tango()
function start_minimal_tango()
{
pushd ${HOME_DIR}/tango/docker-compose
make start itango
pushd ${HOME_DIR}/docker-compose
make start minimal
make start dsconfig
popd
}
function configure_tango_db()
{
${HOME_DIR}/tango/sbin/update_ConfigDb.sh ${HOME_DIR}/tango/CDB/LOFAR_ConfigDb.json
${HOME_DIR}/sbin/update_ConfigDb.sh ${HOME_DIR}/CDB/LOFAR_ConfigDb.json
}
function configure_elk()
{
pushd ${HOME_DIR}/tango/docker-compose && make start elk-configure-host
pushd ${HOME_DIR}/docker-compose && make start elk-configure-host
popd
}
function start_support_images()
{
pushd ${HOME_DIR}/tango/docker-compose && make start elk
pushd ${HOME_DIR}/docker-compose && make start elk
make start jupyter
popd
}
function start_lofar_images()
{
pushd ${HOME_DIR}/tango/docker-compose
pushd ${HOME_DIR}/docker-compose
make start device-pcc
make start device-sdp
popd
}
# Stop all Docker images.
stop_images
# Clean out the Docker volumes.
clean_images
# Delete the tango repo dir. Notice that this also deletes the bootstrap dir
# which contains this and the helper scripts.
remove_tango_dir
remove_images
# Therefore, since the tango/boostrap dir is now gone, pull the repo first
# and then continue.
pull_tango
# Now clean out the docker images.
remove_images
# Pull SKA's Docker images.
pull_images
# Build all of the LOFAR Docker images.
build_lofar_images
start_tango
# Now start the basic Tango system, including dsconfig.
start_minimal_tango
# Load LOFAR's TangoDB.
configure_tango_db
# Now configure the ELK container.
configure_elk
# Here I start ELK & Jupyter.
start_support_images
# And finally start all the LOFAR images.
start_lofar_images
# Now the system should be ready to use.
# For instance the cold start script could now be executed.
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