Update the project readme's getting started (#2810)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-11-17 12:45:02 +02:00
committed by GitHub
parent bcf62f39e7
commit cb3aa4b0ff
7 changed files with 60 additions and 23 deletions

View File

@@ -82,13 +82,13 @@ There are clients outside of the Eclipse IoT eco system as well, e.g.:
## SQL database
| Database | H2 | MySQL/MariaDB | PostgreSQL |
|-----------------------------------|:----------------------------------------------:|:---------------------------------------------------------------------:|:--------------------------------------------------------:|
| DDLs maintained by project | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Test dependencies defined | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Docker image with driver provided | :white_check_mark: | :white_check_mark: (Tag: "-mysql") | :white_check_mark: |
| JDBC driver | [H2](https://github.com/h2database/h2database) | [MariaDB Connector/J](https://github.com/MariaDB/mariadb-connector-j) |[PostgreSQL JDBC Driver](https://github.com/pgjdbc/pgjdbc)|
| Status | Test, Dev | Production grade | Test, Dev |
| Database | H2 | MySQL/MariaDB | PostgreSQL |
|-----------------------------------|:----------------------------------------------:|:---------------------------------------------------------------------:|:----------------------------------------------------------:|
| DDLs maintained by project | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Test dependencies defined | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Docker image with driver provided | :white_check_mark: | :white_check_mark | :white_check_mark: |
| JDBC driver | [H2](https://github.com/h2database/h2database) | [MariaDB Connector/J](https://github.com/MariaDB/mariadb-connector-j) | [PostgreSQL JDBC Driver](https://github.com/pgjdbc/pgjdbc) |
| Status | Test, Dev | Production grade | Test, Dev |
## (Optional) RabbitMQ: 3.6,3.7,3.8
@@ -103,9 +103,9 @@ Run with docker:
docker run -d -p 8080:8080 hawkbit/hawkbit-update-server
```
Open the update server in your browser:
The monolith update server will start on port 8080 with default configuration and H2 database. The default user `admin:admin` is configured.
[localhost:8080](http://localhost:8080)
The Swagger UI is available at: [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html)
See below for how to build and run the update server on your own. In addition we have
a [guide](https://www.eclipse.org/hawkbit/guides/runhawkbit/) for setting up a complete landscape.
@@ -122,27 +122,54 @@ own [Spring Boot](https://projects.spring.io/spring-boot/) based application.
# Clone, build and run hawkBit
## Build and start hawkBit [Update Server](hawkbit-monolith/hawkbit-update-server)
## Clone and build
```bash
git clone https://github.com/eclipse-hawkbit/hawkbit.git
cd hawkbit
mvn clean install
```
## Start hawkBit [Update Server](hawkbit-monolith/hawkbit-update-server)
```bash
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)
The monolith update server will start on port 8080 with default configuration and H2 database. The default user `admin:admin` is configured.
The Swagger UI is available at: [http://localhost:8080/swagger-ui/index.html](http://localhost:8080/swagger-ui/index.html)
## Start hawkBit [UI](hawkbit-ui)
```bash
git clone https://github.com/eclipse-hawkbit/hawkbit-examples.git
cd hawkbit-examples
mvn clean install
java -jar ./hawkbit-ui/target/hawkbit-ui.jar
```
Log in to [hawkbit UI](http://localhost:8088) with default `admin:admin` user.
## Start hawkBit [Device Simulator](hawkbit-sdk/hawkbit-sdk-demo)
* Enable gateway token authentication - on update server set tenant configuration properties (via [Swagger UI](http://localhost:8080/swagger-ui/index.html) or [hawkBit
UI](http://localhost:8088)):
* `authentication.gatewaytoken.enabled=true` and
* `authentication.gatewaytoken.key=<gw_token>`)
* Start demo Device Simulator - in the script below edit the environment properties accordingly.
* DDI url `http://localhost:8080` is default URL when running monolith update server.
* Set `hawkbit_tenant_gatewaytoken` to the configured gateway token (`authentication.gatewaytoken.key`))
* Then run:
```bash
java -jar ./hawkbit-device-simulator/target/hawkbit-device-simulator-#version#.jar
export hawkbit_server_ddiurl=http://localhost:8080
export demo_controller_id=demo
export hawkbit_tenant_gatewaytoken=gw_token
java -jar ./hawkbit-sdk/hawkbit-sdk-demo/target/hawkbit-sdk-demo-0-SNAPSHOT.jar
```
* Execute `start` command in the simulator console to start the device simulation.
* Your device will be registered automatically on the update server and will start polling for updates.
## Generate getting started data with the [Management API example](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional)
```bash

View File

@@ -120,6 +120,7 @@ public class HawkbitClient {
new DefaultHttpRequestRetryStrategy(
Integer.getInteger("hawkbit.sdk.http.maxRetry", 3),
TimeValue.ofSeconds(Integer.getInteger("hawkbit.sdk.http.defaultRetryIntervalSec", 10)));
private static final int BUFFER_SIZE = 8096;
private final HawkbitServer hawkBitServer;
@@ -131,10 +132,8 @@ public class HawkbitClient {
private final BiFunction<Tenant, Controller, RequestInterceptor> requestInterceptorFn;
private final HttpRequestRetryStrategy httpRequestRetryStrategy;
private final int BUFFER_SIZE = 8096;
public HawkbitClient(
final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
public HawkbitClient(final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
this(hawkBitServer, encoder, decoder, contract, null, null);
}
@@ -226,6 +225,7 @@ public class HawkbitClient {
}
private static final Cleaner CLEANER = Cleaner.create();
private <T> T service0(final Class<T> serviceType, final Tenant tenant, final Controller controller) {
final String url = controller == null ? hawkBitServer.getMgmtUrl() : hawkBitServer.getDdiUrl();
final HttpClientKey key = new HttpClientKey(
@@ -364,6 +364,7 @@ public class HawkbitClient {
}
private static final String CRLF = "\r\n";
private void writeMultipartFile(
final MultipartFile multipartFile, final OutputStream out, final String boundary, final Annotation[] parametersAnnotations)
throws IOException {
@@ -382,6 +383,7 @@ public class HawkbitClient {
out.write(CRLF.getBytes(StandardCharsets.UTF_8));
}
}
private void writeSimpleFormData(
final Object arg, final OutputStream out, final String boundary, final Annotation[] parameterAnnotations) throws IOException {
if (arg != null) {
@@ -406,13 +408,16 @@ public class HawkbitClient {
}
private static final String KEYSTORE_PASSWORD;
static {
final Random random = new SecureRandom();
final byte[] bytes = new byte[16];
random.nextBytes(bytes);
KEYSTORE_PASSWORD = Base64.getEncoder().encodeToString(bytes);
}
private static final Map<HttpClientKey, HttpClientWrapper> HTTP_CLIENTS = new HashMap<>();
private static HttpClient httpClient(final HttpClientKey key) {
synchronized (HTTP_CLIENTS) {
final HttpClientWrapper httpClientWrapper = HTTP_CLIENTS.get(key);

View File

@@ -70,6 +70,9 @@
</configuration>
</execution>
</executions>
<configuration>
<mainClass>org.eclipse.hawkbit.sdk.demo.device.DeviceApp</mainClass>
</configuration>
</plugin>
</plugins>

View File

@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.sdk.device.DdiController;
import org.eclipse.hawkbit.sdk.device.DdiTenant;
import org.eclipse.hawkbit.sdk.device.UpdateHandler;
import org.eclipse.hawkbit.sdk.mgmt.AuthenticationSetupHelper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@@ -66,11 +67,11 @@ public class DeviceApp {
private final AuthenticationSetupHelper mgmtApi;
@SuppressWarnings("java:S3358")
Shell(final DdiTenant ddiTenant, final AuthenticationSetupHelper mgmtApi, final Optional<UpdateHandler> updateHandler) {
Shell(final DdiTenant ddiTenant, final AuthenticationSetupHelper mgmtApi, final Optional<UpdateHandler> updateHandler,
@Value("${demo.controller.id:demo}") final String controllerId,
@Value("${demo.controller.securityToken:#{null}") final String securityToken) {
this.ddiTenant = ddiTenant;
this.mgmtApi = mgmtApi;
final String controllerId = System.getProperty("demo.controller.id");
final String securityToken = System.getProperty("demo.controller.securityToken");
this.device = this.ddiTenant.createController(
Controller.builder()

View File

@@ -9,6 +9,7 @@
#
spring.main.web-application-type=none
spring.shell.interactive.enabled=true
logging.level.org.eclipse.hawkbit=DEBUG

View File

@@ -101,7 +101,7 @@
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>false</skip>
<finalName>hawkBit-UI</finalName>
<finalName>hawkbit-ui</finalName>
<mainClass>org.eclipse.hawkbit.ui.HawkbitUiApp</mainClass>
</configuration>
</plugin>

View File

@@ -27,6 +27,6 @@ vaadin.launch-browser=true
# To improve the performance during development.
# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters
vaadin.allowed-packages=com.vaadin,org.vaadin,dev.hilla,org.eclipse.hawkbit
spring.application.name=hawkBit-UI
spring.application.name=hawkbit-ui
server.servlet.session.persistent=false
### Vaadin end ###