diff --git a/bin/start-DS.sh b/bin/start-DS.sh deleted file mode 100755 index 83a6eec6dd30f2e496fa03ffc6f7351d8e9a664d..0000000000000000000000000000000000000000 --- a/bin/start-DS.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -function help() -{ - why="${1}" - echo -e "*** Cannot start the Python device server.\\n${why}\\n\\n* The Python file for the device server must be the 1st parameter that is provided.\\n* The instance of this device server must be the 2nd parameter that is provided." - exit -1 -} - -# Check if the mandatory parameters are present: -# ${1}: device server's Python file -# ${2}: instance of the device server's executable in the configDB -case ${#} in - 0) - help "The device server's Python file and the instance are missing." - ;; - 1) - help "The device server's instance is missing." - ;; - *) - deviceServer="${1}" - shift - instance="${1}" - shift - ;; -esac - -# Find the path to the device server's Python file that is -# relative to the /hosthome directory (in Docker the user's -# mounted ${HOME}). -# ATTENTION -# This is assuming that the device server's Python file exists -# on the Docker's host in the user's ${HOME} directory. -runThis=$(basename "${deviceServer}") -runThis=${runThis//.sh/.py} -if [ -f "${runThis}" ]; then - myDir=${PWD} -else - myDir=${PWD}/$(dirname "${deviceServer}") -fi -deviceServerPath=${myDir/${HOME}/\/hosthome} - -# Tango log lines start with a UNIX timestamp. Replace them with the UTC time. -docker exec -it itango python3 "${deviceServerPath}/${runThis}" "${instance}" "${@}" | perl -ne 'use Time::Piece; s/^([0-9]+)/gmtime($1)->strftime("%F %T")/e; print;' diff --git a/bin/start-ds.sh b/bin/start-ds.sh new file mode 100755 index 0000000000000000000000000000000000000000..413eb7c51a69c31dad7b667eac18fc840424b848 --- /dev/null +++ b/bin/start-ds.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Serves as entrypoint script for docker containers + +# 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 + +# 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 + cd tangostationcontrol || exit 1 + python3 setup.py bdist_wheel || exit 1 + sudo pip install dist/$(ls -Art dist/ | tail -n 1) +fi + +/usr/local/bin/wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict -- $@ diff --git a/docker-compose/device-docker.yml b/docker-compose/device-docker.yml index d9e1e1e35233177ab271db395773538ed8c74ffa..cbbd1595f17f4e40568dd29d1162c96f7ef114b2 100644 --- a/docker-compose/device-docker.yml +++ b/docker-compose/device-docker.yml @@ -32,13 +32,10 @@ services: user: 1000:${DOCKER_GID} # uid 1000 is the default "tango" user environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/docker_device.py LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705 + - l2ss-docker-device LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705 restart: unless-stopped diff --git a/docker-compose/device-observation_control.yml b/docker-compose/device-observation_control.yml index 827a558a10167d29f3e0bd3402f3f84debcd3c23..b802d29af9cf34d03eecd1d7067d061b27d97688 100644 --- a/docker-compose/device-observation_control.yml +++ b/docker-compose/device-observation_control.yml @@ -29,13 +29,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/observation_control.py LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703 + - l2ss-observation-control LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703 restart: unless-stopped diff --git a/docker-compose/device-recv.yml b/docker-compose/device-recv.yml index f3bc3eea12b51b44cacbeb790d0666ced24ae169..f7ad52cae4b095e574e8a7e9e7b30ccf35ebc626 100644 --- a/docker-compose/device-recv.yml +++ b/docker-compose/device-recv.yml @@ -30,13 +30,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/recv.py LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707 + - l2ss-receiver LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707 restart: unless-stopped diff --git a/docker-compose/device-sdp.yml b/docker-compose/device-sdp.yml index 8fefa3f355eda485ea757f0859924e317b9245ee..c1d92f80e8b37969f4bccae350d0c2a191d91e36 100644 --- a/docker-compose/device-sdp.yml +++ b/docker-compose/device-sdp.yml @@ -30,13 +30,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/sdp/sdp.py LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701 + - l2ss-sdp LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701 restart: unless-stopped diff --git a/docker-compose/device-sst.yml b/docker-compose/device-sst.yml index 7d922a61badf6575d15c6f0a0489a6fac3683367..9b601efc3185cf4d10c9414a35d217b57a458e2c 100644 --- a/docker-compose/device-sst.yml +++ b/docker-compose/device-sst.yml @@ -33,13 +33,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/sdp/sst.py LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702 + - l2ss-sst LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702 restart: unless-stopped diff --git a/docker-compose/device-unb2.yml b/docker-compose/device-unb2.yml index b1d7b945c6c82c3eb6a48632a107051f9ad1abe8..fb2ea95db1bd978f7dc03ac8d22d0b0d71cdca3f 100644 --- a/docker-compose/device-unb2.yml +++ b/docker-compose/device-unb2.yml @@ -30,13 +30,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/unb2.py LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704 + - l2ss-unb2 LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704 restart: unless-stopped diff --git a/docker-compose/device-xst.yml b/docker-compose/device-xst.yml index c634e5d83fc7b28f2b8438ae59dffb7157a03f54..b85b14fada00a4d5370a7358b3b3601a8753bc7c 100644 --- a/docker-compose/device-xst.yml +++ b/docker-compose/device-xst.yml @@ -33,13 +33,10 @@ services: - ..:/opt/lofar/tango:rw environment: - TANGO_HOST=${TANGO_HOST} + working_dir: /opt/lofar/tango entrypoint: - - /usr/local/bin/wait-for-it.sh - - ${TANGO_HOST} - - --timeout=30 - - --strict - - -- + - bin/start-ds.sh # configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # can't know about our Docker port forwarding - - python3 -u /opt/lofar/tango/devices/devices/sdp/xst.py LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706 + - l2ss-xst LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706 restart: unless-stopped diff --git a/docker-compose/itango/lofar-requirements.txt b/docker-compose/itango/lofar-requirements.txt index 1349c50ca993b51bb866a7880e3e7fb185049de8..c3b73750dd4c9bb86e1174afa2a2987aed46c0fd 100644 --- a/docker-compose/itango/lofar-requirements.txt +++ b/docker-compose/itango/lofar-requirements.txt @@ -1,8 +1,5 @@ parso == 0.7.1 jedi == 0.17.2 -asyncua -astropy +astropy +GitPython >= 3.1.24 # BSD python-logstash-async -gitpython -PyMySQL[rsa] -sqlalchemy diff --git a/docker-compose/lofar-device-base/lofar-requirements.txt b/docker-compose/lofar-device-base/lofar-requirements.txt index 31b22c71689b481357cef56bf4940c1575a3b01d..7cadcb9cc831345b7abd878743c048b778079b6b 100644 --- a/docker-compose/lofar-device-base/lofar-requirements.txt +++ b/docker-compose/lofar-device-base/lofar-requirements.txt @@ -1,7 +1,4 @@ -asyncua astropy python-logstash-async -gitpython -PyMySQL[rsa] -sqlalchemy docker +GitPython >= 3.1.24 # BSD diff --git a/tangostationcontrol/requirements.txt b/tangostationcontrol/requirements.txt index fc06d01e71d930c157dce02091e715a661f0f3a0..fdef2e56d564d2b75204e888df9e4a7b0155f8a3 100644 --- a/tangostationcontrol/requirements.txt +++ b/tangostationcontrol/requirements.txt @@ -2,7 +2,7 @@ # order of appearance. Changing the order has an impact on the overall # integration process, which may cause wedges in the gate later. -opcua >= 0.98.9 +asyncua PyMySQL[rsa] sqlalchemy GitPython >= 3.1.24 # BSD