Skip to content
Snippets Groups Projects
Commit 0a615159 authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'master' into L2SS-391-boot-device

parents cda2c596 cb04275d
No related branches found
No related tags found
1 merge request!144L2SS-391: Add boot device
Showing
with 28 additions and 56 deletions
......@@ -12,14 +12,6 @@
ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE}))
export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)}
# This needs to be modified for a development environment.
# Example: ~/lofar2.0/tango
# The current setting is for a production environment.
export TANGO_LOFAR_LOCAL_DIR=${LOFAR20_DIR}/
# Optionally, the LOFAR code can be mounted elsewhere
#export TANGO_LOFAR_CONTAINER_DIR=/opt/lofar2.0/tango/
# This needs to be modified for a development environment.
# In case you run multiple Docker networks on the same host in parallel, you need to specify a unique
# network name for each of them.
......
# Before doing anything, make 100% certain that all necessary environment
# variables are set.
ifndef TANGO_LOFAR_LOCAL_DIR
# Generate the full path to the lofar20rc.sh file
# for exactly this repository.
LOFAR20RC = $(subst docker-compose,bootstrap/etc/lofar20rc.sh,$(abspath .))
$(error There are essential LOFAR2.0 environment variables missing. You must source the lofar20rc.sh file of this repo first. You can do it like this (paste without quotes): ". $(LOFAR20RC)")
endif
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))
......@@ -24,10 +16,6 @@ NETWORK_MODE ?= tangonet
# Host name through which others can reach our control interfaces
HOSTNAME ?= $(shell hostname -f)
# Default container dir & mount
TANGO_LOFAR_CONTAINER_DIR ?= /opt/lofar2.0/tango
TANGO_LOFAR_CONTAINER_MOUNT ?= ${TANGO_LOFAR_LOCAL_DIR}:$(TANGO_LOFAR_CONTAINER_DIR):rw
# If the first make argument is "start" or "stop"...
ifeq (start,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
......@@ -121,8 +109,6 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
HOSTNAME=$(HOSTNAME) \
NETWORK_MODE=$(NETWORK_MODE) \
XAUTHORITY_MOUNT=$(XAUTHORITY_MOUNT) \
TANGO_LOFAR_CONTAINER_MOUNT=$(TANGO_LOFAR_CONTAINER_MOUNT) \
TANGO_LOFAR_CONTAINER_DIR=$(TANGO_LOFAR_CONTAINER_DIR) MYSQL_HOST=$(MYSQL_HOST) \
CONTAINER_NAME_PREFIX=$(CONTAINER_NAME_PREFIX) \
COMPOSE_IGNORE_ORPHANS=true \
CONTAINER_EXECUTION_UID=$(shell id -u) \
......@@ -163,7 +149,7 @@ endif
$(DOCKER_COMPOSE_ARGS) docker-compose -f tango.yml -f networks.yml up -d
start: up ## start a service (usage: make start <servicename>)
if [ $(UNAME_S) = Linux ]; then chmod a+r ~/.Xauthority; fi
if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi
$(DOCKER_COMPOSE_ARGS) docker-compose $(COMPOSE_FILE_ARGS) start $(SERVICE)
stop: ## stop a service (usage: make stop <servicename>)
......
......@@ -70,7 +70,7 @@ services:
json2tango -w -a -u /tango-archiver/data/archiver-devices.json &&
sleep infinity"
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
- ../docker/tango/tango-archiver:/tango-archiver
restart: on-failure
......
......@@ -27,7 +27,7 @@ services:
ports:
- "5705:5705" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- /var/run/docker.sock:/var/run/docker.sock:rw # we want to control our sibling containers, NOT do docker-in-docker (dind)
user: ${CONTAINER_EXECUTION_UID}:${DOCKER_GID} # user that starts this container by definition has access rights to docker
environment:
......@@ -40,5 +40,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/docker_device.py LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705
- python3 -u /opt/lofar/tango/devices/devices/docker_device.py LTS -v -ORBendPoint giop:tcp:0:5705 -ORBendPointPublish giop:tcp:${HOSTNAME}:5705
restart: on-failure
......@@ -26,7 +26,7 @@ services:
ports:
- "5703:5703" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -37,5 +37,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/observation_control.py LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703
- python3 -u /opt/lofar/tango/devices/devices/observation_control.py LTS -v -ORBendPoint giop:tcp:0:5703 -ORBendPointPublish giop:tcp:${HOSTNAME}:5703
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5707:5707" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/recv.py LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707
- python3 -u /opt/lofar/tango/devices/devices/recv.py LTS -v -ORBendPoint giop:tcp:0:5707 -ORBendPointPublish giop:tcp:${HOSTNAME}:5707
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5701:5701" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/sdp.py LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701
- python3 -u /opt/lofar/tango/devices/devices/sdp/sdp.py LTS -v -ORBendPoint giop:tcp:0:5701 -ORBendPointPublish giop:tcp:${HOSTNAME}:5701
restart: on-failure
......@@ -30,7 +30,7 @@ services:
- "5101:5101/tcp" # port to emit SST TCP packets on
- "5702:5702" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -41,5 +41,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/sst.py LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702
- python3 -u /opt/lofar/tango/devices/devices/sdp/sst.py LTS -v -ORBendPoint giop:tcp:0:5702 -ORBendPointPublish giop:tcp:${HOSTNAME}:5702
restart: on-failure
......@@ -27,7 +27,7 @@ services:
ports:
- "5704:5704" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -38,5 +38,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/unb2.py LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704
- python3 -u /opt/lofar/tango/devices/devices/unb2.py LTS -v -ORBendPoint giop:tcp:0:5704 -ORBendPointPublish giop:tcp:${HOSTNAME}:5704
restart: on-failure
......@@ -30,7 +30,7 @@ services:
- "5102:5102/tcp" # port to emit XST TCP packets on
- "5706:5706" # unique port for this DS
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
entrypoint:
......@@ -41,5 +41,5 @@ services:
- --
# 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 ${TANGO_LOFAR_CONTAINER_DIR}/devices/devices/sdp/xst.py LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706
- python3 -u /opt/lofar/tango/devices/devices/sdp/xst.py LTS -v -ORBendPoint giop:tcp:0:5706 -ORBendPointPublish giop:tcp:${HOSTNAME}:5706
restart: on-failure
......@@ -16,10 +16,10 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
working_dir: ${TANGO_LOFAR_CONTAINER_DIR}/devices
working_dir: /opt/lofar/tango/devices
entrypoint:
- /usr/local/bin/wait-for-it.sh
- ${TANGO_HOST}
......
......@@ -22,7 +22,7 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
environment:
- TANGO_HOST=${TANGO_HOST}
......
......@@ -23,7 +23,7 @@ services:
network_mode: host
volumes:
- ${XAUTHORITY_MOUNT}
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
environment:
- XAUTHORITY=${XAUTHORITY}
......
......@@ -20,7 +20,7 @@ services:
networks:
- control
volumes:
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${TANGO_LOFAR_LOCAL_DIR}/jupyter-notebooks:/jupyter-notebooks:rw
- ${HOME}:/hosthome
environment:
......
......@@ -27,7 +27,7 @@ services:
volumes:
- pogo:/home/tango
- ${XAUTHORITY_MOUNT}
- ${TANGO_LOFAR_CONTAINER_MOUNT}
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome:rw
environment:
- XAUTHORITY=${XAUTHORITY}
......
function help()
{
echo -e "\nERROR: ${1}\nYou must provide a file that can be accessed from within the Docker container. This is possible for files that\n\t- Have a path in \${HOME} or\n\t- Have a full file path that begins with one of \"/hosthome/\", \"/opt/lofar2.0/tango/\" or \"/opt/lofar2.0/\".\n\nWhy is that? Because the file will be loaded from within the Docker container and only some of the host's file system directories are mounted in the container."
exit -2
}
#!/bin/bash
if [ ${#} -eq 1 ]; then
file=${1}
else
help "A file name must be provided."
echo "A file name must be provided."
exit 1
fi
# copy file into container to read it from container, as the file's location
......
function help()
{
echo -e "\nERROR: ${1}\nYou must provide a file that can be accessed from within the Docker container. This is possible for files that\n\t- Have a path in \${HOME} or\n\t- Have a full file path that begins with one of \"/hosthome/\", \"/opt/lofar2.0/tango/\" or \"/opt/lofar2.0/\".\n\nWhy is that? Because the file will be loaded from within the Docker container and only some of the host's file system directories are mounted in the container."
exit -2
}
#!/bin/bash
if [ ${#} -eq 1 ]; then
file=${1}
else
help "A file name must be provided."
echo "A file name must be provided."
exit 1
fi
# copy file into container to read it from container, as the file's location
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment