Skip to content
Snippets Groups Projects
Commit 9bb0b8cb authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-534: Remove docker directory, since we do not build the tango source images on our own

parent abf64b5a
Branches
Tags
1 merge request!205Resolve L2SS-534 "Remove docker dir"
Showing
with 4 additions and 484 deletions
......@@ -27,7 +27,7 @@ services:
hdbppts-cm:
image: hdbppts-cm
build:
context: ../docker/tango/tango-archiver-ts
context: tango-archiver-ts
networks:
- control
container_name: ${CONTAINER_NAME_PREFIX}hdbppts-cm
......@@ -53,7 +53,7 @@ services:
hdbppts-es:
image: hdbppts-es
build:
context: ../docker/tango/tango-archiver-ts
context: tango-archiver-ts
networks:
- control
container_name: ${CONTAINER_NAME_PREFIX}hdbppts-es
......
......@@ -80,12 +80,12 @@ services:
- TANGO_HOST=${TANGO_HOST}
command: >
sh -c "wait-for-it.sh ${TANGO_HOST} --timeout=30 --strict --
json2tango -w -a -u /tango-archiver/data/archiver-devices.json &&
json2tango -w -a -u /tango-archiver-data/archiver-devices.json &&
sleep infinity"
volumes:
- ..:/opt/lofar/tango:rw
- ${HOME}:/hosthome
- ../docker/tango/tango-archiver:/tango-archiver
- ../CDB/tango-archiver-data:/tango-archiver-data
logging:
driver: syslog
options:
......
DIRS = tango
BUILDDIRS = $(DIRS:%=build-%)
TESTDIRS = $(DIRS:%=test-%)
PUSHDIRS = $(DIRS:%=push-%)
.DEFAULT_GOAL := help
build: $(DIRS) ## build all images
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%) build
test: $(TESTDIRS)
$(TESTDIRS):
$(MAKE) -C $(@:test-%=%) test
push: $(PUSHDIRS) ## push images to Docker hub
$(PUSHDIRS):
$(MAKE) -C $(@:push-%=%) push
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}'
.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(PUSHDIRS)
.PHONY: build test push help
release=0.4.2
tag=deploy-0.4.2
FROM ubuntu:18.04
ENV KUBE_LATEST_VERSION="v1.16.2"
ENV HELM_VERSION="v3.3.1"
ENV DEBIAN_FRONTEND="noninteractive"
ENV RUNLEVEL="1"
ENV PYTEST_REQUIREMENTS="https://gitlab.com/ska-telescope/skampi/raw/8204ac53ef67941bf22e9f259be1910b2a9636a5/test-requirements.txt"
RUN apt-get update
RUN apt-get install -y make bash git curl apt-transport-https ca-certificates wget software-properties-common
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
RUN apt-key fingerprint 0EBFCD88
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
RUN apt-get update
RUN apt-get install -y docker-ce
RUN export LC_ALL=C
# pip
RUN apt-get install -yq python3-distutils \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3 get-pip.py
COPY pip.conf /etc/pip.conf
# /pip
RUN python3 -m pip install docker-compose
RUN python3 -m pip install yamllint yamale
RUN wget -q https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl \
&& wget -q https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
&& chmod +x /usr/local/bin/helm
RUN wget -q https://github.com/helm/chart-testing/releases/download/v3.0.0-beta.1/chart-testing_3.0.0-beta.1_linux_amd64.tar.gz -O /tmp/ct.tar.gz \
&& cd /tmp \
&& tar -xf ct.tar.gz \
&& mv ct /usr/local/bin/ct
RUN python3 -m pip install -r ${PYTEST_REQUIREMENTS}
RUN python3 -m pip install pytest
RUN apt-get update
RUN apt-get install -y python software-properties-common net-tools
RUN apt-add-repository --yes --update ppa:ansible/ansible
RUN printf "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d
RUN apt-get -y install ansible ssh python-apt
include ../make/Makefile
pre-build:
@echo do some stuff before the docker build
post-build:
@echo do some stuff after the docker build
\ No newline at end of file
[global]
index-url = https://nexus.engageska-portugal.pt/repository/pypi/simple
extra-index-url = https://pypi.org/simple
disable-pip-version-check = True
#!/bin/bash
#
# Copyright 2015 Xebia Nederland B.V.
# Modifications copyright (c) 2019 SKA Organisation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
function hasChanges() {
test -n "$(git status -s .)"
}
function getRelease() {
awk -F= '/^release=/{print $2}' .release
}
function getBaseTag() {
sed -n -e "s/^tag=\(.*\)$(getRelease)\$/\1/p" .release
}
function getTag() {
if [ -z "$1" ] ; then
awk -F= '/^tag/{print $2}' .release
else
echo "$(getBaseTag)$1"
fi
}
function setRelease() {
if [ -n "$1" ] ; then
sed -i.x -e "s/^tag=.*/tag=$(getTag $1)/" .release
sed -i.x -e "s/^release=.*/release=$1/g" .release
rm -f .release.x
runPreTagCommand "$1"
else
echo "ERROR: missing release version parameter " >&2
return 1
fi
}
function runPreTagCommand() {
if [ -n "$1" ] ; then
COMMAND=$(sed -n -e "s/@@RELEASE@@/$1/g" -e 's/^pre_tag_command=\(.*\)/\1/p' .release)
if [ -n "$COMMAND" ] ; then
if ! OUTPUT=$(bash -c "$COMMAND" 2>&1) ; then echo $OUTPUT >&2 && exit 1 ; fi
fi
else
echo "ERROR: missing release version parameter " >&2
return 1
fi
}
function tagExists() {
tag=${1:-$(getTag)}
test -n "$tag" && test -n "$(git tag | grep "^$tag\$")"
}
function differsFromRelease() {
tag=$(getTag)
! tagExists $tag || test -n "$(git diff --shortstat -r $tag .)"
}
function getVersion() {
result=$(getRelease)
#MDC 14092019 the release support must be reviewed
#if differsFromRelease; then
# result="$result-$(git log -n 1 --format=%h .)"
#fi
if hasChanges ; then
result="$result-dirty"
fi
echo $result
}
function nextPatchLevel() {
version=${1:-$(getRelease)}
major_and_minor=$(echo $version | cut -d. -f1,2)
patch=$(echo $version | cut -d. -f3)
version=$(printf "%s.%d" $major_and_minor $(($patch + 1)))
echo $version
}
function nextMinorLevel() {
version=${1:-$(getRelease)}
major=$(echo $version | cut -d. -f1);
minor=$(echo $version | cut -d. -f2);
version=$(printf "%d.%d.0" $major $(($minor + 1))) ;
echo $version
}
function nextMajorLevel() {
version=${1:-$(getRelease)}
major=$(echo $version | cut -d. -f1);
version=$(printf "%d.0.0" $(($major + 1)))
echo $version
}
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/Makefile.mk
#
# Copyright 2015 Xebia Nederland B.V.
# Modifications copyright (c) 2019 SKA Organisation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
NAME=$(shell basename $(CURDIR))
RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support
ifeq ($(strip $(DOCKER_REGISTRY_HOST)),)
DOCKER_REGISTRY_HOST = nexus.engageska-portugal.pt
endif
ifeq ($(strip $(DOCKER_REGISTRY_USER)),)
DOCKER_REGISTRY_USER = ska-docker
endif
IMAGE=$(DOCKER_REGISTRY_HOST)/$(DOCKER_REGISTRY_USER)/$(NAME)
VERSION=$(shell . $(RELEASE_SUPPORT) ; getVersion)
TAG=$(shell . $(RELEASE_SUPPORT); getTag)
SHELL=/bin/bash
DOCKER_BUILD_CONTEXT=.
DOCKER_FILE_PATH=Dockerfile
.PHONY: pre-build docker-build post-build build release patch-release minor-release major-release tag check-status check-release showver \
push pre-push do-push post-push
build: pre-build docker-build post-build
pre-build:
post-build:
pre-push:
post-push:
docker-build: .release
docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH) --build-arg DOCKER_REGISTRY_HOST=$(DOCKER_REGISTRY_HOST) --build-arg DOCKER_REGISTRY_USER=$(DOCKER_REGISTRY_USER) --build-arg http_proxy --build-arg https_proxy
@DOCKER_MAJOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \
DOCKER_MINOR=$(shell docker -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \
if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \
echo docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\
else \
echo docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\
docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \
fi
.release:
@echo "release=0.0.0" > .release
@echo "tag=$(NAME)-0.0.0" >> .release
@echo INFO: .release created
@cat .release
release: check-status check-release build push
push: pre-push do-push post-push
do-push:
@curl --output /dev/null --silent --head --fail -r 0-0 "https://$(DOCKER_REGISTRY_HOST)/repository/docker/v2/$(DOCKER_REGISTRY_USER)/$(NAME)/manifests/$(VERSION)"; \
result=$$?; \
if [ $$result -eq 0 ] ; then \
echo "Version $(VERSION) of image $(IMAGE) already exists"; \
else \
echo "Version $(VERSION) of image $(IMAGE) does not exist"; \
docker push $(IMAGE):$(VERSION); \
docker push $(IMAGE):latest; \
fi;
snapshot: build push
showver: .release
@. $(RELEASE_SUPPORT); getVersion
tag-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel)
tag-patch-release: .release tag
tag-minor-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel)
tag-minor-release: .release tag
tag-major-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
tag-major-release: .release tag
patch-release: tag-patch-release release
@echo $(VERSION)
minor-release: tag-minor-release release
@echo $(VERSION)
major-release: tag-major-release release
@echo $(VERSION)
tag: TAG=$(shell . $(RELEASE_SUPPORT); getTag $(VERSION))
tag: check-status
# @. $(RELEASE_SUPPORT) ; ! tagExists $(TAG) || (echo "ERROR: tag $(TAG) for version $(VERSION) already tagged in git" >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; setRelease $(VERSION)
# git add .
# git commit -m "bumped to version $(VERSION)" ;
# git tag $(TAG) ;
# @ if [ -n "$(shell git remote -v)" ] ; then git push --tags ; else echo 'no remote to push tags to' ; fi
check-status:
@. $(RELEASE_SUPPORT) ; ! hasChanges || (echo "ERROR: there are still outstanding changes" >&2 && exit 1) ;
check-release: .release
@. $(RELEASE_SUPPORT) ; tagExists $(TAG) || (echo "ERROR: version not yet tagged in git. make [minor,major,patch]-release." >&2 && exit 1) ;
@. $(RELEASE_SUPPORT) ; ! differsFromRelease $(TAG) || (echo "ERROR: current directory differs from tagged $(TAG). make [minor,major,patch]-release." ; exit 1)
DIRS = tango-builder tango-dependencies tango-db tango-cpp tango-java tango-rest tango-dsconfig ska-python-buildenv tango-pogo tango-starter tango-libtango tango-jive ska-python-runtime tango-admin tango-databaseds tango-test tango-itango tango-vscode tango-vnc tango-pytango mariadb_hdbpp tango-archiver hdbpp_viewer
TEST = ska-python-buildenv tango-itango tango-rest tango-db tango-cpp tango-archiver
BUILDDIRS = $(DIRS:%=build-%)
TESTDIRS = $(TEST:%=test-%)
CHECKSTATUSDIRS = $(DIRS:%=checkstatus-%)
SHOWVERDIRS = $(DIRS:%=showver-%)
PUSHDIRS = $(DIRS:%=push-%)
.DEFAULT_GOAL := help
build: $(DIRS) ## build all images
$(DIRS): $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $(@:build-%=%) build
test: $(TESTDIRS)
$(TESTDIRS):
$(MAKE) -C $(@:test-%=%) test
check-status: $(CHECKSTATUSDIRS) ## check whether subdirectories have uncommitted changes
$(CHECKSTATUSDIRS):
$(MAKE) -C $(@:checkstatus-%=%) check-status
showver: $(SHOWVERDIRS) ## show image versions
$(SHOWVERDIRS):
$(MAKE) -C $(@:showver-%=%) showver
push: $(PUSHDIRS) ## push images to Docker hub
$(PUSHDIRS):
$(MAKE) -C $(@:push-%=%) push
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}'
.PHONY: subdirs $(DIRS)
.PHONY: subdirs $(BUILDDIRS)
.PHONY: subdirs $(CHECKSTATUSDIRS)
.PHONY: subdirs $(PUSHDIRS)
.PHONY: subdirs $(SHOWVERDIRS)
.PHONY: build check-status showver push help
release=1.10.1
tag=hdbpp_viewer-1.10.1
ARG DOCKER_REGISTRY_USER
ARG DOCKER_REGISTRY_HOST
FROM ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}/tango-java:latest
USER root
ENV DEBIAN_FRONTEND="noninteractive"
ENV HDBPP_DOWNLOAD_URL="https://nexus.engageska-portugal.pt/repository/raw/tango-cs/hdbpp_viewer/hdbpp_viewer_resources_20200527.tgz"
RUN apt-get update \
&& apt-get install -y wget
# Untarring this will create the `hdbpp_viewer` folder.
# Inside the tarball is a README detailing the source files.
RUN wget "$HDBPP_DOWNLOAD_URL" -O hdbpp_viewer_resources.tgz \
&& tar zxvf hdbpp_viewer_resources.tgz \
&& rm hdbpp_viewer_resources.tgz
ADD hdbpp_viewer_script hdbpp_viewer
RUN find . -iname HDBPP.jar
RUN find . -iname ATKCore.jar
USER tango
include ../../make/Makefile
pre-build:
@echo do some stuff before the docker build
post-build:
@echo do some stuff after the docker build
\ No newline at end of file
# HDB++ Viewer Docker Container
[![Documentation Status](https://readthedocs.org/projects/ska-docker/badge/?version=latest)](https://developer.skatelescope.org/projects/ska-docker/en/latest/?badge=latest)
# 1: Introduction
The HdbViewer GUI visualizes the data stored in the Historical database(HDB). This Java framework, allows
retrieving the data from Maria database(HDB). It has been written using Swing and needs a JVM higher than 1.7.0.
[Link to the documentation](https://github.com/tango-controls-hdbpp/hdbpp-viewer)
# 2: Prerequisites - Installation
[Link to hdb++ github repository](https://github.com/tango-controls-hdbpp/hdbpp-viewer)
# 3: HDB++ Viewer dockerfile
* Image Location
* nexus.engageska-portugal.pt/ska-docker/tango-java:latest
* Dependencies
* TANGO=$BASEDIR/JTango.jar
* TANGOATK=$BASEDIR/ATKCore.jar:$BASEDIR/ATKWidget.jar
* HDBVIEWER=$BASEDIR/jhdbviewer.jar
* HDBPP=$BASEDIR/HDBPP.jar
* JYTHON=$BASEDIR/jython.jar
* JCALENDAR=$BASEDIR/jcalendar.jar
* Environment Variables
* HDB_TYPE=mysql //type of database
* HDB_MYSQL_HOST=archiver-maria-db //database host (In this case, host is container name)
* HDB_MYSQL_PORT=3306 //database port
* HDB_USER=tango //database user
* HDB_PASSWORD=tango //user password
* HDB_NAME=hdbpp //database name
* Command line to set the environment variables
* export HDB_TYPE
* export HDB_MYSQL_HOST
* export HDB_USER
* export HDB_PASSWORD
* export HDB_NAME
* export HDB_MYSQL_PORT
* CLASSPATH=$TANGO:$TANGOATK:$HDBVIEWER:$HDBPP:$JYTHON:$JCALENDAR
* export CLASSPATH
# 4: Container Creation for HDB++ Viewer
nexus.engageska-portugal.pt/ska-docker/hdbpp_viewer image with tag 'latest' is used in the hdbpp-viewer container.
Databaseds, mariadb, hdbpp-es and hdbpp-cm containers should be up and running to access HDB++ viewer device.
Following are the environment variables set at the time of container creation: XAUTHORITY=${XAUTHORITY}, DISPLAY=${DISPLAY},
TANGO_HOST=${TANGO_HOST}, HDB_TYPE, HDB_MYSQL_HOST, HDB_MYSQL_PORT, HDB_USER, HDB_PASSWORD and HDB_NAME.
Refer the link
[docker-compose.yaml](https://gitlab.com/ska-telescope/ska-docker/blob/master/docker/tango/tango-archiver/docker-compose.yml)
# 5: Running HDB++ viewer inside docker containers
HDB++ viewer can run on dockers using following command inside the ./tango-archiver
In order to launch the viewer, execute:
`make test`
#!/bin/bash
if [ ! $TANGO_HOST ] && [ -f /etc/tangorc ]; then
. /etc/tangorc
fi
#
# Define the CLASSPATH
#
LOGBACK=${TANGO_LOGBACK:-/usr/local/share/tango/logback.xml}
BASEDIR=/hdbpp_viewer
TANGO=$BASEDIR/JTango.jar
TANGOATK=$BASEDIR/ATKCore.jar:$BASEDIR/ATKWidget.jar
HDBVIEWER=$BASEDIR/jhdbviewer.jar
HDBPP=$BASEDIR/HDBPP.jar
JYTHON=$BASEDIR/jython.jar
JCALENDAR=$BASEDIR/jcalendar.jar
CLASSPATH=$TANGO:$TANGOATK:$HDBVIEWER:$HDBPP:$JYTHON:$JCALENDAR
echo "************************************************"
env
echo "************************************************"
echo "/usr/bin/java -Dlogback.configurationFile="$LOGBACK" -DTANGO_HOST=$TANGO_HOST HDBViewer.MainPanel $@"
/usr/bin/java -Dlogback.configurationFile="$LOGBACK" -DTANGO_HOST=$TANGO_HOST HDBViewer.MainPanel $@
release=1.1.0
tag=mariadb_hdbpp-1.1.0
ARG DOCKER_REGISTRY_USER
ARG DOCKER_REGISTRY_HOST
FROM ${DOCKER_REGISTRY_HOST}/${DOCKER_REGISTRY_USER}/tango-db:latest
COPY resources/create_hdb++_mysql.sql docker-entrypoint-initdb.d/create_db.sql
COPY resources/my.cnf /etc/mysql/conf.d
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment