Skip to content
Snippets Groups Projects
Select Git revision
  • 219c41d13de1e38dc83b2f4c4d1b45c4da508738
  • master default protected
  • L2SS-2199-apply-dab-to-xy
  • refactor-control-power-properties
  • update-lcu-rollout-procedure
  • stop-using-mesh-gateway
  • test-pytango-10.0.3
  • deploy-components-parallel
  • L2SS-2407-swap-iers-caltable-monitoring-port
  • L2SS-2357-fix-ruff
  • sync-up-with-meta-pypcc
  • stabilise-landing-page
  • all-stations-lofar2
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • v0.52.9 protected
  • v0.52.8 protected
  • v0.52.7 protected
  • v0.55.5-r2 protected
  • v0.52.8-rc1 protected
  • v0.55.5 protected
  • v0.55.4 protected
  • 0.55.2.dev0
  • 0.55.1.dev0
  • 0.55.0.dev0
  • v0.54.0 protected
  • 0.53.2.dev0
  • 0.53.1.dev0
  • v0.52.3-r2 protected
  • remove-snmp-client
  • v0.52.3 protected
  • v0.52.3dev0 protected
  • 0.53.1dev0
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
41 results

start-ds.sh

Blame
  • 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 -- "$@"