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

Fix pip internally managed hack

parent 5eba7399
No related branches found
No related tags found
1 merge request!812Fix pip internally managed hack
Showing
with 13 additions and 1046 deletions
......@@ -42,3 +42,4 @@ infra/dev/nomad/tmp/*
**/CDB/dump*.json
.bin/*
/docker/lofar-device-base/tmp/
......@@ -64,7 +64,8 @@ wheel_packaging:
tag="$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- apk add --update make bash docker-compose python3 py3-pip
- apk add --update make bash python3 py3-pip
- python3 -m venv venv && source venv/bin/activate
- pip install shyaml
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- touch ~/.Xauthority
......@@ -111,19 +112,15 @@ docker_build_image:
matrix:
- IMAGE:
- ec-sim
- prometheus
- tango-prometheus-exporter
- itango
- grafana
- loki
- jupyter-lab
- dsconfig
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes:
- docker-compose/$IMAGE.yml
- docker-compose/$IMAGE/**/*
- docker-compose/.env
- docker/$IMAGE/**/*
- docker/Makefile
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
......@@ -286,6 +283,7 @@ unit_test:
- apk add --update bind-tools
- apk add --update postgresql14-client gzip socat
- apk add --update python3 py3-pip
- python3 -m venv venv && source venv/bin/activate
- pip install shyaml
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- touch /root/.Xauthority
......@@ -310,8 +308,6 @@ unit_test:
integration_test_docker:
extends: .test_docker
script:
- echo 'DNS ${DNS}'
- echo 'Network ${NETWORK_MODE}'
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash -e $CI_PROJECT_DIR/sbin/run_integration_test.sh --no-build --save-logs --module="tango"
......@@ -351,6 +347,7 @@ publish_on_gitlab:
before_script:
- python3 --version
- pip --version
- python3 -m venv venv && source venv/bin/activate
- pip install twine --upgrade
script:
- echo "run twine for gitlab"
......
......@@ -4,15 +4,17 @@ stages:
build_ci_runner_image:
stage: build
image: docker:latest
before_script:
- apk add yq
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- |
source docker-compose/.env
TANGO_ITANGO_VERSION=$(yq '.tango.itango.version' infra/env.yaml)
if docker pull $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG; then
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --build-arg SOURCE_IMAGE=${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} docker-compose/ci-runner
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --build-arg SOURCE_IMAGE=${CI_REGISTRY_IMAGE}/tango-itango:${TANGO_ITANGO_VERSION} docker/ci-runner
else
docker pull $CI_REGISTRY_IMAGE/ci-build-runner:latest || true
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:latest --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --build-arg SOURCE_IMAGE=${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/tango-itango:${TANGO_ITANGO_VERSION} docker-compose/ci-runner
docker build --cache-from $CI_REGISTRY_IMAGE/ci-build-runner:latest --tag $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG --build-arg SOURCE_IMAGE=${CI_REGISTRY_IMAGE}/tango-itango:${TANGO_ITANGO_VERSION} docker/ci-runner
fi
- docker push $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG # push the image
- |
......
#!/bin/bash
#
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
"${LOFAR20_DIR}/sbin/dsconfig.sh" --dump
......@@ -39,7 +39,7 @@ else
# DO NOT PUT SPACES IN THE EXCLUDE LIST!
rsync -av --progress --exclude={".tox","*.egg-info","dist","build",".git","*.pyc","cover",".stestr",".coverage*",".pytest_cache","htmlcov"} /opt/lofar/tango/tangostationcontrol /tmp/
cd /tmp/tangostationcontrol || exit 1
pip -vvv install --no-deps --force-reinstall ./
pip -vvv install --break-system-packages --no-deps --force-reinstall ./
fi
# Return to the stored the directory, this preserves the working_dir argument in
......
SKA_DOCKER_REGISTRY_HOST=artefact.skao.int
SKA_DOCKER_REGISTRY_USER=ska-tango-images
LOCAL_DOCKER_REGISTRY_HOST=git.astron.nl:5000
LOCAL_DOCKER_REGISTRY_LOFAR=lofar2.0
LOCAL_DOCKER_REGISTRY_USER=lofar2.0/tango
# https://artefact.skao.int/#browse/search/docker=format%3Ddocker%20AND%20attributes.docker.imageName%3Dska-tango-images-*
# When updating these images be sure to run /sbin/tag_and_push_docker_image.sh locally beforehand
# for this to succeed you need to perform `docker login -u xxx git.astron.nl:5000` with a read/write registry access token!
TANGO_ARCHIVER_VERSION=2021-05-28
TANGO_CPP_VERSION=9.4.2
TANGO_DB_VERSION=11.0.2
TANGO_DSCONFIG_VERSION=1.5.12
TANGO_DATABASEDS_VERSION=5.22.0
TANGO_HDBPP_VIEWER_VERSION=2021-05-28
TANGO_ITANGO_VERSION=9.4.3
TANGO_REST_VERSION=1.14.8
TANGO_STARTER_VERSION=2021-05-28
MYSQL_ROOT_PASSWORD=secret
MYSQL_PASSWORD=tango
MINIO_ROOT_USER=minioadmin
MINIO_ROOT_PASSWORD=minioadmin
MINIO_VERSION=RELEASE.2023-10-16T04-13-43Z
MINIO_CLIENT_VERSION=RELEASE.2023-10-14T01-57-03Z
TEST_MODULE=default
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))
TAG ?= latest
DNS ?= 127.0.0.11
DOCKER_COMPOSE ?= docker compose
DOCKER_COMPOSE_ENV_FILE := $(abspath .env)
COMPOSE_FILES := $(wildcard *.yml)
ATTACH_COMPOSE_FILE_ARGS := $(foreach yml,$(filter-out tango.yml,$(COMPOSE_FILES)),-f $(yml))
BUILD_ONLY_FILE_ARGS := -f tango.yml
COMPOSE_FILE_ARGS := --env-file $(DOCKER_COMPOSE_ENV_FILE) $(ATTACH_COMPOSE_FILE_ARGS)
# The default Docker network mode is station. The "host" network
# mode will make the tangodb and archiverdb ports clash,
# But we allow to overwrite it.
NETWORK_MODE ?= station
# Timeout used to await services to become healthy
TIMEOUT ?= 300
SCRATCH ?= /tmp
# Disables building of the lofar-base-device
# and disables copying and building the Python package
# primarily used for integration tests in CI/CD
# Possible values:
# 1. 0 / unset = build everything
# 2. 1 = build nothing
NO_BUILD ?= 0
# Host name through which others can reach our control interfaces.
# Needs to be resolvable from the containers and clients.
ifneq (,$(wildcard /run/WSL))
# Microsoft Windows Subsystem for Linux
HOSTNAME ?= host.docker.internal
else
HOSTNAME ?= $(shell hostname -f)
endif
# Host name to which to send our container logs. Needs to be resolvable from
# the host.
LOG_HOSTNAME ?= localhost
# If the first make argument is "start", "stop"...
ifeq (start,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (stop,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (restart,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (up,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (build,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (build-nocache,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (attach,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
ifndef NETWORK_MODE
$(error NETWORK_MODE must specify the network to attach to, e.g., make NETWORK_MODE=tangonet-powersupply ...)
endif
ifndef TANGO_HOST
$(error TANGO_HOST must specify the Tango database device, e.g., make TANGO_HOST=powersupply-databaseds:10000 ...)
endif
else ifeq (await,$(firstword $(MAKECMDGOALS)))
SERVICE_TARGET = true
else ifeq (run,$(firstword $(MAKECMDGOALS)))
RUN_TARGET = true
else ifeq (integration,$(firstword $(MAKECMDGOALS)))
INTEGRATION_TARGET = true
endif
ifdef SERVICE_TARGET
# .. then use the rest as arguments for the make target
SERVICE := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(SERVICE):;@:)
else ifdef RUN_TARGET
# Isolate second argument as service, the rest is arguments for run command
SERVICE := $(wordlist 2, 2, $(MAKECMDGOALS))
# ...and turn them into do-nothing targets
$(eval $(SERVICE):;@:)
SERVICE_ARGS := $(wordlist 3, $(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(SERVICE_ARGS):;@:)
else ifdef INTEGRATION_TARGET
# Isolate second argument as integration module, the rest as arguments
INTEGRATION_MODULE := $(wordlist 2, 2, $(MAKECMDGOALS))
$(eval $(INTEGRATION_MODULE):;@:)
INTEGRATION_ARGS := $(wordlist 3, $(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(INTEGRATION_ARGS):;@:)
endif
#
# Never use the network=host mode when running CI jobs, and add extra
# distinguishing identifiers to the network name and container names to
# prevent collisions with jobs from the same project running at the same
# time.
#
ifeq ($(OS),Windows_NT)
$(error Sorry, Windows is not supported yet)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DOCKER_GID ?= $(shell getent group docker | cut -d: -f 3)
DISPLAY ?= :0.0
XAUTHORITY_MOUNT := /tmp/.X11-unix:/tmp/.X11-unix
XAUTHORITY ?= /hosthome/.Xauthority
# /bin/sh (=dash) does not evaluate 'docker network' conditionals correctly
SHELL := /bin/bash
else ifeq ($(UNAME_S),Darwin)
DOCKER_GID ?= $(shell id -g)
IF_INTERFACE := $(shell scutil --nwi | grep 'Network interfaces:' | cut -d' ' -f3)
IP_ADDRESS := $(shell scutil --nwi | grep 'address' | cut -d':' -f2 | tr -d ' ' | head -n1)
DISPLAY := $(IP_ADDRESS):0
# Make sure that Darwin, especially from macOS Catalina on,
# allows X access from our Docker containers.
ADD_TO_XHOST := $(shell xhost +$(IP_ADDRESS))
XAUTHORITY_MOUNT := $(HOME)/.Xauthority:/hosthome/.Xauthority:ro
XAUTHORITY := /hosthome/.Xauthority
endif
endif
#
# When running in network=host mode, point devices at a port on the host
# machine rather than at the container.
#
ifeq ($(NETWORK_MODE),host)
TANGO_HOST := $(shell hostname):10000
MYSQL_HOST := $(shell hostname):3306
else
ifeq ($(TANGO_HOST),)
# Use FQDN for TANGO_HOST to avoid confusion in the archiver, which also
# adds the domain.
TANGO_HOST := databaseds.$(NETWORK_MODE):10000
else
TANGO_HOST := $(TANGO_HOST)
endif
ifeq ($(MYSQL_HOST),)
MYSQL_HOST := tangodb:3306
else
MYSQL_HOST := $(MYSQL_HOST)
endif
endif
DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
XAUTHORITY=$(XAUTHORITY) \
TANGO_HOST=$(TANGO_HOST) \
MYSQL_HOST=$(MYSQL_HOST) \
HOSTNAME=$(HOSTNAME) \
SCRATCH=$(SCRATCH) \
LOG_HOSTNAME=$(LOG_HOSTNAME) \
NETWORK_MODE=$(NETWORK_MODE) \
XAUTHORITY_MOUNT=$(XAUTHORITY_MOUNT) \
COMPOSE_IGNORE_ORPHANS=true \
COMPOSE_HTTP_TIMEOUT=180 \
CONTAINER_EXECUTION_UID=$(shell id -u) \
DOCKER_GID=$(DOCKER_GID) \
TEST_MODULE=$(INTEGRATION_MODULE) \
TAG=$(TAG) \
DNS=$(DNS)
.PHONY: up base base-nocache down minimal context run integration start stop restart build build-nocache status clean pull help await
.DEFAULT_GOAL := help
pull: ## pull the images from the Docker hub
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) pull --ignore-pull-failures
base: context ## Build base lofar device image
ifneq ($(NO_BUILD),1)
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) build --progress=plain lofar-device-base
endif
base-nocache: context ## Rebuild base lofar device image
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) $(BUILD_ONLY_FILE_ARGS) build --no-cache --progress=plain lofar-device-base
build: base ## build images
# docker-compose does not support build dependencies, so manage those here
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) $(BUILD_ONLY_FILE_ARGS) build --parallel --progress=plain $(SERVICE)
build-nocache: base-nocache ## rebuild images from scratch
# docker-compose does not support build dependencies, so manage those here
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) $(BUILD_ONLY_FILE_ARGS) build --no-cache --progress=plain $(SERVICE)
up: base minimal ## start the base TANGO system and prepare requested services
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) up --no-start --no-recreate $(SERVICE)
run: base minimal ## run a service using arguments and delete it afterwards
ifeq (device,$(findstring device,$(SERVICE)))
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) run -T --no-deps --rm --service-ports --name $(SERVICE) $(SERVICE) $(SERVICE_ARGS)
else ifeq (sim,$(findstring sim,$(SERVICE)))
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) run -T --no-deps --rm --service-ports --name $(SERVICE) $(SERVICE) $(SERVICE_ARGS)
else ## allow multiple container instances if they are not devices or simulators
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) run -T --no-deps --rm $(SERVICE) $(SERVICE_ARGS)
endif
integration: minimal ## run a service using arguments and delete it afterwards
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) run -T --no-deps --rm integration-test $(INTEGRATION_ARGS)
down: ## stop all services and tear down the system
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) down
ifneq ($(NETWORK_MODE),host)
docker network inspect $(NETWORK_MODE) &> /dev/null && ([ $$? -eq 0 ] && docker network rm $(NETWORK_MODE)) || true
docker network inspect 9000-$(NETWORK_MODE) &> /dev/null && ([ $$? -eq 0 ] && docker network rm 9000-$(NETWORK_MODE)) || true
endif
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
context: ## Move and build the necessary files to create minimal docker context
rm -rf ./tmp; \
mkdir -p tmp; \
if [[ "${NO_BUILD}" -ne "1" ]]; then \
rm -rf ../tangostationcontrol/dist; \
cd ../tangostationcontrol; \
tox -e build; \
cd ../docker-compose; \
fi; \
cp ../tangostationcontrol/dist/*.whl tmp/; \
cp ../tangostationcontrol/requirements.txt tmp/; \
bootstrap: pull build # first start, initialise from scratch
$(MAKE) start dsconfig # boot up containers to load configurations
sleep 5 # wait for dsconfig container to come up
../sbin/dsconfig.sh --update ../CDB/LOFAR_ConfigDb.json # load default configuration
../sbin/dsconfig.sh --update ../CDB/stations/simulators_ConfigDb.json # by default, use simulators
start: up ## start a service (usage: make start <servicename>)
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>)
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) stop $(SERVICE)
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) rm -f $(SERVICE)
restart: ## restart a service (usage: make restart <servicename>)
make stop $(SERVICE) # cannot use dependencies, as that would allow start and stop to run in parallel..
make start $(SERVICE)
attach: ## attach a service to an existing Tango network
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(ATTACH_COMPOSE_FILE_ARGS) up --no-recreate -d $(SERVICE)
TIME := 0
await: ## Await every container with total max timeout of 300, do not reset timeout
time=$(TIME); \
for i in $(SERVICE); do \
current_service=$$($(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) ps -q $${i}); \
if [ -z "$${current_service}" ]; then \
continue; \
fi; \
service_has_health=$$(docker inspect -f '{{.State.Health.Status}}' $${current_service}); \
if [ -z "$${service_has_health}" ]; then \
continue; \
fi; \
echo -n "Wait for service $${i} to become healthy .."; \
while [ "$$(docker inspect -f '{{.State.Health.Status}}' $${current_service})" != "healthy" ] ; do \
echo -n '.'; \
sleep 2; \
time=$$(expr $$time + 1); \
if [ $${time} -gt $(TIMEOUT) ]; then \
echo "timeout"; \
docker logs $${i}; \
exit 1; \
fi; \
done; \
echo ". [ok]"; \
done
status: ## show the container status
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) ps
images: ## show the container images
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) images
clean: down ## clear all TANGO database entries, and all containers
docker volume rm $(BASEDIR)_tangodb
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) rm -f
nuke: down
- docker rmi -f $(shell $(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) config --images)
- docker volume rm $(shell $(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) config --format json | jq '.volumes | .[] | .name' -r)
help: ## show this help.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Docker Compose & Station Services
Documentation on how the LOFAR station control software utilizes docker-compose.
This documentation is intended for developers listing strategies and their
respective advantages and disadvantages. In addition, this documentation
contains developer expectations that they should uphold to.
## Index
1. [Station services]()
1. [Types of container services and specific strategies](#types-of-containers-and-specific-strategies)
2. [HDB++ image updates](#hdb-image-updates)
3. [Gitlab CI/CD](#gitlab-cicd)
1. [Image tagging and change detection](#image-tagging-and-change-detection)
1. [Setup and maintenance](#setup-and-maintenance)
2. [Gitlab CI phases](#gitlab-ci-phases)
## Station Services
The station offers different services, this documentation provides
names and an overview of their behavior as well as if these services
are used in production.
- [Devices \[external\]](https://lofar20-station-control.readthedocs.io/en/latest/devices/overview.html)
- Simulators
- [sdptr \[external\]](https://git.astron.nl/lofar2.0/sdptr)
- [sdptr-sim](sdptr-sim.yml)
- [pypcc \[external\]](https://git.astron.nl/lofar2.0/pypcc)
- [apsct-sim](apsct-sim.yml)
- [apspu-sim](apspu-sim.yml)
- [ccd-sim](ccd-sim.yml)
- [recvh-sim](recvh-sim.yml)
- [recvl-sim](recvl-sim.yml)
- [unb2-sim](unb2-sim.yml)
- Base images
- [ci-runner](ci-runner/Dockerfile)
- [lofar-device-base](lofar-device-base.yml)
- Services
- databases
- dsconfig
- prometheus
- webservers / user interfaces
- jupyterlab
- [grafana](grafana/README.md)
- logging / monitoring
- prometheus-node-exporter
- [tango-prometheus-exporter](tango-prometheus-exporter/README.md) - loki
- tango
- itango
- tango-rest
### Types of containers and specific strategies
- Devices
- Simulators
- Base images
- Services
Devices, these are detected by changes to the .yml file or directory of the
respective service inside the docker-compose directory.
Simulators, Since the source code for simulators is maintained by other teams
we can not accurately determine from our repository if the simulator has
changed. Instead, the images is build by the teams their respective CI
pipelines. We simply pull these images as base images.
Base images, these are detected by changes to the .env file in the
docker-compose directory. When changed they will be downloaded from the remote
registry and uploaded to our own using matching tags.
Services, same mechanism as devices.
## Gitlab CI/CD
1. [Image tagging and change detection](#image-tagging-and-change-detection)
1. [Setup and maintenance](#setup-and-maintenance)
2. [Gitlab CI phases](#gitlab-ci-phases)
### Image tagging and change detection
Preventing unnecessary builds of docker images reduces build times and increases
iteration speed. In order to achieve this the project requires properly tagged
images and mechanisms for change detection.
For change detection the system relies on git. Git is used to determine the
directories and files that have changes between the current and previous commit.
All image related change detection mechanisms are based on this difference.
Using docker cache within the dind service is impractical see:
https://gitlab.com/gitlab-org/gitlab-foss/-/issues/17861
#### Setup and maintenance
All behavioral logic to orchestrate change detection and image pushing can be
found in the sbin/tag_and_push_docker_images.sh script as well as the
.gitlab-ci.yml. The shell script relies on the fact that each .yml file in the
docker-compose directory corresponds to one image.
### Gitlab CI phases
Docker images are managed in three phases. First is remote image storing, second
is image building and change detection with finally image pulling.
Remote images are downloaded and stored on the local registry when the .env
file for docker-compose has changes.
Local images are build when either the files in the base context directory
change or if the docker compose file itself has changes. See the gitlab-ci.yml
for how these changes are detected. All local images will be rebuild and tagged
latest when a tagged commit is pushed to master.
Local images download the latest image from the registry as cache unless it is
a tagged commit on master.
Finally, the integration test downloads all images from the registry either
tagged with the current pipeline or with latest. Should both tags be unavailable
than the integration test fails. Not all images are needed for the integration
test. See sbin/tag_and_push_docker_image.sh for how these images are
differentiated.
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an APSCT simulator
#
# Defines:
# - apsct-sim
#
version: '2.1'
services:
apsct-sim:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_LOFAR}/pypcc:latest
hostname: apsct-sim
container_name: apsct-sim
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
entrypoint: hwtr --simulator --port 4843 --config APSCTTR
restart: on-failure
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an APSPU simulator
#
# Defines:
# - apspu-sim
#
version: '2.1'
services:
apspu-sim:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_LOFAR}/pypcc:latest
hostname: apspu-sim
container_name: apspu-sim
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
entrypoint: hwtr --simulator --port 4842 --config APSPUTR
restart: on-failure
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an APSCT simulator
#
# Defines:
# - apsct-sim
#
version: '2.1'
services:
ccd-sim:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_LOFAR}/pypcc:latest
hostname: ccd-sim
container_name: ccd-sim
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
entrypoint: hwtr --simulator --port 4843 --config CCDTR
restart: on-failure
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-afh:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-afh
container_name: device-afh
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5715:5715" # unique port for this DS
- "5815:5815" # ZeroMQ event port
- "5915:5915" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5815
- TANGO_ZMQ_HEARTBEAT_PORT=5915
healthcheck:
test: l2ss-health dserver/AFH/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds AFH STAT -v -ORBendPoint giop:tcp:0:5715 -ORBendPointPublish giop:tcp:${HOSTNAME}:5715
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-afl:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-afl
container_name: device-afl
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
ports:
- "5730:5730" # unique port for this DS
- "5830:5830" # ZeroMQ event port
- "5930:5930" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5830
- TANGO_ZMQ_HEARTBEAT_PORT=5930
healthcheck:
test: l2ss-health dserver/AFL/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds AFL STAT -v -ORBendPoint giop:tcp:0:5730 -ORBendPointPublish giop:tcp:${HOSTNAME}:5730
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-aps:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
container_name: device-aps
hostname: device-aps
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5728:5728" # unique port for this DS
- "5828:5828" # ZeroMQ event port
- "5928:5928" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5828
- TANGO_ZMQ_HEARTBEAT_PORT=5928
healthcheck:
test: l2ss-health dserver/APS/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds APS STAT -v -v -ORBendPoint giop:tcp:device-aps:5728 -ORBendPointPublish giop:tcp:${HOSTNAME}:5728
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-apsct:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-apsct
container_name: device-apsct
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5709:5709" # unique port for this DS
- "5809:5809" # ZeroMQ event port
- "5909:5909" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5809
- TANGO_ZMQ_HEARTBEAT_PORT=5909
healthcheck:
test: l2ss-health dserver/APSCT/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds APSCT STAT -v -v -ORBendPoint giop:tcp:device-apsct:5709 -ORBendPointPublish giop:tcp:${HOSTNAME}:5709
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-apspu:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-apspu
container_name: device-apspu
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5710:5710" # unique port for this DS
- "5810:5810" # ZeroMQ event port
- "5910:5910" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5810
- TANGO_ZMQ_HEARTBEAT_PORT=5910
healthcheck:
test: l2ss-health dserver/APSPU/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds APSPU STAT -v -ORBendPoint giop:tcp:device-apspu:5710 -ORBendPointPublish giop:tcp:${HOSTNAME}:5710
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-beamlet:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-beamlet
container_name: device-beamlet
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5712:5712" # unique port for this DS
- "5812:5812" # ZeroMQ event port
- "5912:5912" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5812
- TANGO_ZMQ_HEARTBEAT_PORT=5912
healthcheck:
test: l2ss-health dserver/Beamlet/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds Beamlet STAT -v -ORBendPoint giop:tcp:0:5712 -ORBendPointPublish giop:tcp:${HOSTNAME}:5712
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-bst:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-bst
container_name: device-bst
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
- data
dns: ${DNS}
ports:
- "5003:5003/udp" # port to receive SST UDP packets on (first antennafield)
- "5103:5103/tcp" # port to emit SST TCP packets on
- "5013:5013/udp" # port to receive SST UDP packets on (second antennafield)
- "5113:5113/tcp" # port to emit SST TCP packets on
- "5023:5023/udp" # port to receive SST UDP packets on (third antennafield)
- "5123:5123/tcp" # port to emit SST TCP packets on
- "5717:5717" # unique port for this DS
- "5817:5817" # ZeroMQ event port
- "5917:5917" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5817
- TANGO_ZMQ_HEARTBEAT_PORT=5917
healthcheck:
test: l2ss-health dserver/BST/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds BST STAT -v -ORBendPoint giop:tcp:0:5717 -ORBendPointPublish giop:tcp:${HOSTNAME}:5717
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-calibration:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-calibration
container_name: device-calibration
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5724:5724" # unique port for this DS
- "5824:5824" # ZeroMQ event port
- "5924:5924" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5824
- TANGO_ZMQ_HEARTBEAT_PORT=5924
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
healthcheck:
test: l2ss-health dserver/Calibration/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds Calibration STAT -v -ORBendPoint giop:tcp:0:5724 -ORBendPointPublish giop:tcp:${HOSTNAME}:5724
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
# Docker compose file that launches an interactive iTango session.
#
# Connect to the interactive session with 'docker attach itango'.
# Disconnect with the Docker deattach sequence: <CTRL>+<P> <CTRL>+<Q>
#
# Defines:
# - itango: iTango interactive session
#
# Requires:
# - lofar-device-base.yml
#
version: '2.1'
services:
device-ccd:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/lofar-device-base:${TAG}
hostname: device-ccd
container_name: device-ccd
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
networks:
- control
dns: ${DNS}
ports:
- "5721:5721" # unique port for this DS
- "5821:5821" # ZeroMQ event port
- "5921:5921" # ZeroMQ heartbeat port
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ..:/opt/lofar/tango:rw
environment:
- TANGO_HOST=${TANGO_HOST}
- TANGO_ZMQ_EVENT_PORT=5821
- TANGO_ZMQ_HEARTBEAT_PORT=5921
healthcheck:
test: l2ss-health dserver/CCD/STAT
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
working_dir: /opt/lofar/tango
entrypoint:
- 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
- l2ss-ds CCD STAT -v -ORBendPoint giop:tcp:device-ccd:5721 -ORBendPointPublish giop:tcp:${HOSTNAME}:5721
restart: on-failure
stop_signal: SIGINT # request a graceful shutdown of Tango
stop_grace_period: 2s
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment