From 7af51de989a7f6714c113b469723956540b6373d Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Sun, 3 Oct 2021 15:57:06 +0200
Subject: [PATCH] L2SS-394: Give sane defaults for TANGO_LOFAR_CONTAINER_DIR
 and TANGO_LOFAR_CONTAINER_MOUNT, so they do not have to be specified anymore.

---
 bootstrap/etc/lofar20rc.sh | 4 ++--
 docker-compose/Makefile    | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/bootstrap/etc/lofar20rc.sh b/bootstrap/etc/lofar20rc.sh
index 202ccb761..383d40f73 100755
--- a/bootstrap/etc/lofar20rc.sh
+++ b/bootstrap/etc/lofar20rc.sh
@@ -17,8 +17,8 @@ export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)}
 # The current setting is for a production environment.
 export TANGO_LOFAR_LOCAL_DIR=${LOFAR20_DIR}/
 
-export TANGO_LOFAR_CONTAINER_DIR=/opt/lofar2.0/tango/
-export TANGO_LOFAR_CONTAINER_MOUNT=${TANGO_LOFAR_LOCAL_DIR}:${TANGO_LOFAR_CONTAINER_DIR}:rw
+# 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
diff --git a/docker-compose/Makefile b/docker-compose/Makefile
index b964653b1..51d3ae08a 100644
--- a/docker-compose/Makefile
+++ b/docker-compose/Makefile
@@ -1,6 +1,6 @@
 # Before doing anything, make 100% certain that all necessary environment
 # variables are set.
-ifndef LOFAR20_DIR
+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 .))
@@ -24,6 +24,10 @@ 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
@@ -118,7 +122,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
     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) \
+    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) \
-- 
GitLab