Add new sandbox (#741)
* Add new sandbox files and remove temporary unavailable notice * remove old deployment script * adapt application properties * restructure hawkbit-runtime * move sandbox description. * adapt license checks * Introduce review findings and add new docker files * Remove redundant profile and attribute * Update website * redirect to sandbox * getting started * Add description for docker folder and renew favicon
This commit is contained in:
55
hawkbit-runtime/.sandbox/README.md
Normal file
55
hawkbit-runtime/.sandbox/README.md
Normal file
@@ -0,0 +1,55 @@
|
||||
hawkBit Sandbox
|
||||
===
|
||||
|
||||
## Try out the update server in our hawkBit sandbox
|
||||
|
||||
- try out Management UI https://hawkbit.eclipse.org (username: demo, passwd: demo)
|
||||
- try out Management API https://hawkbit.eclipse.org/rest/v1/targets (don't forget basic auth header; username: demo, passwd: demo)
|
||||
- try out DDI API https://hawkbit.eclipse.org/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
|
||||
```
|
||||
28
hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh
Normal file
28
hawkbit-runtime/.sandbox/scripts/initialize-cronjobs.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright (c) 2018 Bosch Software Innovations GmbH and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
SCRIPT_DIR="/.sandbox/scripts"
|
||||
LOGFILE_DIR="/.sandbox/logs"
|
||||
|
||||
# m h dom mon dow user command
|
||||
SANDBOX_CLEANUP_JOB="0 0 * * 0 root ${SCRIPT_DIR}/sandbox-cleanup.sh >> ${LOGFILE_DIR}/\$(date +\%F)-hawkbit 2>&1"
|
||||
LOGFILE_CLEANUP_JOB="0 0 0 * * 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}"
|
||||
51
hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh
Normal file
51
hawkbit-runtime/.sandbox/scripts/sandbox-cleanup.sh
Normal file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (c) 2018 Bosch Software Innovations GmbH and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
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 (320s):"
|
||||
sleep 320
|
||||
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 ""
|
||||
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# Copyright (c) 2018 Bosch Software Innovations GmbH and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
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
|
||||
@@ -0,0 +1,76 @@
|
||||
#
|
||||
# Copyright (c) 2018 Bosch Software Innovations GmbH and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
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.eclipse.org'
|
||||
- 'LETSENCRYPT_HOST=hawkbit.eclipse.org'
|
||||
|
||||
# ---------------------
|
||||
# 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'
|
||||
- 'SPRING_RABBITMQ_SSL_ENABLED=false'
|
||||
- 'HAWKBIT_DEVICES_SIMULATOR_AMQP_RECEIVERCONNECTORQUEUEFROMSP=sp_direct_queue'
|
||||
- 'HAWKBIT_DEVICES_SIMULATOR_AMQP_SENDERFORSPEXCHANGE=sp.direct.exchange'
|
||||
- 'HAWKBIT_DEVICES_SIMULATOR_AMQP_DEADLETTERQUEUE=sp_direct_queue_deadletter_ttl'
|
||||
- 'HAWKBIT_DEVICES_SIMULATOR_AMQP_DEADLETTEREXCHANGE=sp.direct.exchange.deadletter'
|
||||
|
||||
# ---------------------
|
||||
# RabbitMQ service
|
||||
# ---------------------
|
||||
rabbitmq:
|
||||
image: "rabbitmq:3-management"
|
||||
networks:
|
||||
- sandbox
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_VHOST: "/"
|
||||
Reference in New Issue
Block a user