Commit 89e485a7 authored by dgasull's avatar dgasull

Updated submodules and deploy scripts

parent bb19684c
[submodule "events-model"]
path = events-model
url = https://gitlab.bsc.es/elastic-h2020/elastic-sa/events-dataclay-model.git
url = https://gitlab.bsc.es/elastic-h2020/elastic-use-cases/object-detection-and-tracking/events-dataclay-model.git
[submodule "nfrtool-model"]
path = nfrtool-model
url = https://gitlab.bsc.es/elastic-h2020/elastic-sa/dataclay.git
url = https://gitlab.bsc.es/elastic-h2020/elastic-sa/nfr-tool/dataclay.git
This diff is collapsed.
......@@ -17,71 +17,83 @@
#===================================================================================
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
VERSION=1.0
REQUIRED_DOCKER_VERSION=19
export PLATFORMS=linux/amd64,linux/arm64
############################# Prepare docker builder #############################
printf "Checking if docker version >= $REQUIRED_DOCKER_VERSION..."
version=$(docker version --format '{{.Server.Version}}')
if [[ "$version" < "$REQUIRED_DOCKER_VERSION" ]]; then
echo "ERROR: Docker version is less than $REQUIRED_DOCKER_VERSION"
exit 1
fi
printf "OK\n"
# prepare architectures
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -t arm64v8/ubuntu uname -m
DOCKER_BUILDER=$(docker buildx create)
docker buildx use $DOCKER_BUILDER
echo "Checking buildx with available platforms to simulate..."
docker buildx inspect --bootstrap
BUILDER_PLATFORMS=$(docker buildx inspect --bootstrap | grep Platforms | awk -F":" '{print $2}')
IFS=',' read -ra BUILDER_PLATFORMS_ARRAY <<< "$BUILDER_PLATFORMS"
IFS=',' read -ra SUPPORTED_PLATFORMS_ARRAY <<< "$PLATFORMS"
echo "Builder created with platforms: ${BUILDER_PLATFORMS_ARRAY[@]}"
echo "Welcome to ELASTIC-dataClay deployment script, please which version do you want to publish?"
read VERSION
echo "Going to publish:"
echo " -- elasticeuh2020/dataclay-pyclient:${VERSION}-requirements"
read -r -p "Are you sure? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
then
#Print the split string
for i in "${SUPPORTED_PLATFORMS_ARRAY[@]}"
do
FOUND=false
SUP_PLATFORM=`echo $i | sed 's/ *$//g'` #remove spaces
printf "Checking if platform $i can be simulated by buildx..."
for j in "${BUILDER_PLATFORMS_ARRAY[@]}"
do
B_PLATFORM=`echo $j | sed 's/ *$//g'` #remove spaces
if [ "$SUP_PLATFORM" == "$B_PLATFORM" ]; then
FOUND=true
break
fi
done
if [ "$FOUND" = false ] ; then
echo "ERROR: missing support for $i in buildx builder."
echo " Check https://github.com/multiarch/qemu-user-static for more information on how to simulate architectures"
return -1
REQUIRED_DOCKER_VERSION=19
export PLATFORMS=linux/amd64,linux/arm64
############################# Prepare docker builder #############################
printf "Checking if docker version >= $REQUIRED_DOCKER_VERSION..."
version=$(docker version --format '{{.Server.Version}}')
if [[ "$version" < "$REQUIRED_DOCKER_VERSION" ]]; then
echo "ERROR: Docker version is less than $REQUIRED_DOCKER_VERSION"
exit 1
fi
printf "OK\n"
# prepare architectures
docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm -t arm64v8/ubuntu uname -m
DOCKER_BUILDER=$(docker buildx create)
docker buildx use $DOCKER_BUILDER
echo "Checking buildx with available platforms to simulate..."
docker buildx inspect --bootstrap
BUILDER_PLATFORMS=$(docker buildx inspect --bootstrap | grep Platforms | awk -F":" '{print $2}')
IFS=',' read -ra BUILDER_PLATFORMS_ARRAY <<< "$BUILDER_PLATFORMS"
IFS=',' read -ra SUPPORTED_PLATFORMS_ARRAY <<< "$PLATFORMS"
echo "Builder created with platforms: ${BUILDER_PLATFORMS_ARRAY[@]}"
done
#######################################################################################
SECONDS=0
# NOTE we create a requirements image to avoid building it many times (it may take time for ARM64)
echo " ===== Building docker elasticeuh2020/dataclay-pyclient:${VERSION}-requirements ====="
echo " WARNING!!!!!!!!!!!!!!!!!!: It may take a lot of time for ARM64 arch "
docker buildx build -f elastic.pyrequirements.Dockerfile \
-t elasticeuh2020/dataclay-pyclient:${VERSION}-requirements --platform $PLATFORMS --push .
#Print the split string
for i in "${SUPPORTED_PLATFORMS_ARRAY[@]}"
do
FOUND=false
SUP_PLATFORM=`echo $i | sed 's/ *$//g'` #remove spaces
printf "Checking if platform $i can be simulated by buildx..."
for j in "${BUILDER_PLATFORMS_ARRAY[@]}"
do
B_PLATFORM=`echo $j | sed 's/ *$//g'` #remove spaces
if [ "$SUP_PLATFORM" == "$B_PLATFORM" ]; then
FOUND=true
break
fi
done
if [ "$FOUND" = false ] ; then
echo "ERROR: missing support for $i in buildx builder."
echo " Check https://github.com/multiarch/qemu-user-static for more information on how to simulate architectures"
return -1
fi
printf "OK\n"
done
docker buildx rm $DOCKER_BUILDER
duration=$SECONDS
echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "ELASTIC dataClay deployment FINISHED! "
\ No newline at end of file
#######################################################################################
SECONDS=0
# NOTE we create a requirements image to avoid building it many times (it may take time for ARM64)
echo " ===== Building docker elasticeuh2020/dataclay-pyclient:${VERSION}-requirements ====="
echo " WARNING!!!!!!!!!!!!!!!!!!: It may take a lot of time for ARM64 arch "
docker buildx build -f elastic.pyrequirements.Dockerfile \
--cache-to=type=registry,ref=elasticeuh2020/dataclay-pyclient:buildxcache${VERSION}-requirements,mode=max \
--cache-from=type=registry,ref=elasticeuh2020/dataclay-pyclient:buildxcache${VERSION}-requirements \
-t elasticeuh2020/dataclay-pyclient:${VERSION}-requirements --platform $PLATFORMS --push .
docker buildx rm $DOCKER_BUILDER
duration=$SECONDS
echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
echo "ELASTIC dataClay deployment FINISHED! "
else
echo "Aborting"
fi
\ No newline at end of file
......@@ -5,7 +5,8 @@ ENV DATACLAYCLIENTCONFIG=/elastic/cfgfiles/client.properties
ENV DATACLAYGLOBALCONFIG=/elastic/cfgfiles/global.properties
ENV DATACLAYSESSIONCONFIG=/elastic/cfgfiles/session.properties
ENV JAVASTUBSPATH=/elastic/stubs
ENV DATACLAY_JAR="/root/.m2/repository/es/bsc/dataclay/dataclay/2.4/dataclay-2.4-jar-with-dependencies.jar"
ENV DATACLAY_JAR_MVN="/root/.m2/repository/es/bsc/dataclay/dataclay/2.4/dataclay-2.4-jar-with-dependencies.jar"
ENV DATACLAY_JAR="/elastic/dataclay.jar"
ENV STUBS_JAR=${ELASTIC_HOME}/stubs.jar
# Prepare
......@@ -13,7 +14,11 @@ WORKDIR ${ELASTIC_HOME}
# Get dataClay maven dependency and set env
RUN mvn -DgroupId=es.bsc.dataclay -DartifactId=dataclay -Dversion=2.4 -Dclassifier=jar-with-dependencies dependency:get
# Move JAR to allow apps without docker to get it easily via docker cp
# Also to not use maven but java directly
RUN cp $DATACLAY_JAR_MVN $DATACLAY_JAR
# Get stubs
COPY ./cfgfiles/ ${ELASTIC_HOME}/cfgfiles/
COPY ./tmp/stubs/java_stubs ${JAVASTUBSPATH}
......@@ -21,8 +26,8 @@ COPY ./tmp/stubs/java_stubs ${JAVASTUBSPATH}
RUN jar cvf ${STUBS_JAR} -C ${JAVASTUBSPATH} .
# Install stubs in local repository to use it as a pom dependency
RUN mvn install:install-file -Dfile=${STUBS_JAR} -DgroupId=nfrtool-dataclay \
-DartifactId=nfrtool-dataclay-stubs -Dversion=2.4 -Dpackaging=jar -DcreateChecksum=true
RUN mvn install:install-file -Dfile=${STUBS_JAR} -DgroupId=es.bsc.dataclay \
-DartifactId=nfrtool-dataclay-stubs -Dversion=latest -Dpackaging=jar -DcreateChecksum=true
# Run
ENTRYPOINT ["mvn"]
\ No newline at end of file
......@@ -21,8 +21,5 @@ RUN mkdir -p ${PYSTUBSPATH}
COPY ./cfgfiles/ ${ELASTIC_HOME}/cfgfiles/
COPY ./tmp/stubs/python_stubs ${PYSTUBSPATH}
# Install MQTT client
RUN pip install paho-mqtt
# Run
ENTRYPOINT ["python3", "-u"]
\ No newline at end of file
FROM python:3.7.5-slim-stretch
# ============ REQUIREMENTS ================== #
# Install
RUN apt-get update \
&& apt-get install --no-install-recommends -y --allow-unauthenticated \
gcc libyaml-dev build-essential curl >/dev/null \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip
# Install dataClay
RUN pip install --upgrade pip
RUN pip install dataClay
RUN pip3 install dataClay
# Install MQTT client
RUN pip install paho-mqtt
\ No newline at end of file
# RUN pip3 install paho-mqtt
\ No newline at end of file
Subproject commit 460b8b35083b6de54319c8bea58ed6a68daf8947
Subproject commit 769362762bd10c39ce7c8f9cca940a0754291520
Subproject commit 657e2f5da82e8a3a23a4322521bce51dc7a039af
Subproject commit 08bcbcf3002786b35ff48ca785e63a72da776023
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment