Skip to content
Snippets Groups Projects
Commit cf4ab5a0 authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Resolve L2SS-1341 "Migrate tango2nomad"

parent c02366d5
No related branches found
No related tags found
5 merge requests!770Draft: Move CS001/DTS config files to specific dirs & order,!769L2SS-1570: Logfmt logs,!753L2SS-1336: Deploy station control software to nomad,!750Resolve L2SS-1341 "Migrate tango2nomad",!685Resolve L2SS-1340 "Deploy monitoring to nomad"
Showing
with 105 additions and 268 deletions
...@@ -34,4 +34,11 @@ deploy/hosts ...@@ -34,4 +34,11 @@ deploy/hosts
docker-compose/alerta-web/alerta-secrets.json docker-compose/alerta-web/alerta-secrets.json
docker-compose/tmp docker-compose/tmp
infra/dev/jobs/*.nomad
infra/dev/tmp/*
!infra/dev/tmp/.keep
**/CDB/dump*.json **/CDB/dump*.json
bin/jumppad
...@@ -124,6 +124,7 @@ docker_build_image: ...@@ -124,6 +124,7 @@ docker_build_image:
- loki - loki
- logstash - logstash
- jupyter-lab - jupyter-lab
- dsconfig
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: changes:
...@@ -247,18 +248,20 @@ unit_test: ...@@ -247,18 +248,20 @@ unit_test:
integration_test_docker: integration_test_docker:
stage: integration-tests stage: integration-tests
image: docker:23.0.5 # latest ships with docker compose v2.19, which has the following bug: https://github.com/docker/compose/issues/10668 image: docker:latest
needs: needs:
- unit_test - unit_test
- wheel_packaging - wheel_packaging
dependencies: dependencies:
- wheel_packaging - wheel_packaging
tags: tags:
- privileged - integration_tests
services: services:
- name: docker:dind - name: docker:dind
variables: variables:
DOCKER_TLS_CERTDIR: "/certs" DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
JUMPPAD_HOME: $CI_PROJECT_DIR
before_script: before_script:
- | - |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" && -z "$CI_COMMIT_TAG" ]]; then
...@@ -269,16 +272,15 @@ integration_test_docker: ...@@ -269,16 +272,15 @@ integration_test_docker:
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi fi
- apk update - apk update
- apk add git
- apk add --update make bash - apk add --update make bash
- apk add --update bind-tools - apk add --update bind-tools
- apk add --update postgresql14-client gzip - apk add --update postgresql14-client gzip socat
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script: script:
- touch /root/.Xauthority - touch /root/.Xauthority
# Hack BASH_SOURCE into sourced files, docker its sh shell won't set this # Hack BASH_SOURCE into sourced files, docker its sh shell won't set this
- export BASH_SOURCE=$(pwd)/setup.sh - export BASH_SOURCE=$(pwd)/setup.sh
# Hack HOSTNAME env variable into host.docker.internal, set in docker-compose
- export HOSTNAME=host.docker.internal
# source the lofarrc file and mask its non zero exit code # source the lofarrc file and mask its non zero exit code
- . setup.sh || true - . setup.sh || true
# TANGO_HOST must be unset our databaseds will be unreachable # TANGO_HOST must be unset our databaseds will be unreachable
...@@ -287,18 +289,9 @@ integration_test_docker: ...@@ -287,18 +289,9 @@ integration_test_docker:
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag
# Do not remove 'bash' or statement will be ignored by primitive docker shell # Do not remove 'bash' or statement will be ignored by primitive docker shell
- export TAG="$tag" - export TAG="$tag"
- bash -e $CI_PROJECT_DIR/sbin/run_integration_test.sh --no-build - socat tcp-listen:4646,reuseaddr,fork tcp:docker:4646 &
after_script: - socat udp-listen:8600,reuseaddr,fork udp:docker:8600 &
# Collect output of all containers - bash -e $CI_PROJECT_DIR/sbin/run_integration_test.sh --no-build --save-logs
- |
mkdir -p log
for container in $(docker ps -a --format "{{.Names}}")
do
echo "Saving log for container $container"
docker logs "${container}" >& "log/${container}.log"
done
# Collect content of the TangoDB
- $CI_PROJECT_DIR/bin/dump_ConfigDb.sh >& log/dump_ConfigDb.log
artifacts: artifacts:
when: always when: always
paths: paths:
...@@ -344,41 +337,26 @@ release_job: ...@@ -344,41 +337,26 @@ release_job:
tag_name: '$CI_COMMIT_TAG' tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG' description: '$CI_COMMIT_TAG'
.base_deploy: deploy_nomad:
stage: deploy stage: deploy
image: ubuntu:bionic image:
name: hashicorp/levant
entrypoint: [ "" ]
when: manual when: manual
rules: rules:
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH) || $CI_COMMIT_TAG
before_script: parallel:
- apt-get update matrix:
- apt-get install ansible openssh-client -y - STATION:
# Use Gitlab protected variable to provide key - cs001
- echo "$DEPLOY_KEY" > id_rsa COMPONENT:
- chmod 400 id_rsa - tango
- ssh-keygen -y -f id_rsa > id_rsa.pub
# Add ssh key to agent
- eval $(ssh-agent)
- ssh-add id_rsa
- ansible --version
script:
- echo "Deploying version $CI_COMMIT_TAG"
- cd deploy
# Prevent error of ansible being run in world writeable directory
- chmod o-w .
# Generate hosts file for deployment
- echo "[all]" > hosts
- echo "stat ansible_host=$DEPLOY_HOST ansible_user=$DEPLOY_USER" >> hosts
# Run deployment with populated variables
- ansible-playbook -v deploy.yml --extra-vars station_version=$CI_COMMIT_TAG --extra-vars station_config=$DEPLOY_CONFIG
.deploy_l2ts_base:
extends: .base_deploy
variables:
DEPLOY_USER: $L2TS_USERNAME
DEPLOY_HOST: $L2TS_HOSTNAME
DEPLOY_CONFIG: $L2TS_CONFIG
DEPLOY_KEY: $L2TS_DEPLOY_KEY
deploy_l2ts_start:
extends: .deploy_l2ts_base
environment: environment:
name: l2ts name: $STATION
script:
- |
levant deploy \
-address="http://${STATION}c.control.lofar:4646" \
-var image_tag="latest" \
-var station="${STATION}" \
infra/jobs/station/${COMPONENT}.levant.hcl
...@@ -4,7 +4,7 @@ The ConfigDb.json files in this directory are used to populate the Tango configu ...@@ -4,7 +4,7 @@ The ConfigDb.json files in this directory are used to populate the Tango configu
To load a configuration file, use To load a configuration file, use
```bash ```bash
../sbin/update_ConfigDb.sh file.json ../sbin/dsconfig.sh --update file.json
``` ```
The tool ``tangostationcontrol.toolkit.analyse_dsconfig_hierarchies`` is provided to check the consistency of The tool ``tangostationcontrol.toolkit.analyse_dsconfig_hierarchies`` is provided to check the consistency of
...@@ -13,7 +13,7 @@ hierarchies defined between the devices in a set of configuration files. ...@@ -13,7 +13,7 @@ hierarchies defined between the devices in a set of configuration files.
The following files are provided: The following files are provided:
| File | Description | Usage | | File | Description | Usage |
|--------------------------------------------|-------------------------------------------------------------|---------------------| |------------------------------------------|-------------------------------------------------------------|---------------------|
| `LOFAR_ConfigDb.json` | Generic base configuration, registering all of the devices. | Always | | `LOFAR_ConfigDb.json` | Generic base configuration, registering all of the devices. | Always |
| `test_environment_ConfigDb.json` | Base delta for the unit- and integration test suites. | Tests & development | | `test_environment_ConfigDb.json` | Base delta for the unit- and integration test suites. | Tests & development |
| `stations/simulators_ConfigDb.json` | A "station" configuration that points to our simulators. | Tests & development | | `stations/simulators_ConfigDb.json` | A "station" configuration that points to our simulators. | Tests & development |
......
...@@ -47,6 +47,25 @@ You will also need: ...@@ -47,6 +47,25 @@ You will also need:
* make * make
* bash * bash
## Start dev environment
For local development a dev environment is needed. To setup this environment run
```
./sbin/prepare_dev_env.sh
```
This will install `jumppad`, if not present yet as well as creating the docker volume needed to simulate the station
nomad cluster.
Afterwards run
```
jumppad up infra/dev
```
to start the dev environment including tango.
## Bootstrap ## Bootstrap
The bootstrap procedure is needed only once. First we build all docker The bootstrap procedure is needed only once. First we build all docker
...@@ -115,6 +134,7 @@ Next change the version in the following places: ...@@ -115,6 +134,7 @@ Next change the version in the following places:
# Release Notes # Release Notes
* 0.22.0 Migrate execution environment to nomad
* 0.21.3 Added DigitalBeam.Antenna_Usage_Mask_R to expose antennas used in beamforming * 0.21.3 Added DigitalBeam.Antenna_Usage_Mask_R to expose antennas used in beamforming
* 0.21.2 Removed deprecated "Boot" device (use StationManager now) * 0.21.2 Removed deprecated "Boot" device (use StationManager now)
* 0.21.1 Implement multi project integration downstream pipeline * 0.21.1 Implement multi project integration downstream pipeline
......
#!/bin/bash #!/bin/bash
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy) #
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
#
# writes the JSON dump to stdout, Do not change -i into -it incompatible with gitlab ci! "${LOFAR20_DIR}/sbin/dsconfig.sh" --dump
docker exec -i dsconfig bash -c '
python -m dsconfig.dump > /tmp/dsconfig-configdb-dump.json
/manage_object_properties.py -r > /tmp/dsconfig-objectdb-dump.json
/merge_json.py /tmp/dsconfig-objectdb-dump.json /tmp/dsconfig-configdb-dump.json'
#!/bin/bash #!/bin/bash
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy) #
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
#
exec docker exec -it itango itango3 exec docker exec -e "TANGO_HOST=$TANGO_HOST:$TANGO_PORT" -it itango itango3
#!/bin/bash #!/bin/bash
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy) #
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
#
exec docker exec -it itango /bin/bash exec docker exec -e "TANGO_HOST=$TANGO_HOST:$TANGO_PORT" -it itango /bin/bash
# Deployments
Deploying is achieved through gitlab environments as well as ansible.
Concretely the following files are involved:
1. [deploy.yml](deploy.yml)
2. [ansible.cfg](ansible.cfg)
3. [.gitlab-ci.yml](../.gitlab-ci.yml)
Once a tagged commit hits master a job is created for this tag that needs to
be manually triggered. You should be able to find this pipeline on the
[tags overview](https://git.astron.nl/lofar2.0/tango/-/tags).
From here, with prior consent, the deployment can be started for any
environment.
The gitlab-ci.yml job defines each of the environments in parameterized way.
The templated `.base_deploy` needs to be extended and have several variables
defined. These variables need to be fed from
[protected variables](https://git.astron.nl/lofar2.0/tango/-/settings/ci_cd)
within gitlab.
Below is a practical example of how to define an environment.
```
.deploy_example_base:
extends: .base_deploy
variables:
DEPLOY_USER: $EXAMPLE_USERNAME
DEPLOY_HOST: $EXAMPLE_HOSTNAME
DEPLOY_CONFIG: $EXAMPLE_CONFIG
DEPLOY_KEY: $EXAMPLE_KEY
deploy_l2ts_start:
extends: .deploy_example_base
environment:
name: example
```
Such an environment will only appear in the
[environments overview](https://git.astron.nl/lofar2.0/tango/-/environments)
after the first deployment.
The process of this deployment is handled through ansible as found in
`deploy.yml`.
[defaults]
host_key_checking = False
inventory = hosts
---
- name: StationControl Early Deployment
hosts: all
vars:
base_station_config: "LOFAR_ConfigDb.json"
install_path: ~/git/tango
databaseds_port: 10000
tasks:
- name: Check make installed
include_tasks:
file: tasks/check_binary_install.yml
vars:
program: make
- name: Check git installed
include_tasks:
file: tasks/check_binary_install.yml
vars:
program: git
- name: Register tango directory status
shell: cd {{ install_path }}
args:
chdir: ~
changed_when: false
failed_when: tango_directory.rc not in [0,1]
register: tango_directory
- name: Register pending changes
shell: "! (git status | grep Changes)"
args:
chdir: "{{ install_path }}"
changed_when: false
failed_when: pending_changes.rc not in [0,1]
register: pending_changes
# Several issues with this variable being unset in ansible 2.2
# where encountered, keep debug in case needed
- debug: var=pending_changes
- name: Check tango directory status
fail:
msg: "Tango directory appears to be missing!"
when: tango_directory.rc not in [0]
- name: Check pending changes
fail:
msg: "Deployment repository seems to have pending changes!"
when: pending_changes.rc not in [0]
- name: Stop Current Station
changed_when: false
shell: "make stop"
args:
chdir: "{{ install_path }}/docker-compose"
- name: Git Fetch All
changed_when: false
shell: "git fetch --all"
args:
chdir: "{{ install_path }}"
- name: Update Sources
changed_when: false
shell: "git checkout {{ station_version }}"
args:
chdir: "{{ install_path }}"
- name: Pull Images
changed_when: false
shell: "make pull"
args:
chdir: "{{ install_path }}/docker-compose"
- name: Build Images
changed_when: false
shell: "make build"
args:
chdir: "{{ install_path }}/docker-compose"
- name: Start Database
changed_when: false
shell: "make minimal"
args:
chdir: "{{ install_path }}/docker-compose"
- name: Wait for databaseds
ansible.builtin.wait_for:
port: "{{ databaseds_port }}"
delay: 10
- name: Update Base Database Config
include_tasks:
file: tasks/update_database_config.yml
vars:
database_config: "{{ base_station_config }}"
base_path: "{{ install_path }}"
- name: Verify Base Database Config
include_tasks:
file: tasks/verify_database_config.yml
vars:
database_config: "{{ base_station_config }}"
base_path: "{{ install_path }}"
- name: Update Station Database Config
include_tasks:
file: tasks/update_database_config.yml
vars:
database_config: "stations/{{ station_config }}"
base_path: "{{ install_path }}"
- name: Verify Station Database Config
include_tasks:
file: tasks/verify_database_config.yml
vars:
database_config: "stations/{{ station_config }}"
base_path: "{{ install_path }}"
- name: Start Station
changed_when: false
shell: "make start"
args:
chdir: "{{ install_path }}/docker-compose"
- name: Register installation status
command: which {{ program }}
changed_when: false
failed_when: installed.rc not in [0,1]
register: installed
- name: Check installation status
fail:
msg: "{{ program }} does not appear to be installed!"
when: installed.rc not in [0]
\ No newline at end of file
- name: Update Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/{{ database_config }}"
args:
chdir: "{{ base_path }}"
\ No newline at end of file
- name: Get Database Config
changed_when: false
shell: "./sbin/load_ConfigDb.sh CDB/{{ database_config }} 2>&1"
register: dsconfig_result
args:
chdir: "{{ base_path }}"
- name: Verify Database Config
when: '"No changes needed" in dsconfig_result.stdout'
debug: msg="Database changes stored"
\ No newline at end of file
...@@ -6,19 +6,21 @@ MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST))) ...@@ -6,19 +6,21 @@ MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH)))) BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))
TAG ?= latest TAG ?= latest
DNS ?= 127.0.0.11
DOCKER_COMPOSE ?= docker compose DOCKER_COMPOSE ?= docker compose
DOCKER_COMPOSE_ENV_FILE := $(abspath .env) DOCKER_COMPOSE_ENV_FILE := $(abspath .env)
COMPOSE_FILES := $(wildcard *.yml) COMPOSE_FILES := $(wildcard *.yml)
COMPOSE_FILE_ARGS := --env-file $(DOCKER_COMPOSE_ENV_FILE) $(foreach yml,$(COMPOSE_FILES),-f $(yml))
ATTACH_COMPOSE_FILE_ARGS := $(foreach yml,$(filter-out tango.yml,$(COMPOSE_FILES)),-f $(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 tangonet. The "host" network # The default Docker network mode is station. The "host" network
# mode will make the tangodb and archiverdb ports clash, # mode will make the tangodb and archiverdb ports clash,
# But we allow to overwrite it. # But we allow to overwrite it.
NETWORK_MODE ?= tangonet NETWORK_MODE ?= station
# Timeout used to await services to become healthy # Timeout used to await services to become healthy
TIMEOUT ?= 300 TIMEOUT ?= 300
...@@ -97,11 +99,6 @@ endif ...@@ -97,11 +99,6 @@ endif
# prevent collisions with jobs from the same project running at the same # prevent collisions with jobs from the same project running at the same
# time. # time.
# #
ifneq ($(CI_JOB_ID),)
NETWORK_MODE := tangonet-$(CI_JOB_ID)
else
$(info Network mode cannot be host for the archiver! It won't work unless you set the env var CI_JOB_ID=local)
endif
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
$(error Sorry, Windows is not supported yet) $(error Sorry, Windows is not supported yet)
...@@ -166,14 +163,15 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \ ...@@ -166,14 +163,15 @@ DOCKER_COMPOSE_ARGS := DISPLAY=$(DISPLAY) \
CONTAINER_EXECUTION_UID=$(shell id -u) \ CONTAINER_EXECUTION_UID=$(shell id -u) \
DOCKER_GID=$(DOCKER_GID) \ DOCKER_GID=$(DOCKER_GID) \
TEST_MODULE=$(INTEGRATION_MODULE) \ TEST_MODULE=$(INTEGRATION_MODULE) \
TAG=$(TAG) 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 .PHONY: up base base-nocache down minimal context run integration start stop restart build build-nocache status clean pull help await
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
pull: ## pull the images from the Docker hub pull: ## pull the images from the Docker hub
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) pull --ignore-pull-failures $(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) pull --quiet-pull --ignore-pull-failures
base: context ## Build base lofar device image base: context ## Build base lofar device image
ifneq ($(NO_BASE),1) ifneq ($(NO_BASE),1)
...@@ -181,15 +179,15 @@ ifneq ($(NO_BASE),1) ...@@ -181,15 +179,15 @@ ifneq ($(NO_BASE),1)
endif endif
base-nocache: context ## Rebuild base lofar device image base-nocache: context ## Rebuild base lofar device image
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) build --no-cache --progress=plain lofar-device-base $(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) $(BUILD_ONLY_FILE_ARGS) build --no-cache --progress=plain lofar-device-base
build: base ## build images build: base ## build images
# docker-compose does not support build dependencies, so manage those here # docker-compose does not support build dependencies, so manage those here
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) build --parallel --progress=plain $(SERVICE) $(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 build-nocache: base-nocache ## rebuild images from scratch
# docker-compose does not support build dependencies, so manage those here # docker-compose does not support build dependencies, so manage those here
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) build --no-cache --progress=plain $(SERVICE) $(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 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) $(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) $(COMPOSE_FILE_ARGS) up --no-start --no-recreate $(SERVICE)
...@@ -219,7 +217,7 @@ ifneq ($(NETWORK_MODE),host) ...@@ -219,7 +217,7 @@ ifneq ($(NETWORK_MODE),host)
docker network inspect 9000-$(NETWORK_MODE) &> /dev/null || ([ $$? -ne 0 ] && docker network create 9000-$(NETWORK_MODE) -o com.docker.network.driver.mtu=9000) docker network inspect 9000-$(NETWORK_MODE) &> /dev/null || ([ $$? -ne 0 ] && docker network create 9000-$(NETWORK_MODE) -o com.docker.network.driver.mtu=9000)
endif endif
$(DOCKER_COMPOSE_ARGS) $(DOCKER_COMPOSE) -f tango.yml -f networks.yml up --no-recreate -d
context: ## Move and build the necessary files to create minimal docker context context: ## Move and build the necessary files to create minimal docker context
rm -rf ./tmp; \ rm -rf ./tmp; \
...@@ -236,8 +234,8 @@ context: ## Move and build the necessary files to create minimal docker context ...@@ -236,8 +234,8 @@ context: ## Move and build the necessary files to create minimal docker context
bootstrap: pull build # first start, initialise from scratch bootstrap: pull build # first start, initialise from scratch
$(MAKE) start dsconfig # boot up containers to load configurations $(MAKE) start dsconfig # boot up containers to load configurations
sleep 5 # wait for dsconfig container to come up sleep 5 # wait for dsconfig container to come up
../sbin/update_ConfigDb.sh ../CDB/LOFAR_ConfigDb.json # load default configuration ../sbin/dsconfig.sh --update ../CDB/LOFAR_ConfigDb.json # load default configuration
../sbin/update_ConfigDb.sh ../CDB/stations/simulators_ConfigDb.json # by default, use simulators ../sbin/dsconfig.sh --update ../CDB/stations/simulators_ConfigDb.json # by default, use simulators
start: up ## start a service (usage: make start <servicename>) start: up ## start a service (usage: make start <servicename>)
if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi if [ $(UNAME_S) = Linux ]; then touch ~/.Xauthority; chmod a+r ~/.Xauthority; fi
...@@ -266,16 +264,18 @@ await: ## Await every container with total max timeout of 300, do not reset tim ...@@ -266,16 +264,18 @@ await: ## Await every container with total max timeout of 300, do not reset tim
if [ -z "$${service_has_health}" ]; then \ if [ -z "$${service_has_health}" ]; then \
continue; \ continue; \
fi; \ fi; \
echo -n "Whait for service $${i} to become healthy .."; \
while [ "$$(docker inspect -f '{{.State.Health.Status}}' $${current_service})" != "healthy" ] ; do \ while [ "$$(docker inspect -f '{{.State.Health.Status}}' $${current_service})" != "healthy" ] ; do \
sleep 1; \ echo -n '.'; \
sleep 2; \
time=$$(expr $$time + 1); \ time=$$(expr $$time + 1); \
if [ $${time} -gt $(TIMEOUT) ]; then \ if [ $${time} -gt $(TIMEOUT) ]; then \
echo "Timeout reached waiting for $${i} to become healthy"; \ echo "timeout"; \
docker logs $${i}; \ docker logs $${i}; \
exit 1; \ exit 1; \
fi; \ fi; \
done; \ done; \
echo "Service $${i} is healthy"; \ echo ". [ok]"; \
done done
status: ## show the container status status: ## show the container status
......
...@@ -27,6 +27,7 @@ services: ...@@ -27,6 +27,7 @@ services:
max-file: "10" max-file: "10"
networks: networks:
- control - control
dns: ${DNS}
ports: ports:
- "5715:5715" # unique port for this DS - "5715:5715" # unique port for this DS
- "5815:5815" # ZeroMQ event port - "5815:5815" # ZeroMQ event port
......
...@@ -18,6 +18,7 @@ services: ...@@ -18,6 +18,7 @@ services:
max-file: "10" max-file: "10"
networks: networks:
- control - control
dns: ${DNS}
ports: ports:
- "5728:5728" # unique port for this DS - "5728:5728" # unique port for this DS
- "5828:5828" # ZeroMQ event port - "5828:5828" # ZeroMQ event port
......
...@@ -26,6 +26,7 @@ services: ...@@ -26,6 +26,7 @@ services:
max-file: "10" max-file: "10"
networks: networks:
- control - control
dns: ${DNS}
ports: ports:
- "5709:5709" # unique port for this DS - "5709:5709" # unique port for this DS
- "5809:5809" # ZeroMQ event port - "5809:5809" # ZeroMQ event port
......
...@@ -26,6 +26,7 @@ services: ...@@ -26,6 +26,7 @@ services:
max-file: "10" max-file: "10"
networks: networks:
- control - control
dns: ${DNS}
ports: ports:
- "5710:5710" # unique port for this DS - "5710:5710" # unique port for this DS
- "5810:5810" # ZeroMQ event port - "5810:5810" # ZeroMQ event port
......
...@@ -26,6 +26,7 @@ services: ...@@ -26,6 +26,7 @@ services:
max-file: "10" max-file: "10"
networks: networks:
- control - control
dns: ${DNS}
ports: ports:
- "5712:5712" # unique port for this DS - "5712:5712" # unique port for this DS
- "5812:5812" # ZeroMQ event port - "5812:5812" # ZeroMQ event port
......
...@@ -27,6 +27,7 @@ services: ...@@ -27,6 +27,7 @@ services:
networks: networks:
- control - control
- data - data
dns: ${DNS}
ports: ports:
- "5003:5003/udp" # port to receive SST UDP packets on (first antennafield) - "5003:5003/udp" # port to receive SST UDP packets on (first antennafield)
- "5103:5103/tcp" # port to emit SST TCP packets on - "5103:5103/tcp" # port to emit SST TCP packets on
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment