Code format hawkbit (#1948)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -4,7 +4,9 @@ parent: Guides
|
||||
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).
|
||||
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).
|
||||
<!--more-->
|
||||
|
||||
## Big picture
|
||||
@@ -13,8 +15,13 @@ hawkBit is able to run in a cluster with some constraints. This guide provides i
|
||||
|
||||
## Events
|
||||
|
||||
Event communication between nodes is based on [Spring Cloud Bus](https://cloud.spring.io/spring-cloud-bus/) and [Spring Cloud Stream](http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/). There are different [binder implementations](http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/#_binders) available. The _hawkbit Update Server_ uses RabbitMQ binder. Every node gets his own queue to receive cluster events, the default payload is JSON.
|
||||
If an event is thrown locally at one node, it will be automatically delivered to all other available nodes via the Spring Cloud Bus's topic exchange:
|
||||
Event communication between nodes is based on [Spring Cloud Bus](https://cloud.spring.io/spring-cloud-bus/)
|
||||
and [Spring Cloud Stream](http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/). There are
|
||||
different [binder implementations](http://docs.spring.io/spring-cloud-stream/docs/current/reference/htmlsingle/#_binders)
|
||||
available. The _hawkbit Update Server_ uses RabbitMQ binder. Every node gets his own queue to receive cluster events,
|
||||
the default payload is JSON.
|
||||
If an event is thrown locally at one node, it will be automatically delivered to all other available nodes via the
|
||||
Spring Cloud Bus's topic exchange:
|
||||
|
||||

|
||||
|
||||
@@ -23,16 +30,25 @@ Via the ServiceMatcher you can check whether an event happened locally at one no
|
||||
|
||||
## Caching
|
||||
|
||||
Every node is maintaining its own caches independent from other nodes. So there is no globally shared/synchronized cache instance within the cluster. In order to keep nodes in sync a TTL (time to live) can be set for all caches to ensure that after some time the cache is refreshed from the database. To enable the TTL just set the property "hawkbit.cache.global.ttl" (value in milliseconds). Of course you can implement a shared cache, e.g. Redis.
|
||||
Every node is maintaining its own caches independent from other nodes. So there is no globally shared/synchronized cache
|
||||
instance within the cluster. In order to keep nodes in sync a TTL (time to live) can be set for all caches to ensure
|
||||
that after some time the cache is refreshed from the database. To enable the TTL just set the property "
|
||||
hawkbit.cache.global.ttl" (value in milliseconds). Of course you can implement a shared cache, e.g. Redis.
|
||||
See [CacheAutoConfiguration](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/cache/CacheAutoConfiguration.java)
|
||||
|
||||
## Schedulers
|
||||
|
||||
Every node has multiple schedulers which run after a defined period of time. All schedulers always run on every node. This has to be kept in mind e.g. if the scheduler executes critical code which has to be executed only once.
|
||||
Every node has multiple schedulers which run after a defined period of time. All schedulers always run on every node.
|
||||
This has to be kept in mind e.g. if the scheduler executes critical code which has to be executed only once.
|
||||
|
||||
## Known constraints
|
||||
|
||||
### Denial-of-Service (DoS) filter
|
||||
hawkBit owns the feature of guarding itself from DoS attacks, a [DoS filter](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-http-security/src/main/java/org/eclipse/hawkbit/security/DosFilter.java). It reduces the maximum number of requests per seconds which can be configured for read and write requests.
|
||||
This mechanism is only working for every node separately, i.e. in a cluster environment the worst-case behaviour would be that the maximum number of requests per seconds will be increased to its product if every request is handled by a different node.
|
||||
|
||||
hawkBit owns the feature of guarding itself from DoS attacks,
|
||||
a [DoS filter](https://github.com/eclipse-hawkbit/hawkbit/blob/master/hawkbit-http-security/src/main/java/org/eclipse/hawkbit/security/DosFilter.java).
|
||||
It reduces the maximum number of requests per seconds which can be configured for read and write requests.
|
||||
This mechanism is only working for every node separately, i.e. in a cluster environment the worst-case behaviour would
|
||||
be that the maximum number of requests per seconds will be increased to its product if every request is handled by a
|
||||
different node.
|
||||
The same constraint exists with the validator to check if a user tried too many logins within a defined period of time.
|
||||
|
||||
@@ -4,18 +4,31 @@ parent: Guides
|
||||
weight: 32
|
||||
---
|
||||
|
||||
In this guide we describe how to create a [Feign](https://github.com/Netflix/feign) Rest Client based on a [Spring Boot](http://projects.spring.io/spring-boot/) Application.
|
||||
In this guide we describe how to create a [Feign](https://github.com/Netflix/feign) Rest Client based on
|
||||
a [Spring Boot](http://projects.spring.io/spring-boot/) Application.
|
||||
<!--more-->
|
||||
|
||||
## Create Feign REST Client
|
||||
hawkBit provides REST interfaces for [Management API](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-ddi-api) and [DDI API](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-ddi-api). Using this interfaces you can create a feign client with the help of the [feign inheritance support](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).
|
||||
Our [example](https://github.com/eclipse-hawkbit/hawkbit-examples) modules demonstrate how to create [Feign](https://github.com/Netflix/feign) client resources. Here you can find the [Management API client resources](hhttps://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-feign-client) and the [DDI client resources](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-ddi-feign-client).
|
||||
A small [simulator application](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) demonstrates how you can interact with the hawkBit via the [Management API
|
||||
](http://www.eclipse.org/hawkbit/documentation/interfaces/management-api.html).
|
||||
|
||||
hawkBit provides REST interfaces
|
||||
for [Management API](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-ddi-api)
|
||||
and [DDI API](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkbit-ddi-api). Using this interfaces you can
|
||||
create a feign client with the help of
|
||||
the [feign inheritance support](http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance).
|
||||
Our [example](https://github.com/eclipse-hawkbit/hawkbit-examples) modules demonstrate how to
|
||||
create [Feign](https://github.com/Netflix/feign) client resources. Here you can find
|
||||
the [Management API client resources](hhttps://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-feign-client)
|
||||
and
|
||||
the [DDI client resources](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-ddi-feign-client).
|
||||
A
|
||||
small [simulator application](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator)
|
||||
demonstrates how you can interact with the hawkBit via the [Management API
|
||||
](http://www.eclipse.org/hawkbit/documentation/interfaces/management-api.html).
|
||||
|
||||
## Example Management API simulator
|
||||
|
||||
In the follow code section, you can a see a feign client resource example. The interface extend the origin api interface to declare the `@FeignClient`. The `@FeignClient`declares that a REST client with that interface should be created.
|
||||
In the follow code section, you can a see a feign client resource example. The interface extend the origin api interface
|
||||
to declare the `@FeignClient`. The `@FeignClient`declares that a REST client with that interface should be created.
|
||||
|
||||
```Java
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
||||
@@ -40,7 +53,8 @@ public class CreateStartedRolloutExample {
|
||||
|
||||
```
|
||||
|
||||
At [hawkbit-example-core-feign-client](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-core-feign-client) is a spring configuration to auto configure some beans, which can be reused for a own feign client.
|
||||
At [hawkbit-example-core-feign-client](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-core-feign-client)
|
||||
is a spring configuration to auto configure some beans, which can be reused for a own feign client.
|
||||
|
||||
```Java
|
||||
@Configuration
|
||||
|
||||
@@ -4,12 +4,14 @@ parent: Guides
|
||||
weight: 31
|
||||
---
|
||||
|
||||
In this guide we describe how to run a full featured hawkBit setup based on a production ready infrastructure. It is based on the hawkBit example modules and update server.
|
||||
In this guide we describe how to run a full featured hawkBit setup based on a production ready infrastructure. It is
|
||||
based on the hawkBit example modules and update server.
|
||||
|
||||
<!--more-->
|
||||
|
||||
{{% note %}}
|
||||
The update server can in fact be run stand alone. However, only with an embedded H2, no Device Management Federation API and no artifact storage.
|
||||
The update server can in fact be run stand alone. However, only with an embedded H2, no Device Management Federation API
|
||||
and no artifact storage.
|
||||
{{% /note %}}
|
||||
|
||||
## System Architecture
|
||||
@@ -30,7 +32,8 @@ This guide describes a target architecture that is more like one that you will e
|
||||
|
||||
## Adapt hawkBit Update Server and Device Simulator to your environment.
|
||||
|
||||
As mentioned you can create your own application with hawkBit inside or adapt the existing example app. The second option will be shown here.
|
||||
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)
|
||||
|
||||
@@ -44,7 +47,8 @@ As mentioned you can create your own application with hawkBit inside or adapt th
|
||||
|
||||
### Configure MariaDB/MySQL connection settings.
|
||||
|
||||
For this you can either edit the existing _application.properties_ or create a [new profile](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-profile-specific-properties).
|
||||
For this you can either edit the existing _application.properties_ or create
|
||||
a [new profile](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-profile-specific-properties).
|
||||
|
||||
```properties
|
||||
spring.jpa.database=MYSQL
|
||||
@@ -54,12 +58,15 @@ spring.datasource.password=YOUR_PWD
|
||||
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
|
||||
```
|
||||
|
||||
Note: On Ubuntu 18.04 with MariaDB 10.1 installed from the default repository via apt install _COLLATE option_ of database have to be changed manually to "latin1".
|
||||
For recent versions of MariaDB running on Ubuntu this is not required (cf. [system variables](https://mariadb.com/kb/en/differences-in-mariadb-in-debian-and-ubuntu), [issue](https://github.com/eclipse-hawkbit/hawkbit/issues/963))
|
||||
Note: On Ubuntu 18.04 with MariaDB 10.1 installed from the default repository via apt install _COLLATE option_ of
|
||||
database have to be changed manually to "latin1".
|
||||
For recent versions of MariaDB running on Ubuntu this is not required (
|
||||
cf. [system variables](https://mariadb.com/kb/en/differences-in-mariadb-in-debian-and-ubuntu), [issue](https://github.com/eclipse-hawkbit/hawkbit/issues/963))
|
||||
|
||||
### Configure RabbitMQ connection settings for update server and device simulator (optional).
|
||||
|
||||
We provide already defaults that should work with a standard Rabbit installation. Otherwise configure the following in the `application.properties` of the two services:
|
||||
We provide already defaults that should work with a standard Rabbit installation. Otherwise configure the following in
|
||||
the `application.properties` of the two services:
|
||||
|
||||
```properties
|
||||
spring.rabbitmq.username=guest
|
||||
@@ -93,9 +100,11 @@ see [update server](https://github.com/eclipse-hawkbit/hawkbit/tree/master/hawkb
|
||||
|
||||
### Compile & Run example scenario [creation script](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional)
|
||||
|
||||
This has to be done before the device simulator is started. hawkBit creates the mandatory tenant metadata with first login into either Management API (which is done by this client).
|
||||
This has to be done before the device simulator is started. hawkBit creates the mandatory tenant metadata with first
|
||||
login into either Management API (which is done by this client).
|
||||
|
||||
However, this is not done by _DMF_ which is in fact used by the device simulator, i.e. without calling _Management API_ first hawkBit would drop all _DMF_ messages as the tenant is unknown.
|
||||
However, this is not done by _DMF_ which is in fact used by the device simulator, i.e. without calling _Management API_
|
||||
first hawkBit would drop all _DMF_ messages as the tenant is unknown.
|
||||
|
||||
### Compile & Run device simulator (optional)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user