From ebcb6a0b29741858385fa6807bc7fbffb9a203b2 Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Wed, 27 Nov 2024 08:14:52 +0200 Subject: [PATCH] [#1700] Remove sandbox (#2105) Signed-off-by: Avgustin Marinov --- .github/workflows/trivy-scan.yml | 2 +- README.md | 8 +-- hawkbit-ddi/hawkbit-ddi-server/README.md | 2 +- hawkbit-dmf/hawkbit-dmf-server/README.md | 2 +- hawkbit-mgmt/hawkbit-mgmt-server/README.md | 2 +- .../hawkbit-update-server/README.md | 2 +- hawkbit-runtime/.sandbox/README.md | 55 -------------- .../.sandbox/scripts/initialize-cronjobs.sh | 29 -------- .../.sandbox/scripts/sandbox-cleanup.sh | 52 -------------- .../stacks/proxy/docker-compose-stack.yml | 61 ---------------- .../stacks/sandbox/docker-compose-stack.yml | 72 ------------------- site/content/gettingstarted.md | 2 +- site/content/guides/clustering.md | 2 +- site/content/guides/runhawkbit.md | 6 +- 14 files changed, 14 insertions(+), 283 deletions(-) delete mode 100644 hawkbit-runtime/.sandbox/README.md delete mode 100644 hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh delete mode 100644 hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh delete mode 100644 hawkbit-runtime/.sandbox/stacks/proxy/docker-compose-stack.yml delete mode 100644 hawkbit-runtime/.sandbox/stacks/sandbox/docker-compose-stack.yml diff --git a/.github/workflows/trivy-scan.yml b/.github/workflows/trivy-scan.yml index 58050a11f0..db6e015bed 100644 --- a/.github/workflows/trivy-scan.yml +++ b/.github/workflows/trivy-scan.yml @@ -30,7 +30,7 @@ jobs: - name: Create hawkBit container images run: | mvn clean install -DskipTests && \ - cd hawkbit-runtime/docker/docker_build && \ + cd docker/docker_build && \ chmod +x build_all_dev.sh && \ ./build_all_dev.sh && \ cd ../../.. diff --git a/README.md b/README.md index 83fd6b7985..0b7054911c 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ There are clients outside of the Eclipse IoT eco system as well, e.g.: # Getting Started We are providing a [Spring Boot](https://projects.spring.io/spring-boot/) based -reference [Update Server](hawkbit-runtime/hawkbit-update-server) including embedded H2 DB for test and evaluation +reference [Update Server](hawkbit-monolith/hawkbit-update-server) including embedded H2 DB for test and evaluation purposes. Run with docker: @@ -128,19 +128,19 @@ at [guide](https://www.eclipse.org/hawkbit/guides/runhawkbit/) -> _Configure Rab # hawkBit (Spring boot) starters -Next to the [Update Server](hawkbit-runtime/hawkbit-update-server) we are also providing a set +Next to the [Update Server](hawkbit-monolith/hawkbit-update-server) we are also providing a set of [Spring Boot Starters](hawkbit-starters) to quick start your own [Spring Boot](https://projects.spring.io/spring-boot/) based application. # Clone, build and run hawkBit -## Build and start hawkBit [Update Server](hawkbit-runtime/hawkbit-update-server) +## Build and start hawkBit [Update Server](hawkbit-monolith/hawkbit-update-server) ```bash git clone https://github.com/eclipse-hawkbit/hawkbit.git cd hawkbit mvn clean install -java -jar ./hawkbit-runtime/hawkbit-update-server/target/hawkbit-update-server-#version#.jar +java -jar ./hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-0-SNAPSHOT.jar ``` ## Start hawkBit [Device Simulator](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-device-simulator) (optional) diff --git a/hawkbit-ddi/hawkbit-ddi-server/README.md b/hawkbit-ddi/hawkbit-ddi-server/README.md index c38c068039..0d230c15a9 100644 --- a/hawkbit-ddi/hawkbit-ddi-server/README.md +++ b/hawkbit-ddi/hawkbit-ddi-server/README.md @@ -8,7 +8,7 @@ with at least hawkbit-mgmt-server. ### Run ```bash -java -jar hawkbit-runtime/hawkbit-ddi-server/target/hawkbit-ddi-server-*-SNAPSHOT.jar +java -jar hawkbit-ddi/hawkbit-ddi-server/target/hawkbit-ddi-server-0-SNAPSHOT.jar ``` _(Note: you have to add the JDBC driver also to your class path if you intend to use another database than H2.)_ diff --git a/hawkbit-dmf/hawkbit-dmf-server/README.md b/hawkbit-dmf/hawkbit-dmf-server/README.md index 4a46e08555..9d721f5ed7 100644 --- a/hawkbit-dmf/hawkbit-dmf-server/README.md +++ b/hawkbit-dmf/hawkbit-dmf-server/README.md @@ -6,7 +6,7 @@ with at least hawkbit-mgmt-server. ### Run ```bash -java -jar hawkbit-runtime/hawkbit-dmf-server/target/hawkbit-dmf-server-*-SNAPSHOT.jar +java -jar hawkbit-dmf/hawkbit-dmf-server/target/hawkbit-dmf-server-0-SNAPSHOT.jar ``` _(Note: you have to add the JDBC driver also to your class path if you intend to use another database than H2.)_ diff --git a/hawkbit-mgmt/hawkbit-mgmt-server/README.md b/hawkbit-mgmt/hawkbit-mgmt-server/README.md index 22eb77151d..c3994a9961 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-server/README.md +++ b/hawkbit-mgmt/hawkbit-mgmt-server/README.md @@ -8,7 +8,7 @@ started with at least one (or both) of the device interface servers - hawkbit-dd ### Run ```bash -java -jar hawkbit-runtime/hawkbit-mgmt-server/target/hawkbit-mgmt-server-*-SNAPSHOT.jar +java -jar hawkbit-mgmt/hawkbit-mgmt-server/target/hawkbit-mgmt-server-0-SNAPSHOT.jar ``` _(Note: you have to add the JDBC driver also to your class path if you intend to use another database than H2.)_ diff --git a/hawkbit-monolith/hawkbit-update-server/README.md b/hawkbit-monolith/hawkbit-update-server/README.md index a40ed8fca2..cf174f5c55 100644 --- a/hawkbit-monolith/hawkbit-update-server/README.md +++ b/hawkbit-monolith/hawkbit-update-server/README.md @@ -7,7 +7,7 @@ The hawkBit Update Server (Monolith) is a standalone spring-boot application wit ### Run ```bash -java -jar hawkbit-runtime/hawkbit-update-server/target/hawkbit-update-server-*-SNAPSHOT.jar +java -jar hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-*-SNAPSHOT.jar ``` _(Note: you have to add the JDBC driver also to your class path if you intend to use another database than H2.)_ diff --git a/hawkbit-runtime/.sandbox/README.md b/hawkbit-runtime/.sandbox/README.md deleted file mode 100644 index ae2a275798..0000000000 --- a/hawkbit-runtime/.sandbox/README.md +++ /dev/null @@ -1,55 +0,0 @@ -hawkBit Sandbox -=== - -## Try out the update server in our hawkBit sandbox - -- try out Management API https://hawkbit.eclipseprojects.io/rest/v1/targets (don't forget basic auth header; username: - demo, passwd: demo) -- try out DDI API https://hawkbit.eclipseprojects.io/DEFAULT/controller/v1/MYTESTDEVICE - -## Sandbox Setup - -**1. File Structure** - -Copy the files to the respective location on the VM. - -``` -/ -+.sandbox - | - +-stacks - | +-sandbox - | | +-docker-compose-stack.yml - | +-proxy - | +-docker-compose-stack.yml - +- scripts - +-intialize-cronjobs.sh - +-sandbox-cleanup.sh -``` - -**2. Initialize Cronjobs** - -Reset the Sandbox once a week with a cron-job and log its output. - -``` -$ sudo /.sandbox/scripts/initialize-cronjobs.sh -``` - -**3. Nginx Reverse Proxy** - -Start the stack for the Nginx reverse proxy with Let's Encrypt support. Thanks to JrCs for providing the Docker -container -and instructions with -his [Docker-Letsencrypt-Nginx-Companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion). - -``` -$ docker stack deploy -c /.sandbox/stacks/sandbox/docker-compose-stack.yml proxy -``` - -**4. hawkBit** - -Start the hawkBit stack. - -``` -$ docker stack deploy -c /.sandbox/stacks/sandbox/docker-compose-stack.yml hawkbit -``` \ No newline at end of file diff --git a/hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh b/hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh deleted file mode 100644 index c231a7dd26..0000000000 --- a/hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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 -# - -SCRIPT_DIR="/.sandbox/scripts" -LOGFILE_DIR="/.sandbox/logs" - -# m h dom mon dow user command -SANDBOX_CLEANUP_JOB="0 0 * * 7 root ${SCRIPT_DIR}/sandbox-cleanup.sh >> ${LOGFILE_DIR}/\$(date +\%F)-hawkbit 2>&1" -LOGFILE_CLEANUP_JOB="0 0 1 * * root find ${LOGFILE_DIR}* -mtime +182 -exec rm {} \; >/dev/null 2>&1" - -CRONTAB_FILE="/etc/crontab" - - -# Create directory for log files -mkdir -p ${LOGFILE_DIR} - - -echo "# Reset hawkBit stack once a week to delete all data" >> "${CRONTAB_FILE}" -echo "${SANDBOX_CLEANUP_JOB}" >> "${CRONTAB_FILE}" - -echo "# Remove log files documenting reset, that are older than 6 months" >> "${CRONTAB_FILE}" -echo "${LOGFILE_CLEANUP_JOB}" >> "${CRONTAB_FILE}" \ No newline at end of file diff --git a/hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh b/hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh deleted file mode 100644 index 53781bb8d1..0000000000 --- a/hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh +++ /dev/null @@ -1,52 +0,0 @@ -# -# 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 -# - -STACK_NAME=hawkbit - -echo "/------------------------------------------------------------------------------" -echo "| Data Clean Up START: $(date -u) " -echo "+------------------------------------------------------------------------------" -echo "|" -echo "+-- Remove Docker Stack:" -docker stack rm $STACK_NAME -sleep 15 -echo "|" -echo "+-- Remove Docker Container:" -docker container prune --force -sleep 5 -echo "|" -echo "+-- Remove Docker Volumes:" -docker volume prune --force -echo "|" -echo "+-- Verify Docker Container:" -docker container ls --all -echo "|" -echo "+-- Verify Docker Volumes:" -docker volume ls -echo "|" -echo "+-- Restart Docker Stack:" -docker stack deploy -c /.sandbox/stacks/sandbox/docker-compose-stack.yml $STACK_NAME -echo "|" -# Value is based on trial and error -echo "+-- Wait for hawkBit to start (160s):" -sleep 160 -echo "|" -# Device Simulator has to be restarted, since hawkBit takes too long to start -echo "+-- Restart Device Simulator:" -docker service update --force hawkbit_simulator -echo "|" -# Images used by a container are not deleted. Therefore, we run this after the stacks -# are started. Only unused images will be deleted. -echo "+-- Clean up Docker:" -docker system prune --force -echo "+------------------------------------------------------------------------------" -echo "| END: $(date -u) " -echo "\------------------------------------------------------------------------------" -echo "" diff --git a/hawkbit-runtime/.sandbox/stacks/proxy/docker-compose-stack.yml b/hawkbit-runtime/.sandbox/stacks/proxy/docker-compose-stack.yml deleted file mode 100644 index e6796c4133..0000000000 --- a/hawkbit-runtime/.sandbox/stacks/proxy/docker-compose-stack.yml +++ /dev/null @@ -1,61 +0,0 @@ -# -# 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' - -volumes: - vhost: - challange: - certificates: - -networks: - proxy: - driver: overlay - -services: - - # --------------------- - # nginx reverse proxy - # --------------------- - nginx: - image: "jwilder/nginx-proxy" - ports: - - 80:80 - - 443:443 - networks: - - proxy - volumes: - - certificates:/etc/nginx/certs:ro - - vhost:/etc/nginx/vhost.d - - challange:/usr/share/nginx/html - - /var/run/docker.sock:/tmp/docker.sock:ro - deploy: - replicas: 1 - restart_policy: - condition: on-failure - labels: - - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy" - - # --------------------- - # lets encrypt nginx-proxy companion - # --------------------- - letsencrypt: - image: "jrcs/letsencrypt-nginx-proxy-companion" - networks: - - proxy - volumes: - - certificates:/etc/nginx/certs:rw - - /var/run/docker.sock:/var/run/docker.sock:ro - - vhost:/etc/nginx/vhost.d - - challange:/usr/share/nginx/html - deploy: - replicas: 1 - restart_policy: - condition: on-failure diff --git a/hawkbit-runtime/.sandbox/stacks/sandbox/docker-compose-stack.yml b/hawkbit-runtime/.sandbox/stacks/sandbox/docker-compose-stack.yml deleted file mode 100644 index 296831078b..0000000000 --- a/hawkbit-runtime/.sandbox/stacks/sandbox/docker-compose-stack.yml +++ /dev/null @@ -1,72 +0,0 @@ -# -# 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' - -volumes: - vhost: - challange: - -networks: - proxy_proxy: - external: true - sandbox: - driver: overlay - -services: - - # --------------------- - # hawkBit service - # --------------------- - hawkbit: - image: "hawkbit/hawkbit-update-server:latest" - networks: - - proxy_proxy - - sandbox - deploy: - restart_policy: - condition: on-failure - environment: - - 'SPRING_PROFILES_ACTIVE=cloudsandbox' - - 'SPRING_RABBITMQ_HOST=rabbitmq' - - 'SPRING_RABBITMQ_USERNAME=guest' - - 'SPRING_RABBITMQ_PASSWORD=guest' - - 'VIRTUAL_HOST=hawkbit.eclipseprojects.io' - - 'LETSENCRYPT_HOST=hawkbit.eclipseprojects.io' - - # --------------------- - # hawkBit simulator - # --------------------- - simulator: - image: "hawkbit/hawkbit-device-simulator:latest" - networks: - - sandbox - deploy: - restart_policy: - condition: on-failure - environment: - - 'SPRING_RABBITMQ_VIRTUALHOST=/' - - 'SPRING_RABBITMQ_HOST=rabbitmq' - - 'SPRING_RABBITMQ_PORT=5672' - - 'SPRING_RABBITMQ_USERNAME=guest' - - 'SPRING_RABBITMQ_PASSWORD=guest' - - # --------------------- - # RabbitMQ service - # --------------------- - rabbitmq: - image: "rabbitmq:3-management" - networks: - - sandbox - deploy: - restart_policy: - condition: on-failure - environment: - RABBITMQ_DEFAULT_VHOST: "/" diff --git a/site/content/gettingstarted.md b/site/content/gettingstarted.md index b1d8034e32..89f9587a9f 100755 --- a/site/content/gettingstarted.md +++ b/site/content/gettingstarted.md @@ -93,7 +93,7 @@ $ cd hawkbit $ mvn clean install -DskipTests ``` -### 2: Start hawkBit [update server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-runtime/hawkbit-update-server) (Monolith) +### 2: Start hawkBit [update server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-monolith/hawkbit-update-server) (Monolith) ```sh $ java -jar ./hawkbit-monolith/hawkbit-update-server/target/hawkbit-update-server-0-SNAPSHOT.jar diff --git a/site/content/guides/clustering.md b/site/content/guides/clustering.md index 548a9916df..0294a8a40b 100644 --- a/site/content/guides/clustering.md +++ b/site/content/guides/clustering.md @@ -6,7 +6,7 @@ weight: 33 hawkBit is able to run in a cluster with some constraints. This guide provides insights in the basic concepts and how to setup your own cluster. You can find additional information in -the [hawkBit runtimes's README](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-runtime/hawkbit-update-server/README.md). +the [hawkBit runtimes's README](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-monolith/hawkbit-update-server/README.md). ## Big picture diff --git a/site/content/guides/runhawkbit.md b/site/content/guides/runhawkbit.md index 70e5b897a4..6187aca2b6 100644 --- a/site/content/guides/runhawkbit.md +++ b/site/content/guides/runhawkbit.md @@ -18,7 +18,7 @@ and no artifact storage. This guide describes a target architecture that is more like one that you will expect in a production system. -- hawkBit [Update Server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-runtime/hawkbit-update-server). +- hawkBit [Update Server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-monolith/hawkbit-update-server). - [MariaDB](https://mariadb.org) for the repository. - [RabbitMQ](https://www.rabbitmq.com) for DMF communication. - For testing and demonstration purposes we will also use: @@ -35,7 +35,7 @@ This guide describes a target architecture that is more like one that you will e As mentioned you can create your own application with hawkBit inside or adapt the existing example app. The second option will be shown here. -### Set MariaDB dependency to compile in the [update server POM](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-runtime/hawkbit-update-server/pom.xml) +### Set MariaDB dependency to compile in the [update server POM](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-monolith/hawkbit-update-server/pom.xml) ```xml @@ -96,7 +96,7 @@ hawkbit-example-mgmt-simulator-##VERSION##.jar --hawkbit.url=YOUR_HOST:PORT ### Compile & Run your _"production ready"_ app -see [update server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-runtime/hawkbit-update-server) +see [update server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-monolith/hawkbit-update-server) ### Compile & Run example scenario [creation script](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional)