Select Git revision
start-ds.sh
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
start-ds.sh 1.44 KiB
#!/bin/bash
set -e
# Serves as entrypoint script for docker containers
if [[ ! -d "/opt/lofar/tango" ]]; then
>&2 echo "/opt/lofar/tango volume does not exist!"
exit 1
fi
# Check required support file exists
if [[ ! -f "/usr/local/bin/wait-for-it.sh" ]]; then
>&2 echo "/usr/local/bin/wait-for-it.sh file does not exist!"
exit 1
fi
# Check required environment variable is set
if [[ ! $TANGO_HOST ]]; then
>&2 echo "TANGO_HOST environment variable unset!"
exit 1
fi
# Store directory so we can return to it after installation
CWD=$(pwd)
cd /opt/lofar/tango || exit 1
# Check if configured for specific version
if [[ $TANGOSTATIONCONTROL ]]; then
# TODO (Corne): Download version from artifacts or pypi.
# Consider exit 2 an UnImplementedError
exit 2
else
# Install the package, exit 1 if it fails
# pip install ./ will _NOT_ install dependencies in requirements.txt!
rm -rf /tmp/tangostationcontrol
# Ideally we would use git copy but it can't copy on subdirectory level
# DO NOT PUT SPACES IN THE EXCLUDE LIST!
rsync -av --progress --exclude={".tox","*.egg-info","dist","build",".git","*.pyc"} /opt/lofar/tango/tangostationcontrol /tmp/
cd /tmp/tangostationcontrol || exit 1
pip -vvv install --upgrade --force-reinstall ./
fi
# Return to the stored the directory, this preserves the working_dir argument in
# docker-compose files.
cd "$CWD" || exit 1
/usr/local/bin/wait-for-it.sh "$TANGO_HOST" --timeout=30 --strict -- "$@"