Feature/docker dbinit (#2371)

* Standalone tool for initializing of hawkBit Database

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

* Add docker build for dbinit

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-04-24 16:40:55 +03:00
committed by GitHub
parent 323738bda9
commit d2a41d1bff
29 changed files with 574 additions and 11 deletions

View File

@@ -0,0 +1,48 @@
#
# 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'
services:
# ---------------------
# Postgres service
# ---------------------
postgres:
image: "postgres:16.5"
ports:
- "5432:5432"
deploy:
restart_policy:
condition: on-failure
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "admin"
POSTGRES_DB: "hawkbit"
healthcheck:
test: ["CMD-SHELL", "pg_isready -d ${POSTGRES_DB} -U ${POSTGRES_USER}"]
interval: 20s
retries: 10
# ---------------------
# RabbitMQ service
# ---------------------
rabbitmq:
image: "rabbitmq:4-management-alpine"
hostname: "rabbitmq"
environment:
RABBITMQ_DEFAULT_VHOST: "/"
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
ports:
- "15672:15672"
- "5672:5672"
deploy:
restart_policy:
condition: on-failure

View File

@@ -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

View File

@@ -0,0 +1,85 @@
#
# 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 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:
postgres:
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:
postgres:
condition: service_healthy
labels:
NAME: "hawkbit-dmf"
# ---------------------
# HawkBit MGMT
# ---------------------
hawkbit-mgmt:
image: "hawkbit/hawkbit-mgmt-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'
volumes:
- artifactrepo:/artifactrepo
restart: always
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
labels:
NAME: "hawkbit-mgmt"
volumes:
artifactrepo:
driver: local

View File

@@ -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

View File

@@ -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-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

View File

@@ -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

View File

@@ -0,0 +1,43 @@
#
# 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 service
# ---------------------
hawkbit:
image: "hawkbit/hawkbit-update-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'
volumes:
- artifactrepo:/artifactrepo
restart: always
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
labels:
NAME: "hawkbit"
volumes:
artifactrepo:
driver: local

View File

@@ -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-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

View File

@@ -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