Skip to content
Snippets Groups Projects

Resolve L2SS-218 "Move existing tooling to bootstrap dir"

Merged Resolve L2SS-218 "Move existing tooling to bootstrap dir"
All threads resolved!
Merged Thomas Juerges requested to merge L2SS-218-move_existing_tooling_to_bootstrap_dir into master
All threads resolved!
@@ -7,6 +7,9 @@ if [ ! -d ${HOME_DIR}/bootstrap ]; then
exit 1
fi
# Save for the moment when tango will be cloned.
OLD_HOME_DIR=${HOME_DIR}.old
trap ' exit ${?} ' ABRT EXIT HUP INT TERM QUIT ERR
@@ -22,9 +25,9 @@ function build_lofar_images()
popd
}
function remove_tango_dir()
function move_tango_dir_out_of_the_way()
{
rm -rf ${HOME_DIR}
mv ${HOME_DIR} ${OLD_HOME_DIR}
}
function remove_images()
@@ -35,31 +38,41 @@ function remove_images()
function pull_tango()
{
git clone https://git.astron.nl/lofar2.0/tango.git ${HOME_DIR}
}
function stop_images()
{
pushd ${HOME_DIR}/docker-compose && make stop
popd
# Now remove the old tango dir.
rm -rf ${OLD_HOME_DIR}
}
function clean_images()
{
# This can return a non-0 return code if the system
# has already been shut down.
# Therefore disable Bash's exit on error flag
set +e
pushd ${HOME_DIR}/docker-compose && make clean
popd
# And enable it again.
set -e
}
function start_minimal_tango()
{
pushd ${HOME_DIR}/docker-compose
make start minimal
make minimal
make start dsconfig
# Just for good measure, wait a moment and start dsconfig again
echo -e "\tWaiting for dsconfig to settle down..."
sleep 10
echo -e "\tDone.\n\tStarting dsconfig again."
make start dsconfig
popd
}
function configure_tango_db()
{
# This somehow returns with a non-0 return code.
set +e
${HOME_DIR}/sbin/update_ConfigDb.sh ${HOME_DIR}/CDB/LOFAR_ConfigDb.json
set -e
}
function configure_elk()
@@ -84,43 +97,61 @@ function start_lofar_images()
}
# Stop all Docker images.
stop_images
# Clean out the Docker volumes.
echo "-> Stopping Docker images and cleaning cleaning up their volumes..."
clean_images
echo -e "\tDone.\n"
# Delete the tango repo dir. Notice that this also deletes the bootstrap dir
# which contains this and the helper scripts.
remove_tango_dir
# Move the tango repo dir out of the way.
echo "-> Moving the tango directory ${HOME_DIR} out of the way..."
move_tango_dir_out_of_the_way
echo -e "\tDone.\n"
# Therefore, since the tango/boostrap dir is now gone, pull the repo first
# and then continue.
# Now pull the repo.
echo "-> Cloning tango's master branch to ${HOME_DIR}..."
pull_tango
echo -e "\tDone.\n"
# Now clean out the docker images.
echo "-> Deleting all Docker images from this host..."
remove_images
echo -e "\tDone.\n"
# Pull SKA's Docker images.
echo "-> Installing latest SKA Docker images on this host..."
pull_images
echo -e "\tDone.\n"
# Build all of the LOFAR Docker images.
echo "-> Building LOFAR2.0 Docker images..."
build_lofar_images
echo -e "\tDone.\n"
# Now start the basic Tango system, including dsconfig.
echo "-> Staring up a minimal Tango session..."
start_minimal_tango
echo -e "\tDone.\n"
# Load LOFAR's TangoDB.
echo "-> Configuring the Tango DB for LOFAR2.0..."
configure_tango_db
echo -e "\tDone.\n"
# Now configure the ELK container.
echo "-> Configuring the ELK container for this host..."
configure_elk
echo -e "\tDone.\n"
# Here I start ELK & Jupyter.
echo "-> Start LOFAR2.0 support containers (ELK, Jupyter, etc.)..."
start_support_images
echo -e "\tDone.\n"
# And finally start all the LOFAR images.
echo "-> Start LOFAR2.0 containers..."
start_lofar_images
echo -e "\tDone.\n"
# Now the system should be ready to use.
# For instance the cold start script could now be executed.
echo -e "-> LOFAR2.0 system rebuild was successful.\n\n"
Loading