Skip to content

Commit

Permalink
Added avahi to all targets
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed Apr 15, 2024
1 parent 3b4ef66 commit 788b082
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 28 deletions.
3 changes: 2 additions & 1 deletion daliuge-common/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ FROM ubuntu:20.04
ARG BUILD_ID
LABEL stage=builder
LABEL build=$BUILD_ID
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get install -y gcc python3 python3.8-venv python3-pip python3-distutils python3-appdirs libmetis-dev curl git sudo && \
apt-get install -y avahi-utils gcc python3 python3.8-venv python3-pip python3-distutils python3-appdirs libmetis-dev curl git sudo && \
apt-get clean

COPY / /daliuge
Expand Down
4 changes: 2 additions & 2 deletions daliuge-common/docker/Dockerfile.casa
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FROM kernsuite/base:7
ARG BUILD_ID
LABEL stage=builder
LABEL build=$BUILD_ID
RUN apt-get update && apt-get install -y gcc python3-pip python3-venv wget && \
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y avahi-utils gcc python3-pip python3-venv wget && \
pip3 install -U pip

# add_arrow_repo:
Expand Down Expand Up @@ -38,4 +39,3 @@ RUN cd /daliuge && \
. ~/dlg/bin/activate && \
pip3 install numpy && \
pip3 install .

3 changes: 2 additions & 1 deletion daliuge-common/docker/Dockerfile.devcuda
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ FROM ubuntu:20.04
ARG BUILD_ID
LABEL stage=builder
LABEL build=$BUILD_ID
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get install -y gcc python3 python3.8-venv python3-pip python3-distutils libmetis-dev curl git sudo && \
apt-get install -y avahi-utils gcc python3 python3.8-venv python3-pip python3-distutils libmetis-dev curl git sudo && \
apt-get clean

COPY / /daliuge
Expand Down
3 changes: 2 additions & 1 deletion daliuge-common/docker/Dockerfile.ray
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ FROM rayproject/ray:74cbf0-py38
ARG BUILD_ID
LABEL stage=builder
LABEL build=$BUILD_ID
RUN sudo apt-get update && sudo apt-get install -y gcc
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN sudo apt-get update && sudo apt-get install -y avahi-utils gcc

COPY / /daliuge

Expand Down
15 changes: 10 additions & 5 deletions daliuge-engine/build_engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ case "$1" in
docker build --build-arg USER=${USER} --build-arg VCS_TAG=${VCS_TAG} --no-cache -t icrar/daliuge-engine.big:${VCS_TAG} -f docker/Dockerfile .
echo "Build finished! Slimming the image now"
echo ">>>>> docker-slim output <<<<<<<<<"
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --include-shell \
# docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --include-shell \
# --include-path /etc --include-path /usr/local/lib --include-path /usr/local/bin --include-path /usr/lib/python3.8 \
# --include-path /usr/lib/python3 --include-path /usr/bin/hostname --include-path /dlg --include-path /daliuge --publish-exposed-ports=true \
# --http-probe=true --tag=icrar/daliuge-engine:${VCS_TAG}\
# icrar/daliuge-engine.big:${VCS_TAG} \
slim build --include-shell \
--include-path /etc --include-path /usr/local/lib --include-path /usr/local/bin --include-path /usr/lib/python3.8 \
--include-path /usr/lib/python3 --include-path /usr/bin/hostname --include-path /dlg --include-path /daliuge --publish-exposed-ports=true \
--http-probe=true --tag=icrar/daliuge-engine:${VCS_TAG}\
icrar/daliuge-engine.big:${VCS_TAG} \
;;
--include-path /usr/lib/python3 --include-bin /usr/bin/hostname --include-path /dlg --include-path /daliuge \
--include-bin /usr/sbin/service --publish-exposed-ports=true \
--http-probe=false --tag=icrar/daliuge-engine.slim:${VCS_TAG}\
icrar/daliuge-engine.big:${VCS_TAG};;
*)
echo "Usage: build_engine.sh <dep|dev|devall|slim>"
exit 0;;
Expand Down
2 changes: 2 additions & 0 deletions daliuge-engine/dlg/manager/composite_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ def dmPort(self):

def check_dm(self, host, port=None, timeout=10):
port = port or self._dmPort
if ":" in host:
host, port = host.split(":")
logger.debug("Checking DM presence at %s:%d", host, port)
dm_is_there = portIsOpen(host, port, timeout)
return dm_is_there
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/manager/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def fwrapper(*args, **kwargs):
origin = bottle.request.headers.raw("Origin")
logger.debug("CORS request comming from: %s", origin)
if origin is None or re.match(
r"http://dlg-trans.local:80[0-9][0-9]", origin
r"http://(dlg-trans.local:80[0-9][0-9]|dlg-trans.icrar.org)", origin
):
origin = "http://dlg-trans.local:8084"
elif re.match(r"http://((localhost)|(127.0.0.1)):80[0-9][0-9]", origin):
Expand Down
2 changes: 0 additions & 2 deletions daliuge-engine/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
ARG VCS_TAG
ARG USER
# We need the base image we build with the other Dockerfile
FROM icrar/daliuge-common:${VCS_TAG:-latest}

# RUN sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata \
# gcc g++ gdb casacore-dev clang-tidy-10 clang-tidy libboost1.71-all-dev libgsl-dev

USER ${USER}
COPY / /daliuge
RUN . /dlg/bin/activate && pip install wheel && cd /daliuge && \
pip install .
Expand Down
1 change: 1 addition & 0 deletions daliuge-engine/docker/Dockerfile.casa
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ FROM icrar/daliuge-common:master-casa

RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends tzdata \
gnupg2 software-properties-common wget git git-lfs gcc g++ make tmux python3-pip cmake libboost1.71-all-dev
RUN service dbus start && service avahi-daemon start && avahi-set-host-name dlg-engine

# install casacore
RUN mkdir -p /code && cd /code &&\
Expand Down
2 changes: 0 additions & 2 deletions daliuge-engine/docker/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
ARG VCS_TAG
ARG USER
# We need the base image we build with the other Dockerfile
FROM icrar/daliuge-common:${VCS_TAG:-latest}

# RUN sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata \
# gcc g++ gdb casacore-dev clang-tidy-10 clang-tidy libboost1.71-all-dev libgsl-dev
RUN service dbus start && service avahi-daemon start && avahi-set-host-name dlg-engine
RUN useradd --create-home awicenec
COPY / /daliuge
RUN . /dlg/bin/activate && pip install --upgrade pip && pip install wheel && cd /daliuge && \
pip install .
Expand Down
4 changes: 2 additions & 2 deletions daliuge-engine/docker/Dockerfile.devall
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG VCS_TAG
ARG USER
# We need the base image we build with the other Dockerfile
FROM icrar/daliuge-common:${VCS_TAG:-latest}

Expand All @@ -9,7 +8,8 @@ FROM icrar/daliuge-common:${VCS_TAG:-latest}
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gcc curl python3-pip python3-numpy

USER ${USER}
RUN service dbus start && service avahi-daemon start && avahi-set-host-name dlg-engine
# USER ${USER}
COPY / /daliuge
RUN . /dlg/bin/activate && pip install wheel && cd /daliuge && \
pip install .
Expand Down
1 change: 1 addition & 0 deletions daliuge-engine/docker/Dockerfile.ray
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FROM icrar/daliuge-common:${VCS_TAG:-latest}
# gcc g++ gdb casacore-dev clang-tidy-10 clang-tidy libboost1.71-all-dev libgsl-dev

RUN sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends gcc python3-pip curl
RUN service dbus start && service avahi-daemon start && avahi-set-host-name dlg-engine

COPY / /daliuge
RUN . /home/ray/dlg/bin/activate && \
Expand Down
1 change: 1 addition & 0 deletions daliuge-engine/docker/Dockerfile_incontext
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM icrar/daliuge-base:latest
# Get the local DALiuGE sources and install them in the system
COPY / /daliuge
RUN pip install wheel && cd ~/daliuge && pip install .
RUN service dbus start && service avahi-daemon start && avahi-set-host-name dlg-engine

# Second stage build taking what's required from first stage
FROM icrar/daliuge-base:latest
Expand Down
14 changes: 9 additions & 5 deletions daliuge-engine/run_engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ case "$1" in
echo "docker run -td "${DOCKER_OPTS}" icrar/daliuge-engine:${VCS_TAG}"
docker run -td ${DOCKER_OPTS} icrar/daliuge-engine:${VCS_TAG}
sleep 3
docker exec -u root daliuge-engine bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1"
ENGINE_NAME=`docker exec daliuge-engine sh -c "hostname"`
ENGINE_IP=`docker exec daliuge-engine sh -c "hostname --ip-address"`
# exit 0
Expand All @@ -60,7 +61,7 @@ case "$1" in
ENGINE_NAME=`docker exec daliuge-engine sh -c "hostname"`
ENGINE_IP=`docker exec daliuge-engine sh -c "hostname --ip-address"`
curl -X POST http://${ENGINE_IP}:9000/managers/island/start
curl -X POST http://${ENGINE_IP}:8001/api/node/dlg-engine.local;;
curl -X POST http://${ENGINE_IP}:8001/api/node/dlg-engine.local:8000;;
# exit 0;;
"casa")
DLG_ROOT="/tmp/dlg"
Expand All @@ -71,6 +72,7 @@ case "$1" in
echo "docker run -td ${DOCKER_OPTS} ${CONTAINER_NM}"
docker run -td ${DOCKER_OPTS} ${CONTAINER_NM}
sleep 3
docker exec -u root daliuge-engine bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1"
ENGINE_NAME=`docker exec daliuge-engine sh -c "hostname"`
ENGINE_IP=`docker exec daliuge-engine sh -c "hostname --ip-address"`
curl -X POST http://${ENGIONE_IP}:9000/managers/island/start;;
Expand All @@ -79,12 +81,14 @@ case "$1" in
export DLG_ROOT="$HOME/dlg"
common_prep
echo "Running Engine development version in background..."
echo "docker run -td ${DOCKER_OPTS} icrar/daliuge-engine:${VCS_TAG}"
docker run -td ${DOCKER_OPTS} icrar/daliuge-engine:${VCS_TAG}
echo "docker run -td ${DOCKER_OPTS} icrar/daliuge-engine.slim:${VCS_TAG}"
docker run -td ${DOCKER_OPTS} icrar/daliuge-engine.slim:${VCS_TAG}
sleep 3
docker exec -u root daliuge-engine bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1"
ENGINE_NAME=`docker exec daliuge-engine sh -c "hostname"`
ENGINE_IP=`docker exec daliuge-engine sh -c "hostname --ip-address"`
curl -X POST http://${ENGINE_IP}:9000/managers/island/start;;
curl -X POST http://${ENGINE_IP}:9000/managers/island/start
curl -X POST http://${ENGINE_IP}:8001/api/node/dlg-engine.local:8000;;
# exit 0;;
"local")
common_prep
Expand All @@ -102,5 +106,5 @@ case "$1" in
exit 0;;
esac
echo
echo "Engine NAME/IP address: ${ENGINE_NAME}/${ENGINE_IP}"
echo "Engine NAME/IP address: http://${ENGINE_NAME}.local:8000 / ${ENGINE_IP}"

7 changes: 5 additions & 2 deletions daliuge-translator/build_translator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ case "$1" in
echo ""
echo ""
echo ">>>>> docker-slim output <<<<<<<<<"
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --include-shell \
# docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/docker-slim build --include-shell \
# --include-path /usr/bin/hostname --include-path /usr/local/lib --include-path /usr/local/bin --include-path /daliuge --include-path /dlg \
# --http-probe=false --tag=icrar/daliuge-translator:${VCS_TAG} icrar/daliuge-translator.big:${VCS_TAG}
slim build --include-shell \
--include-path /usr/bin/hostname --include-path /usr/local/lib --include-path /usr/local/bin --include-path /daliuge --include-path /dlg \
--http-probe=false --tag=icrar/daliuge-translator:${VCS_TAG} icrar/daliuge-translator.big:${VCS_TAG}
--include-bin /usr/sbin/service --include-bin /usr/bin/hostname --http-probe=false --tag=icrar/daliuge-translator.slim:${VCS_TAG} icrar/daliuge-translator.big:${VCS_TAG}
;;
*)
echo "Usage: build_translator.sh <dep|dev|slim>"
Expand Down
4 changes: 4 additions & 0 deletions daliuge-translator/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ LABEL build=$BUILD_ID
# apt-get clean && \
# apt install -y gcc python3-venv python3-distutils

RUN service avahi-daemon stop && \
service dbus start && \
service avahi-daemon start && \
avahi-set-host-name dlg-trans
COPY / /daliuge

RUN . /dlg/bin/activate && \
Expand Down
4 changes: 4 additions & 0 deletions daliuge-translator/docker/Dockerfile.ray
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ LABEL stage=builder
LABEL build=$BUILD_ID
RUN sudo apt-get update && sudo apt-get install -y python3-pip gcc && sudo apt-get clean

RUN service avahi-daemon stop && \
service dbus start && \
service avahi-daemon start && \
avahi-set-host-name dlg-trans
COPY / /daliuge

RUN . ~/dlg/bin/activate && \
Expand Down
23 changes: 19 additions & 4 deletions daliuge-translator/run_translator.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
#!/usr/bin/env bash
if [ $2 ]
then
export VCS_TAG=$2
export C_TAG=$VCS_TAG
else
export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//`
export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'`
fi
case "$1" in
"dep")
VCS_TAG=`git describe --tags --abbrev=0|sed s/v//`
echo "Running Translator deployment version in background..."
docker run -h dlg-trans --name daliuge-translator --rm -td -p 8084:8084 icrar/daliuge-translator:${VCS_TAG};;
docker run -h dlg-trans --name daliuge-translator --rm -td -p 8084:8084 icrar/daliuge-translator:${VCS_TAG}
sleep 3
docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";;
"dev")
export VCS_TAG=`git rev-parse --abbrev-ref HEAD| tr '[:upper:]' '[:lower:]'`
echo "Running Translator development version in background..."
docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${VCS_TAG}
sleep 3
docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";;
"slim")
echo "Running Translator development version in background..."
docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator.slim:${VCS_TAG}
sleep 3
docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";;
"casa")
export VCS_TAG=`git rev-parse --abbrev-ref HEAD| tr '[:upper:]' '[:lower:]'`-casa
echo "Running Translator development version in foreground..."
docker run -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${VCS_TAG};;
docker run -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${VCS_TAG}
sleep 3
docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";;
*)
echo "Usage run_translator.sh <dep|dev|casa>"
exit 0;;
Expand Down

0 comments on commit 788b082

Please sign in to comment.