From 36dba6c7966d83945fd8076c958792750e88704c Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Tue, 2 Nov 2021 16:53:03 +0100 Subject: [PATCH] L2SS-429: create ConfManager and EvSubscriber with Timescale backend --- docker-compose/archiver-timescale.yml | 41 +++++ docker/tango/tango-archiver-ts/Dockerfile | 166 ++++++++++++++++++ .../tango-archiver/data/archiver-devices.json | 26 +++ 3 files changed, 233 insertions(+) create mode 100644 docker/tango/tango-archiver-ts/Dockerfile diff --git a/docker-compose/archiver-timescale.yml b/docker-compose/archiver-timescale.yml index 6f0c17a92..9b5c2bb30 100644 --- a/docker-compose/archiver-timescale.yml +++ b/docker-compose/archiver-timescale.yml @@ -16,3 +16,44 @@ services: - POSTGRES_PASSWORD=password - TANGO_HOST=${TANGO_HOST} restart: unless-stopped + + hdbppts-cm: + image: hdbppts-cm + build: + context: ../docker/tango/tango-archiver-ts + networks: + - control + container_name: hdbppts-cm + depends_on: + - databaseds + - dsconfig + - archiver-timescale + environment: + - TANGO_HOST=${TANGO_HOST} + - HdbManager=archiving/hdbppts/confmanager01 + command: > + /bin/bash -c " + wait-for-it.sh archiver-timescale:5432 --timeout=30 --strict -- + wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict -- + hdbppcm-srv 02" + + hdbppts-es: + image: hdbppts-es + build: + context: ../docker/tango/tango-archiver-ts + networks: + - control + container_name: hdbppts-es + depends_on: + - databaseds + - dsconfig + - archiver-timescale + environment: + - TANGO_HOST=${TANGO_HOST} + - HdbManager=archiving/hdbppts/confmanager01 + command: > + /bin/bash -c " + wait-for-it.sh archiver-timescale:5432 --timeout=30 --strict -- + wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict -- + hdbppes-srv 02" + restart: unless-stopped diff --git a/docker/tango/tango-archiver-ts/Dockerfile b/docker/tango/tango-archiver-ts/Dockerfile new file mode 100644 index 000000000..6ca58718f --- /dev/null +++ b/docker/tango/tango-archiver-ts/Dockerfile @@ -0,0 +1,166 @@ +#ARG DOCKER_REGISTRY_USER +#ARG DOCKER_REGISTRY_HOST +#FROM ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}/tango-cpp:latest +FROM artefact.skao.int/ska-tango-images-tango-cpp:9.3.9 + +USER root + +RUN apt-get update && \ + apt-get install -y ca-certificates + +RUN echo "deb http://deb.debian.org/debian buster-backports main contrib non-free" >> /etc/apt/sources.list && \ + more /etc/apt/sources.list && \ + apt-get update && \ + apt-get install -y \ + checkinstall \ + git \ + cmake \ + make \ + g++ \ + libomniorb4-dev \ + libzmq3-dev \ + libcos4-dev \ + mariadb-server \ + libmariadb-dev-compat libmariadb-dev \ + libmariadbclient-dev \ + postgresql \ + postgresql-contrib \ + libpq5 \ + libpqxx-6.2 \ + libpq-dev \ + libpqxx-dev + +#RUN git clone -b master https://github.com/tango-controls-hdbpp/libhdbpp.git +RUN git clone -b master https://github.com/Diego91RA/libhdbpp.git + +RUN cd libhdbpp \ + && mkdir build \ + && cd build \ + && cmake .. -DCMAKE_INCLUDE_PATH=/usr/local/include/tango \ + && make -j4 + +RUN cd libhdbpp/build \ + && checkinstall \ + --install=yes \ + --fstrans=no \ + --showinstall=no \ + --backup=no \ + --type=debian \ + --pkgsource="https://github.com/tango-controls-hdbpp/libhdbpp" \ + --pkglicense="LGPLv3" \ + --deldesc=no \ + --nodoc \ + --strip \ + --stripso \ + --maintainer="tango" \ + --pkgarch=$(dpkg --print-architecture) \ + --pkgversion="2.0.0" \ + --pkgrelease="SNAPSHOT" \ + --pkgname="libhdbpp" \ + --requires="libzmq5,libomniorb4-2,libcos4-2,libomnithread4" \ + make install + +#RUN git clone -b master --recurse-submodules https://github.com/tango-controls-hdbpp/libhdbpp-timescale.git +RUN git clone -b master --recurse-submodules https://github.com/Diego91RA/libhdbpp-timescale.git + +RUN cd libhdbpp-timescale \ + && mkdir -p build \ + && cd build \ + && cmake .. -DCMAKE_PREFIX_PATH=/usr/local/include/tango -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/local/include/postgresql \ + && make -j4 + +RUN cd libhdbpp-timescale/build \ + && checkinstall \ + --install=yes \ + --fstrans=no \ + --showinstall=no \ + --backup=no \ + --type=debian \ + --pkgsource="https://github.com/tango-controls-hdbpp/libhdbpp-timescale" \ + --pkglicense="LGPLv3" \ + --deldesc=no \ + --nodoc \ + --strip \ + --stripso \ + --maintainer="tango" \ + --pkgarch=$(dpkg --print-architecture) \ + --pkgversion="2.0.0" \ + --pkgrelease="SNAPSHOT" \ + --pkgname="libhdbpp-timescale" \ + --requires="libpq5" \ + make install + +#RUN git clone -b master https://github.com/tango-controls-hdbpp/hdbpp-cm.git +RUN git clone -b master https://github.com/Diego91RA/hdbpp-cm.git + +RUN cd hdbpp-cm \ + && mkdir -p build \ + && cd build \ + && cmake .. -DCMAKE_PREFIX_PATH=/usr/local/include/tango \ + && make -j4 + +RUN cd hdbpp-cm/build \ + && checkinstall \ + --install=yes \ + --fstrans=no \ + --showinstall=no \ + --backup=no \ + --type=debian \ + --pkgsource="https://github.com/tango-controls-hdbpp/hdbpp-cm" \ + --pkglicense="GPLv3" \ + --deldesc=no \ + --nodoc \ + --strip \ + --stripso \ + --maintainer="tango" \ + --pkgarch=$(dpkg --print-architecture) \ + --pkgversion="2.0.0" \ + --pkgrelease="SNAPSHOT" \ + --pkgname="hdbpp-cm" \ + --requires="libzmq5,libomniorb4-2,libcos4-2,libomnithread4" \ + make install + +#RUN git clone -b master https://github.com/tango-controls-hdbpp/hdbpp-es.git +RUN git clone -b master https://github.com/Diego91RA/hdbpp-es.git + +RUN cd hdbpp-es \ + && mkdir -p build \ + && cd build \ + && cmake .. -DCMAKE_PREFIX_PATH=/usr/local/include/tango -DFETCH_LIBHDBPP=OFF -DLIBHDBPP_BACKEND=timescale -DPostgreSQL_TYPE_INCLUDE_DIR=/usr/local/include/postgresql \ + && make -j4 + +RUN cd hdbpp-es/build \ + && checkinstall \ + --install=yes \ + --fstrans=no \ + --showinstall=no \ + --backup=no \ + --type=debian \ + --pkgsource="https://github.com/tango-controls-hdbpp/hdbpp-es" \ + --pkglicense="GPLv3" \ + --deldesc=no \ + --nodoc \ + --strip \ + --stripso \ + --maintainer="tango" \ + --pkgarch=$(dpkg --print-architecture) \ + --pkgversion="2.0.0" \ + --pkgrelease="SNAPSHOT" \ + --pkgname="hdbpp-es" \ + --requires="libzmq5,libomniorb4-2,libcos4-2,libomnithread4" \ + make install + +RUN apt-get update && \ + apt-get install -y \ + build-essential && \ + apt-get clean + +RUN dpkg -i /libhdbpp/build/libhdbpp_2.0.0-SNAPSHOT_amd64.deb +RUN dpkg -i /libhdbpp-timescale/build/libhdbpp-timescale_2.0.0-SNAPSHOT_amd64.deb +RUN dpkg -i /hdbpp-cm/build/hdbpp-cm_2.0.0-SNAPSHOT_amd64.deb +RUN dpkg -i /hdbpp-es/build/hdbpp-es_2.0.0-SNAPSHOT_amd64.deb + +RUN ldconfig + +RUN mv /usr/local/bin/hdb++cm-srv /usr/local/bin/hdbppcm-srv +RUN mv /usr/local/bin/hdb++es-srv /usr/local/bin/hdbppes-srv diff --git a/docker/tango/tango-archiver/data/archiver-devices.json b/docker/tango/tango-archiver/data/archiver-devices.json index 22311da66..6cce12c21 100644 --- a/docker/tango/tango-archiver/data/archiver-devices.json +++ b/docker/tango/tango-archiver/data/archiver-devices.json @@ -13,6 +13,19 @@ } } } + }, + "02": { + "HdbEventSubscriber": { + "archiving/hdbppts/eventsubscriber01": { + "attribute_properties": {}, + "properties": { + "CheckPeriodicTimeoutDelay": ["5"], + "PollingThreadPeriod": ["3"], + "LibConfiguration": ["connect_string= user=postgres password=password host=archiver-timescale port=5432 dbname=hdb","host=archiver-timescale","libname=libhdb++timescale.so","dbname=hdb","port=5432", "user=postgres", "password=password"], + "polled_attr": [] + } + } + } } }, "hdbppcm-srv": { @@ -28,6 +41,19 @@ } } } + }, + "02": { + "HdbConfigurationManager": { + "archiving/hdbppts/confmanager01": { + "attribute_properties": {}, + "properties": { + "ArchiverList": ["archiving/hdbppts/eventsubscriber01"], + "MaxSearchSize": ["1000"], + "LibConfiguration": ["connect_string= user=postgres password=password host=archiver-timescale port=5432 dbname=hdb","host=archiver-timescale","libname=libhdb++timescale.so","dbname=hdb","port=5432", "user=postgres", "password=password"], + "polled_attr": [] + } + } + } } } } -- GitLab