diff --git a/.gitignore b/.gitignore index cfd4dc461a50e0a01b60ca0f88152e9ca9a2d787..f777364050f38eddf7f7867a0326b5dd3199074c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ tangostationcontrol/docs/build **/.eggs docker-compose/alerta-web/alerta-secrets.json +docker-compose/tmp diff --git a/bin/start-ds.sh b/bin/start-ds.sh index 8a5baba501cf7c48dd53a7d3b92196874020d3d6..2753e299ad4bc756bac864c52ab9adc0d4c47a0d 100755 --- a/bin/start-ds.sh +++ b/bin/start-ds.sh @@ -31,8 +31,11 @@ if [[ $TANGOSTATIONCONTROL ]]; then exit 2 else # Install the package, exit 1 if it fails - cd tangostationcontrol || exit 1 - pip install --upgrade --force-reinstall ./ + # pip install ./ will _NOT_ install dependencies in requirements.txt! + rm -rf /tmp/tangostationcontrol + cp -R /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 diff --git a/docker-compose/Makefile b/docker-compose/Makefile index e0689cc7ceedc874798ecf20ce32de7cd69ca6d7..a69733e84db174c05d7b4426c7df0b15e5d33f36 100644 --- a/docker-compose/Makefile +++ b/docker-compose/Makefile @@ -153,7 +153,7 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \ DOCKER_GID=$(DOCKER_GID) -.PHONY: up down minimal run integration start stop restart build build-nocache status clean pull help +.PHONY: up down minimal context run integration start stop restart build build-nocache status clean pull help .DEFAULT_GOAL := help pull: ## pull the images from the Docker hub @@ -183,13 +183,18 @@ ifneq ($(NETWORK_MODE),host) docker network inspect 9000-$(NETWORK_MODE) &> /dev/null && ([ $$? -eq 0 ] && docker network rm 9000-$(NETWORK_MODE)) || true endif -minimal: ## start the base TANGO system +minimal: context ## start the base TANGO system ifneq ($(NETWORK_MODE),host) docker network inspect $(NETWORK_MODE) &> /dev/null || ([ $$? -ne 0 ] && docker network create $(NETWORK_MODE)) docker network inspect 9000-$(NETWORK_MODE) &> /dev/null || ([ $$? -ne 0 ] && docker network create 9000-$(NETWORK_MODE) -o com.docker.network.driver.mtu=9000) endif + $(DOCKER_COMPOSE_ARGS) docker-compose -f tango.yml -f networks.yml up --no-recreate -d +context: ## Move the necessary files to create minimal docker context + @mkdir -p tmp + @cp ../tangostationcontrol/requirements.txt tmp/ + bootstrap: pull build # first start, initialise from scratch $(MAKE) start elk-configure-host # configure host kernel for elk container $(MAKE) start dsconfig # boot up containers to load configurations diff --git a/docker-compose/device-antennafield.yml b/docker-compose/device-antennafield.yml index d33dacac0139a2a2946f3c19f3cdc2979cf76e30..0e16043f1170a937d0fe16e3e2853801c3b1339b 100644 --- a/docker-compose/device-antennafield.yml +++ b/docker-compose/device-antennafield.yml @@ -19,8 +19,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-antennafield diff --git a/docker-compose/device-apsct.yml b/docker-compose/device-apsct.yml index cb43adf7b800498d4448fdcc2ef99cbf577e11d5..8addefff2bc1ead3510e835fad51187b40e4a996 100644 --- a/docker-compose/device-apsct.yml +++ b/docker-compose/device-apsct.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-apsct diff --git a/docker-compose/device-apspu.yml b/docker-compose/device-apspu.yml index 6613b210971f7514c0822cd82f5185af550f4e2a..55a2d5a9a5d95a9c0e1617bb4732a1d96ab26a20 100644 --- a/docker-compose/device-apspu.yml +++ b/docker-compose/device-apspu.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-apspu diff --git a/docker-compose/device-beamlet.yml b/docker-compose/device-beamlet.yml index 6d067c1544bb805578cfa53ba486a39313238b75..4e80eba8f4033efe31749c51c95002204a0136f4 100644 --- a/docker-compose/device-beamlet.yml +++ b/docker-compose/device-beamlet.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-beamlet diff --git a/docker-compose/device-boot.yml b/docker-compose/device-boot.yml index cbeb916536845b47aa0ded5dba2900fa1fa5d7f5..4d4108d9ffb189e05b8696039d68b2f1be20de2a 100644 --- a/docker-compose/device-boot.yml +++ b/docker-compose/device-boot.yml @@ -17,8 +17,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-boot diff --git a/docker-compose/device-bst.yml b/docker-compose/device-bst.yml index c06514b4f3a738ad45ffb847d5b261e515b58a6a..92522527c2071e9e94b9561ab010717c37c63c07 100644 --- a/docker-compose/device-bst.yml +++ b/docker-compose/device-bst.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-bst diff --git a/docker-compose/device-digitalbeam.yml b/docker-compose/device-digitalbeam.yml index 32847ca8d6ce995baeee599ea20cb1c0919b9084..c5b45e9baaef63e15f44b4a539cf93a73244bde3 100644 --- a/docker-compose/device-digitalbeam.yml +++ b/docker-compose/device-digitalbeam.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-digitalbeam diff --git a/docker-compose/device-docker.yml b/docker-compose/device-docker.yml index 2be9467ea6d63fbf08fc30e954de74a585bbe6a3..db33c9aed034fa02fbafe2bc7ab4b66535fe0f33 100644 --- a/docker-compose/device-docker.yml +++ b/docker-compose/device-docker.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-docker diff --git a/docker-compose/device-observation-control.yml b/docker-compose/device-observation-control.yml index 197d192a54ca10360439f41cfd6aeb0adeca70e3..7025b8b3ab38cbb1290971c1907729b8aa09ca0f 100644 --- a/docker-compose/device-observation-control.yml +++ b/docker-compose/device-observation-control.yml @@ -17,8 +17,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-observation-control diff --git a/docker-compose/device-observation.yml b/docker-compose/device-observation.yml index ee8f3a1653b447965af9891258de1e8642242e60..3379e41e1887d670b734a1f75f8b942ca51d17df 100644 --- a/docker-compose/device-observation.yml +++ b/docker-compose/device-observation.yml @@ -16,8 +16,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-observation diff --git a/docker-compose/device-pcon.yml b/docker-compose/device-pcon.yml index aa20c1498c3e135accd543800d9a50e41a3ea092..d90b9e1f7b24c3248f850ad3fe09f1c8ae031da5 100644 --- a/docker-compose/device-pcon.yml +++ b/docker-compose/device-pcon.yml @@ -13,8 +13,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-pcon diff --git a/docker-compose/device-psoc.yml b/docker-compose/device-psoc.yml index b7b9738b0c4d6d40f2d4ff6c2f9f0698b0957a17..bfa2bb7c48ceb1679383d36f434401387d780a1b 100644 --- a/docker-compose/device-psoc.yml +++ b/docker-compose/device-psoc.yml @@ -13,8 +13,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-psoc diff --git a/docker-compose/device-recv.yml b/docker-compose/device-recv.yml index 10126cae3612ad12ca6e77c1b191b2879091f1d4..3c79a0a149528557a0d3ca3aa087773538942207 100644 --- a/docker-compose/device-recv.yml +++ b/docker-compose/device-recv.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-recv diff --git a/docker-compose/device-sdp.yml b/docker-compose/device-sdp.yml index 2e9c77312d96b800f06e3c85e6773613a0af758b..144630c883d741c166c6f1a1c48f9e8eda5ab096 100644 --- a/docker-compose/device-sdp.yml +++ b/docker-compose/device-sdp.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-sdp diff --git a/docker-compose/device-sst.yml b/docker-compose/device-sst.yml index 54c221f3b6c051078d55009ec583d0ddab8dd46b..e6b0edb75008791f365d4ec8281c35a314935ca3 100644 --- a/docker-compose/device-sst.yml +++ b/docker-compose/device-sst.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-sst diff --git a/docker-compose/device-temperature-manager.yml b/docker-compose/device-temperature-manager.yml index 4729bd631b87508b12be14b24a9c4e1bbbccf98b..d1b20359bf0f827b99450edd93cf4687ac263532 100644 --- a/docker-compose/device-temperature-manager.yml +++ b/docker-compose/device-temperature-manager.yml @@ -13,8 +13,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-temperature-manager diff --git a/docker-compose/device-tilebeam.yml b/docker-compose/device-tilebeam.yml index 20e44c90c112c3ce7a4f3c7c09682c897c032a30..7919beded3237fecc98cddc64b734747e3187304 100644 --- a/docker-compose/device-tilebeam.yml +++ b/docker-compose/device-tilebeam.yml @@ -13,8 +13,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}-tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-tilebeam diff --git a/docker-compose/device-unb2.yml b/docker-compose/device-unb2.yml index 9a7505f0beb6b6f3f7448a402e812a86ad2c033d..2c05d6e66b887b903d17278e3252cd8f9ea70493 100644 --- a/docker-compose/device-unb2.yml +++ b/docker-compose/device-unb2.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-unb2 diff --git a/docker-compose/device-xst.yml b/docker-compose/device-xst.yml index 1ed7a1fe3892c900b14c9c275099816fb45b90a3..6f49e17f6389ff510736543d7cb42aed4ea104b9 100644 --- a/docker-compose/device-xst.yml +++ b/docker-compose/device-xst.yml @@ -18,8 +18,8 @@ services: # build explicitly, as docker-compose does not understand a local image # being shared among services. build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}device-xst diff --git a/docker-compose/integration-test.yml b/docker-compose/integration-test.yml index 346bbbcc5b179c2066c08a0064335c23957fb902..6e7e5407d422afd1989ef7a127d1f54217307cc3 100644 --- a/docker-compose/integration-test.yml +++ b/docker-compose/integration-test.yml @@ -9,8 +9,8 @@ version: '2.1' services: integration-test: build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}integration-test diff --git a/docker-compose/lofar-device-base.yml b/docker-compose/lofar-device-base.yml index 34f3f1c92c06fadd45b634a2a93bae994a54edeb..8f31696433aaee502eea2af83f15c54119b22ec7 100644 --- a/docker-compose/lofar-device-base.yml +++ b/docker-compose/lofar-device-base.yml @@ -17,8 +17,8 @@ services: lofar-device-base: image: lofar-device-base build: - context: .. - dockerfile: docker-compose/lofar-device-base/Dockerfile + context: . + dockerfile: lofar-device-base/Dockerfile args: SOURCE_IMAGE: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} container_name: ${CONTAINER_NAME_PREFIX}lofar-device-base diff --git a/docker-compose/lofar-device-base/Dockerfile b/docker-compose/lofar-device-base/Dockerfile index 39b9d652f61d4afb3903b0ea98e3df98f51d2b8a..becc95d0833408a8e4a04f074bff9ed0b0b2b6da 100644 --- a/docker-compose/lofar-device-base/Dockerfile +++ b/docker-compose/lofar-device-base/Dockerfile @@ -4,20 +4,23 @@ FROM ${SOURCE_IMAGE} RUN sudo apt-get update && sudo apt-get install -y git g++ gcc shellcheck graphviz python3-dev && sudo apt-get clean -COPY docker-compose/lofar-device-base/lofar-requirements.txt /lofar-requirements.txt +COPY lofar-device-base/lofar-requirements.txt /lofar-requirements.txt RUN sudo pip3 install -r /lofar-requirements.txt -COPY tangostationcontrol/requirements.txt /tangostationcontrol-requirements.txt +# Manually install all requirements from the .txt as part of the base image +# This reduces runtime overhead as well as preventing issues around dependency +# installation for development builds (pip install ./ ignores requirements.txt) +COPY tmp/requirements.txt /tangostationcontrol-requirements.txt RUN sudo pip3 install -r /tangostationcontrol-requirements.txt # install and use ephimerides and geodetic ("measures") tables for casacore. # we install a _stub_ since the tables need to be deployed explicitly from within the software. RUN sudo mkdir -p /opt/IERS && sudo chmod a+rwx /opt/IERS ARG IERS_DIRNAME=IERS-1970-01-01T00:00:00-stub -COPY docker-compose/lofar-device-base/WSRT_Measures_stub /opt/IERS/${IERS_DIRNAME} +COPY lofar-device-base/WSRT_Measures_stub /opt/IERS/${IERS_DIRNAME} RUN ln -sfT /opt/IERS/${IERS_DIRNAME} /opt/IERS/current -COPY docker-compose/lofar-device-base/casarc /home/tango/.casarc +COPY lofar-device-base/casarc /home/tango/.casarc ENV TANGO_LOG_PATH=/var/log/tango RUN sudo mkdir -p /var/log/tango && sudo chmod a+rwx /var/log/tango