From d2a41d1bff217b6662304f70c129ebeb3d340a65 Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Thu, 24 Apr 2025 16:40:55 +0300 Subject: [PATCH] Feature/docker dbinit (#2371) * Standalone tool for initializing of hawkBit Database Signed-off-by: Avgustin Marinov * Add docker build for dbinit Signed-off-by: Avgustin Marinov --------- Signed-off-by: Avgustin Marinov --- .gitignore | 1 - docker/README.md | 6 +- docker/{docker_build => build}/Dockerfile | 3 +- docker/build/Dockerfile_dbinit | 45 +++++++ docker/build/Dockerfile_dbinit_dev | 32 +++++ docker/{docker_build => build}/Dockerfile_dev | 0 docker/{docker_build => build}/KEY | 0 docker/{docker_build => build}/README.md | 0 docker/{docker_build => build}/build_dev.sh | 12 +- .../{ => mysql}/docker-compose-deps-mysql.yml | 2 +- ...er-compose-micro-services-dbinit-mysql.yml | 106 +++++++++++++++++ .../docker-compose-micro-services-mysql.yml | 0 ...o-services-with-simple-ui-dbinit-mysql.yml | 32 +++++ ...se-micro-services-with-simple-ui-mysql.yml | 0 .../docker-compose-monolith-dbinit-mysql.yml | 66 +++++++++++ .../docker-compose-monolith-mysql.yml | 0 ...e-monolith-with-simple-ui-dbinit-mysql.yml | 32 +++++ ...-compose-monolith-with-simple-ui-mysql.yml | 0 .../docker-compose-deps-postgres.yml | 2 +- ...compose-micro-services-dbinit-postgres.yml | 110 ++++++++++++++++++ ...docker-compose-micro-services-postgres.yml | 0 ...ervices-with-simple-ui-dbinit-postgres.yml | 32 +++++ ...micro-services-with-simple-ui-postgres.yml | 0 ...ocker-compose-monolith-dbinit-postgres.yml | 68 +++++++++++ .../docker-compose-monolith-postgres.yml | 0 ...nolith-with-simple-ui-dbinit-postgres.yml} | 0 ...mpose-monolith-with-simple-ui-postgres.yml | 32 +++++ .../hawkbit-repository-jpa-init/pom.xml | 3 +- .../{exec.xml => jar-with-dependencies.xml} | 1 + 29 files changed, 574 insertions(+), 11 deletions(-) rename docker/{docker_build => build}/Dockerfile (98%) create mode 100644 docker/build/Dockerfile_dbinit create mode 100644 docker/build/Dockerfile_dbinit_dev rename docker/{docker_build => build}/Dockerfile_dev (100%) rename docker/{docker_build => build}/KEY (100%) rename docker/{docker_build => build}/README.md (100%) rename docker/{docker_build => build}/build_dev.sh (86%) rename docker/{ => mysql}/docker-compose-deps-mysql.yml (96%) create mode 100644 docker/mysql/docker-compose-micro-services-dbinit-mysql.yml rename docker/{ => mysql}/docker-compose-micro-services-mysql.yml (100%) create mode 100644 docker/mysql/docker-compose-micro-services-with-simple-ui-dbinit-mysql.yml rename docker/{ => mysql}/docker-compose-micro-services-with-simple-ui-mysql.yml (100%) create mode 100644 docker/mysql/docker-compose-monolith-dbinit-mysql.yml rename docker/{ => mysql}/docker-compose-monolith-mysql.yml (100%) create mode 100644 docker/mysql/docker-compose-monolith-with-simple-ui-dbinit-mysql.yml rename docker/{ => mysql}/docker-compose-monolith-with-simple-ui-mysql.yml (100%) rename docker/{ => postgres}/docker-compose-deps-postgres.yml (96%) create mode 100644 docker/postgres/docker-compose-micro-services-dbinit-postgres.yml rename docker/{ => postgres}/docker-compose-micro-services-postgres.yml (100%) create mode 100644 docker/postgres/docker-compose-micro-services-with-simple-ui-dbinit-postgres.yml rename docker/{ => postgres}/docker-compose-micro-services-with-simple-ui-postgres.yml (100%) create mode 100644 docker/postgres/docker-compose-monolith-dbinit-postgres.yml rename docker/{ => postgres}/docker-compose-monolith-postgres.yml (100%) rename docker/{docker-compose-monolith-with-simple-ui-postgres.yml => postgres/docker-compose-monolith-with-simple-ui-dbinit-postgres.yml} (100%) create mode 100644 docker/postgres/docker-compose-monolith-with-simple-ui-postgres.yml rename hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/{exec.xml => jar-with-dependencies.xml} (96%) diff --git a/.gitignore b/.gitignore index ef6cbdf08..15d3de490 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # Directories # -build bin tmp .settings diff --git a/docker/README.md b/docker/README.md index 413c1c8e0..028cd49e0 100644 --- a/docker/README.md +++ b/docker/README.md @@ -14,17 +14,17 @@ $ docker run -d -p 8080:8080 hawkbit/hawkbit-update-server:latest Start the hawkBit Update Server together with an MySQL and RabbitMQ instance as containers (Requires Docker Compose to be installed) ```bash -$ docker compose -f docker-compose-monolith-mysql.yml up +$ docker compose -f mysql/docker-compose-monolith-mysql.yml up ``` You could, also start it in different flavours, with UI or in microservices mode. Note: Whit the upper command CTRL+C shuts down all services. Add '-d' at the end to start all into detached mode: ```bash -$ docker compose -f docker-compose-monolith-mysql.yml up -d +$ docker compose -f mysql/docker-compose-monolith-mysql.yml up -d ``` Then stop all services with: ```bash -$ docker compose -f docker-compose-monolith-mysql.yml down +$ docker compose -f mysql/docker-compose-monolith-mysql.yml down ``` # Access diff --git a/docker/docker_build/Dockerfile b/docker/build/Dockerfile similarity index 98% rename from docker/docker_build/Dockerfile rename to docker/build/Dockerfile index 59fc63c3a..9513dce5b 100644 --- a/docker/docker_build/Dockerfile +++ b/docker/build/Dockerfile @@ -23,7 +23,8 @@ RUN set -x &&\ mkdir -p ${BUILD_DIR} &&\ cd ${BUILD_DIR} &&\ java -Djarmode=tools -jar /${APP}.jar extract --layers --launcher --destination . &&\ - rm /${APP}.jar + rm /${APP}.jar &&\ + rm /${APP}.jar.asc FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine diff --git a/docker/build/Dockerfile_dbinit b/docker/build/Dockerfile_dbinit new file mode 100644 index 000000000..050e137c8 --- /dev/null +++ b/docker/build/Dockerfile_dbinit @@ -0,0 +1,45 @@ +# set Java +ARG JAVA_VERSION=21.0.6_7 +FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine as build + +ARG HAWKBIT_APP=hawkbit-repository-jpa-init +ARG HAWKBIT_VERSION=pass_as_buils_arg + +ENV APP=${HAWKBIT_APP} +ENV VERSION=${HAWKBIT_VERSION} + +COPY KEY . + +RUN set -x &&\ + apk add --no-cache --virtual build-dependencies gnupg unzip libressl wget &&\ + gpg --import KEY &&\ + wget -O ${APP}-${VERSION}.jar --no-verbose https://repo1.maven.org/maven2/org/eclipse/hawkbit/${APP}/${VERSION}/${APP}-${VERSION}.jar &&\ + wget -O ${APP}-${VERSION}.asc --no-verbose https://repo1.maven.org/maven2/org/eclipse/hawkbit/${APP}/${VERSION}/${APP}-${VERSION}.jar.asc &&\ + gpg --batch --verify ${APP}-${VERSION}.jar.asc ${APP}-${VERSION}.jar &&\ + rm /${APP}-${VERSION}.jar.asc /KEY &&\ + apk del build-dependencies + +FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine + +RUN addgroup -S hawkbit_group && adduser -D hawkbit -G hawkbit_group +USER hawkbit + +ENV BUILD_DIR=/opt/hawkbit_build +COPY --from=build /${APP}-${VERSION}.jar ./ + +ARG X_MS=256m +ENV X_MS=${X_MS} +ARG X_MX=256m +ENV X_MX=${X_MX} +ARG XX_MAX_METASPACE_SIZE=1150m +ENV XX_MAX_METASPACE_SIZE=${XX_MAX_METASPACE_SIZE} +ARG XX_METASPACE_SIZE=115m +ENV XX_METASPACE_SIZE=${XX_METASPACE_SIZE} +ARG XSS=150K +ENV XSS=${XSS} +ARG GC=G1 +ENV GC=${GC} +ARG AND_THEN="exit 0" +ENV AND_THEN=${AND_THEN} + +ENTRYPOINT ["sh", "-c", "java -classpath /${APP}-${VERSION}.jar ${JAVA_OPTS} -Xms${X_MS} -Xmx${X_MX} -XX:MaxMetaspaceSize=${XX_MAX_METASPACE_SIZE} -XX:MetaspaceSize=${XX_METASPACE_SIZE} -Xss${XSS} -XX:+Use${GC}GC -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError org.eclipse.hawkbit.repository.jpa.init.HawkbitFlywayDbInit ${@} && ${AND_THEN}"] diff --git a/docker/build/Dockerfile_dbinit_dev b/docker/build/Dockerfile_dbinit_dev new file mode 100644 index 000000000..aa1ec3b9a --- /dev/null +++ b/docker/build/Dockerfile_dbinit_dev @@ -0,0 +1,32 @@ +# set Java +ARG JAVA_VERSION=21.0.6_7 +FROM eclipse-temurin:${JAVA_VERSION}-jre-alpine as build + +ARG HAWKBIT_APP=hawkbit-repository-jpa-init +ARG HAWKBIT_VERSION=0-SNAPSHOT + +ENV APP=${HAWKBIT_APP} +ENV VERSION=${HAWKBIT_VERSION} + +RUN addgroup -S hawkbit_group && adduser -D hawkbit -G hawkbit_group +RUN mkdir -p /artifactrepo && chown -R hawkbit /artifactrepo +USER hawkbit + +COPY org/eclipse/hawkbit/${APP}/${VERSION}/${APP}-${VERSION}.jar /${APP}-${VERSION}.jar + +ARG X_MS=256m +ENV X_MS=${X_MS} +ARG X_MX=256m +ENV X_MX=${X_MX} +ARG XX_MAX_METASPACE_SIZE=1150m +ENV XX_MAX_METASPACE_SIZE=${XX_MAX_METASPACE_SIZE} +ARG XX_METASPACE_SIZE=115m +ENV XX_METASPACE_SIZE=${XX_METASPACE_SIZE} +ARG XSS=150K +ENV XSS=${XSS} +ARG GC=G1 +ENV GC=${GC} +ARG AND_THEN="exit 0" +ENV AND_THEN=${AND_THEN} + +ENTRYPOINT ["sh", "-c", "java -classpath /${APP}-${VERSION}.jar ${JAVA_OPTS} -Xms${X_MS} -Xmx${X_MX} -XX:MaxMetaspaceSize=${XX_MAX_METASPACE_SIZE} -XX:MetaspaceSize=${XX_METASPACE_SIZE} -Xss${XSS} -XX:+Use${GC}GC -XX:+UseStringDeduplication -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError org.eclipse.hawkbit.repository.jpa.init.HawkbitFlywayDbInit ${@} && ${AND_THEN}"] diff --git a/docker/docker_build/Dockerfile_dev b/docker/build/Dockerfile_dev similarity index 100% rename from docker/docker_build/Dockerfile_dev rename to docker/build/Dockerfile_dev diff --git a/docker/docker_build/KEY b/docker/build/KEY similarity index 100% rename from docker/docker_build/KEY rename to docker/build/KEY diff --git a/docker/docker_build/README.md b/docker/build/README.md similarity index 100% rename from docker/docker_build/README.md rename to docker/build/README.md diff --git a/docker/docker_build/build_dev.sh b/docker/build/build_dev.sh similarity index 86% rename from docker/docker_build/build_dev.sh rename to docker/build/build_dev.sh index 6d0d2935f..faa66dd43 100755 --- a/docker/docker_build/build_dev.sh +++ b/docker/build/build_dev.sh @@ -38,10 +38,14 @@ echo "hawkBit version : ${VERSION}" echo "maven repository : ${MVN_REPO}" echo "docker tag : ${TAG}" -DOCKER_FILE="Dockerfile_dev" -echo "docker file : ${DOCKER_FILE}" - function build() { + if [ "$1" == "hawkbit-repository-jpa-init" ]; then + DOCKER_FILE="Dockerfile_dbinit_dev" + else + DOCKER_FILE="Dockerfile_dev" + fi + echo "docker file : ${DOCKER_FILE}" + docker build -t hawkbit/$1:${TAG} --build-arg HAWKBIT_APP=$1 --build-arg HAWKBIT_VERSION=${VERSION} -f ${DOCKER_FILE} "${MVN_REPO}" } @@ -54,6 +58,8 @@ if [ -z "$1" ]; then build "hawkbit-simple-ui" # monolith build "hawkbit-update-server" + # db init + build "hawkbit-repository-jpa-init" else echo "Build $1" build $1 diff --git a/docker/docker-compose-deps-mysql.yml b/docker/mysql/docker-compose-deps-mysql.yml similarity index 96% rename from docker/docker-compose-deps-mysql.yml rename to docker/mysql/docker-compose-deps-mysql.yml index 6be6beef9..d85697562 100644 --- a/docker/docker-compose-deps-mysql.yml +++ b/docker/mysql/docker-compose-deps-mysql.yml @@ -33,7 +33,7 @@ services: # RabbitMQ service # --------------------- rabbitmq: - image: "rabbitmq:3-management-alpine" + image: "rabbitmq:4-management-alpine" hostname: "rabbitmq" environment: RABBITMQ_DEFAULT_VHOST: "/" diff --git a/docker/mysql/docker-compose-micro-services-dbinit-mysql.yml b/docker/mysql/docker-compose-micro-services-dbinit-mysql.yml new file mode 100644 index 000000000..6fd4f7e11 --- /dev/null +++ b/docker/mysql/docker-compose-micro-services-dbinit-mysql.yml @@ -0,0 +1,106 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3.7' + +include: + - docker-compose-deps-mysql.yml + +services: + + # --------------------- + # HawkBit DB Init + # --------------------- + hawkbit-db-init: + image: "hawkbit/hawkbit-repository-jpa-init:latest" + environment: + - 'HAWKBIT_DB_MODE=migrate' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'AND_THEN=sleep infinity' + restart: always + healthcheck: + test: ["CMD", "pgrep", "sleep"] + start_period: 30s + interval: 10s + retries: 5 + timeout: 60s + depends_on: + mysql: + condition: service_healthy + labels: + NAME: "hawkbit-db-init" + + # --------------------- + # HawkBit DDI + # --------------------- + hawkbit-ddi: + image: "hawkbit/hawkbit-ddi-server:latest" + environment: + - 'PROFILES=mysql' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + restart: always + ports: + - "8081:8081" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-ddi" + + # --------------------- + # HawkBit DMF + # --------------------- + hawkbit-dmf: + image: "hawkbit/hawkbit-dmf-server:latest" + environment: + - 'PROFILES=mysql' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + restart: always + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-dmf" + + # --------------------- + # HawkBit MGMT + # --------------------- + hawkbit-mgmt: + image: "hawkbit/hawkbit-mgmt-server:latest" + environment: + - 'PROFILES=mysql' + - 'SPRING_FLYWAY_ENABLED=false' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + volumes: + - artifactrepo:/artifactrepo + restart: always + ports: + - "8080:8080" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-mgmt" + +volumes: + artifactrepo: + driver: local diff --git a/docker/docker-compose-micro-services-mysql.yml b/docker/mysql/docker-compose-micro-services-mysql.yml similarity index 100% rename from docker/docker-compose-micro-services-mysql.yml rename to docker/mysql/docker-compose-micro-services-mysql.yml diff --git a/docker/mysql/docker-compose-micro-services-with-simple-ui-dbinit-mysql.yml b/docker/mysql/docker-compose-micro-services-with-simple-ui-dbinit-mysql.yml new file mode 100644 index 000000000..3f34658d7 --- /dev/null +++ b/docker/mysql/docker-compose-micro-services-with-simple-ui-dbinit-mysql.yml @@ -0,0 +1,32 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3.7' + +include: + - docker-compose-micro-services-dbinit-mysql.yml + +services: + + # --------------------- + # HawkBit Simple UI + # --------------------- + hawkbit-simple-ui: + image: "hawkbit/hawkbit-simple-ui:latest" + environment: + - 'SPRING_APPLICATION_JSON={"hawkbit.server.mgmtUrl": "http://hawkbit-mgmt:8080"}' + restart: always + ports: + - 8088:8088 + labels: + NAME: "hawkbit-simple-ui" + +volumes: + artifactrepo: + driver: local diff --git a/docker/docker-compose-micro-services-with-simple-ui-mysql.yml b/docker/mysql/docker-compose-micro-services-with-simple-ui-mysql.yml similarity index 100% rename from docker/docker-compose-micro-services-with-simple-ui-mysql.yml rename to docker/mysql/docker-compose-micro-services-with-simple-ui-mysql.yml diff --git a/docker/mysql/docker-compose-monolith-dbinit-mysql.yml b/docker/mysql/docker-compose-monolith-dbinit-mysql.yml new file mode 100644 index 000000000..f788acb46 --- /dev/null +++ b/docker/mysql/docker-compose-monolith-dbinit-mysql.yml @@ -0,0 +1,66 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3' + +include: + - docker-compose-deps-mysql.yml + +services: + + # --------------------- + # HawkBit DB Init + # --------------------- + hawkbit-db-init: + image: "hawkbit/hawkbit-repository-jpa-init:latest" + environment: + - 'HAWKBIT_DB_MODE=migrate' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'AND_THEN=sleep infinity' + restart: always + healthcheck: + test: ["CMD", "pgrep", "sleep"] + start_period: 30s + interval: 10s + retries: 5 + timeout: 60s + depends_on: + mysql: + condition: service_healthy + labels: + NAME: "hawkbit-db-init" + + # --------------------- + # HawkBit service + # --------------------- + hawkbit: + image: "hawkbit/hawkbit-update-server:latest" + environment: + - 'PROFILES=mysql' + - 'SPRING_FLYWAY_ENABLED=false' + - 'SPRING_DATASOURCE_URL=jdbc:mariadb://mysql:3306/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=root' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + volumes: + - artifactrepo:/artifactrepo + restart: always + ports: + - "8080:8080" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit" + +volumes: + artifactrepo: + driver: local \ No newline at end of file diff --git a/docker/docker-compose-monolith-mysql.yml b/docker/mysql/docker-compose-monolith-mysql.yml similarity index 100% rename from docker/docker-compose-monolith-mysql.yml rename to docker/mysql/docker-compose-monolith-mysql.yml diff --git a/docker/mysql/docker-compose-monolith-with-simple-ui-dbinit-mysql.yml b/docker/mysql/docker-compose-monolith-with-simple-ui-dbinit-mysql.yml new file mode 100644 index 000000000..7fe2db54b --- /dev/null +++ b/docker/mysql/docker-compose-monolith-with-simple-ui-dbinit-mysql.yml @@ -0,0 +1,32 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3' + +include: + - docker-compose-monolith-dbinit-mysql.yml + +services: + + # --------------------- + # HawkBit Simple UI service + # --------------------- + hawkbit-simple-ui: + image: "hawkbit/hawkbit-simple-ui:latest" + environment: + - 'SPRING_APPLICATION_JSON={"hawkbit.server.mgmtUrl": "http://hawkbit:8080"}' + restart: always + ports: + - 8088:8088 + labels: + NAME: "hawkbit-simple-ui" + +volumes: + artifactrepo: + driver: local diff --git a/docker/docker-compose-monolith-with-simple-ui-mysql.yml b/docker/mysql/docker-compose-monolith-with-simple-ui-mysql.yml similarity index 100% rename from docker/docker-compose-monolith-with-simple-ui-mysql.yml rename to docker/mysql/docker-compose-monolith-with-simple-ui-mysql.yml diff --git a/docker/docker-compose-deps-postgres.yml b/docker/postgres/docker-compose-deps-postgres.yml similarity index 96% rename from docker/docker-compose-deps-postgres.yml rename to docker/postgres/docker-compose-deps-postgres.yml index d83e30782..62975d149 100644 --- a/docker/docker-compose-deps-postgres.yml +++ b/docker/postgres/docker-compose-deps-postgres.yml @@ -33,7 +33,7 @@ services: # RabbitMQ service # --------------------- rabbitmq: - image: "rabbitmq:3-management-alpine" + image: "rabbitmq:4-management-alpine" hostname: "rabbitmq" environment: RABBITMQ_DEFAULT_VHOST: "/" diff --git a/docker/postgres/docker-compose-micro-services-dbinit-postgres.yml b/docker/postgres/docker-compose-micro-services-dbinit-postgres.yml new file mode 100644 index 000000000..a46b30ab0 --- /dev/null +++ b/docker/postgres/docker-compose-micro-services-dbinit-postgres.yml @@ -0,0 +1,110 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3.7' + +include: + - docker-compose-deps-postgres.yml + +services: + + # --------------------- + # HawkBit DB Init + # --------------------- + hawkbit-db-init: + image: "hawkbit/hawkbit-repository-jpa-init:latest" + environment: + - 'HAWKBIT_DB_MODE=migrate' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'AND_THEN=sleep infinity' + restart: always + healthcheck: + test: ["CMD", "pgrep", "sleep"] + start_period: 30s + interval: 10s + retries: 5 + timeout: 60s + depends_on: + postgress: + condition: service_healthy + labels: + NAME: "hawkbit-db-init" + + # --------------------- + # HawkBit DDI + # --------------------- + hawkbit-ddi: + image: "hawkbit/hawkbit-ddi-server:latest" + environment: + - 'PROFILES=postgresql' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + restart: always + ports: + - "8081:8081" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-ddi" + + # --------------------- + # HawkBit DMF + # --------------------- + hawkbit-dmf: + image: "hawkbit/hawkbit-dmf-server:latest" + environment: + - 'PROFILES=postgresql' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + restart: always + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-dmf" + + # --------------------- + # HawkBit MGMT + # --------------------- + hawkbit-mgmt: + image: "hawkbit/hawkbit-mgmt-server:latest" + environment: + - 'PROFILES=postgresql' + - 'SPRING_FLYWAY_ENABLED=false' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + volumes: + - artifactrepo:/artifactrepo + restart: always + ports: + - "8080:8080" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit-mgmt" + +volumes: + artifactrepo: + driver: local diff --git a/docker/docker-compose-micro-services-postgres.yml b/docker/postgres/docker-compose-micro-services-postgres.yml similarity index 100% rename from docker/docker-compose-micro-services-postgres.yml rename to docker/postgres/docker-compose-micro-services-postgres.yml diff --git a/docker/postgres/docker-compose-micro-services-with-simple-ui-dbinit-postgres.yml b/docker/postgres/docker-compose-micro-services-with-simple-ui-dbinit-postgres.yml new file mode 100644 index 000000000..d0ddbec7b --- /dev/null +++ b/docker/postgres/docker-compose-micro-services-with-simple-ui-dbinit-postgres.yml @@ -0,0 +1,32 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3.7' + +include: + - docker-compose-micro-services-dbinit-postgres.yml + +services: + + # --------------------- + # HawkBit Simple UI + # --------------------- + hawkbit-simple-ui: + image: "hawkbit/hawkbit-simple-ui:latest" + environment: + - 'SPRING_APPLICATION_JSON={"hawkbit.server.mgmtUrl": "http://hawkbit-mgmt:8080"}' + restart: always + ports: + - 8088:8088 + labels: + NAME: "hawkbit-simple-ui" + +volumes: + artifactrepo: + driver: local diff --git a/docker/docker-compose-micro-services-with-simple-ui-postgres.yml b/docker/postgres/docker-compose-micro-services-with-simple-ui-postgres.yml similarity index 100% rename from docker/docker-compose-micro-services-with-simple-ui-postgres.yml rename to docker/postgres/docker-compose-micro-services-with-simple-ui-postgres.yml diff --git a/docker/postgres/docker-compose-monolith-dbinit-postgres.yml b/docker/postgres/docker-compose-monolith-dbinit-postgres.yml new file mode 100644 index 000000000..02415b4e4 --- /dev/null +++ b/docker/postgres/docker-compose-monolith-dbinit-postgres.yml @@ -0,0 +1,68 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3' + +include: + - docker-compose-deps-postgres.yml + +services: + + # --------------------- + # HawkBit DB Init + # --------------------- + hawkbit-db-init: + image: "hawkbit/hawkbit-repository-jpa-init:latest" + environment: + - 'HAWKBIT_DB_MODE=migrate' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'AND_THEN=sleep infinity' + restart: always + healthcheck: + test: ["CMD", "pgrep", "sleep"] + start_period: 30s + interval: 10s + retries: 5 + timeout: 60s + depends_on: + postgress: + condition: service_healthy + labels: + NAME: "hawkbit-db-init" + + # --------------------- + # HawkBit service + # --------------------- + hawkbit: + image: "hawkbit/hawkbit-update-server:latest" + environment: + - 'PROFILES=postgresql' + - 'SPRING_FLYWAY_ENABLED=false' + - 'SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/hawkbit' + - 'SPRING_DATASOURCE_USERNAME=postgres' + - 'SPRING_DATASOURCE_PASSWORD=admin' + - 'SPRING_RABBITMQ_HOST=rabbitmq' + - 'SPRING_RABBITMQ_USERNAME=guest' + - 'SPRING_RABBITMQ_PASSWORD=guest' + volumes: + - artifactrepo:/artifactrepo + restart: always + ports: + - "8080:8080" + depends_on: + hawkbit-db-init: + condition: service_healthy + labels: + NAME: "hawkbit" + +volumes: + artifactrepo: + driver: local \ No newline at end of file diff --git a/docker/docker-compose-monolith-postgres.yml b/docker/postgres/docker-compose-monolith-postgres.yml similarity index 100% rename from docker/docker-compose-monolith-postgres.yml rename to docker/postgres/docker-compose-monolith-postgres.yml diff --git a/docker/docker-compose-monolith-with-simple-ui-postgres.yml b/docker/postgres/docker-compose-monolith-with-simple-ui-dbinit-postgres.yml similarity index 100% rename from docker/docker-compose-monolith-with-simple-ui-postgres.yml rename to docker/postgres/docker-compose-monolith-with-simple-ui-dbinit-postgres.yml diff --git a/docker/postgres/docker-compose-monolith-with-simple-ui-postgres.yml b/docker/postgres/docker-compose-monolith-with-simple-ui-postgres.yml new file mode 100644 index 000000000..e3b4ae4f6 --- /dev/null +++ b/docker/postgres/docker-compose-monolith-with-simple-ui-postgres.yml @@ -0,0 +1,32 @@ +# +# Copyright (c) 2018 Bosch Software Innovations GmbH and others +# +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# +version: '3' + +include: + - docker-compose-monolith-dbinit-postgres.yml + +services: + + # --------------------- + # HawkBit Simple UI service + # --------------------- + hawkbit-simple-ui: + image: "hawkbit/hawkbit-simple-ui:latest" + environment: + - 'SPRING_APPLICATION_JSON={"hawkbit.server.mgmtUrl": "http://hawkbit:8080"}' + restart: always + ports: + - 8088:8088 + labels: + NAME: "hawkbit-simple-ui" + +volumes: + artifactrepo: + driver: local diff --git a/hawkbit-repository/hawkbit-repository-jpa-init/pom.xml b/hawkbit-repository/hawkbit-repository-jpa-init/pom.xml index 8c2776f5d..9fe79f2f7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-init/pom.xml +++ b/hawkbit-repository/hawkbit-repository-jpa-init/pom.xml @@ -118,7 +118,8 @@ - src/assembly/exec.xml + + src/assembly/jar-with-dependencies.xml false diff --git a/hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/exec.xml b/hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/jar-with-dependencies.xml similarity index 96% rename from hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/exec.xml rename to hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/jar-with-dependencies.xml index df672630a..9253ee4e7 100644 --- a/hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/exec.xml +++ b/hawkbit-repository/hawkbit-repository-jpa-init/src/assembly/jar-with-dependencies.xml @@ -19,6 +19,7 @@ false + metaInf-services