Skip to content
Snippets Groups Projects
Commit 00fe5c75 authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-287: Update docker entry points

parent c74cc9cd
No related branches found
No related tags found
Loading
#!/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;'
#!/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 -- $@
...@@ -32,13 +32,10 @@ services: ...@@ -32,13 +32,10 @@ services:
user: 1000:${DOCKER_GID} # uid 1000 is the default "tango" user user: 1000:${DOCKER_GID} # uid 1000 is the default "tango" user
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -29,13 +29,10 @@ services: ...@@ -29,13 +29,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -30,13 +30,10 @@ services: ...@@ -30,13 +30,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -30,13 +30,10 @@ services: ...@@ -30,13 +30,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -33,13 +33,10 @@ services: ...@@ -33,13 +33,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -30,13 +30,10 @@ services: ...@@ -30,13 +30,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
...@@ -33,13 +33,10 @@ services: ...@@ -33,13 +33,10 @@ services:
- ..:/opt/lofar/tango:rw - ..:/opt/lofar/tango:rw
environment: environment:
- TANGO_HOST=${TANGO_HOST} - TANGO_HOST=${TANGO_HOST}
working_dir: /opt/lofar/tango
entrypoint: entrypoint:
- /usr/local/bin/wait-for-it.sh - bin/start-ds.sh
- ${TANGO_HOST}
- --timeout=30
- --strict
- --
# configure CORBA to _listen_ on 0:port, but tell others we're _reachable_ through ${HOSTNAME}:port, since CORBA # 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 # 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 restart: unless-stopped
parso == 0.7.1 parso == 0.7.1
jedi == 0.17.2 jedi == 0.17.2
asyncua astropy
astropy GitPython >= 3.1.24 # BSD
python-logstash-async python-logstash-async
gitpython
PyMySQL[rsa]
sqlalchemy
asyncua
astropy astropy
python-logstash-async python-logstash-async
gitpython
PyMySQL[rsa]
sqlalchemy
docker docker
GitPython >= 3.1.24 # BSD
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# order of appearance. Changing the order has an impact on the overall # order of appearance. Changing the order has an impact on the overall
# integration process, which may cause wedges in the gate later. # integration process, which may cause wedges in the gate later.
opcua >= 0.98.9 asyncua
PyMySQL[rsa] PyMySQL[rsa]
sqlalchemy sqlalchemy
GitPython >= 3.1.24 # BSD GitPython >= 3.1.24 # BSD
......
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