Update the project readme's getting started (#2810)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
49
README.md
49
README.md
@@ -83,11 +83,11 @@ There are clients outside of the Eclipse IoT eco system as well, e.g.:
|
|||||||
## SQL database
|
## SQL database
|
||||||
|
|
||||||
| Database | H2 | MySQL/MariaDB | PostgreSQL |
|
| Database | H2 | MySQL/MariaDB | PostgreSQL |
|
||||||
|-----------------------------------|:----------------------------------------------:|:---------------------------------------------------------------------:|:--------------------------------------------------------:|
|
|-----------------------------------|:----------------------------------------------:|:---------------------------------------------------------------------:|:----------------------------------------------------------:|
|
||||||
| DDLs maintained by project | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
| 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: |
|
| 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: |
|
| 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)|
|
| 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 |
|
| Status | Test, Dev | Production grade | Test, Dev |
|
||||||
|
|
||||||
## (Optional) RabbitMQ: 3.6,3.7,3.8
|
## (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
|
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
|
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.
|
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
|
# Clone, build and run hawkBit
|
||||||
|
|
||||||
## Build and start hawkBit [Update Server](hawkbit-monolith/hawkbit-update-server)
|
## Clone and build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/eclipse-hawkbit/hawkbit.git
|
git clone https://github.com/eclipse-hawkbit/hawkbit.git
|
||||||
cd hawkbit
|
cd hawkbit
|
||||||
mvn clean install
|
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
|
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
|
```bash
|
||||||
git clone https://github.com/eclipse-hawkbit/hawkbit-examples.git
|
java -jar ./hawkbit-ui/target/hawkbit-ui.jar
|
||||||
cd hawkbit-examples
|
|
||||||
mvn clean install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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
|
```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)
|
## Generate getting started data with the [Management API example](https://github.com/eclipse-hawkbit/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ public class HawkbitClient {
|
|||||||
new DefaultHttpRequestRetryStrategy(
|
new DefaultHttpRequestRetryStrategy(
|
||||||
Integer.getInteger("hawkbit.sdk.http.maxRetry", 3),
|
Integer.getInteger("hawkbit.sdk.http.maxRetry", 3),
|
||||||
TimeValue.ofSeconds(Integer.getInteger("hawkbit.sdk.http.defaultRetryIntervalSec", 10)));
|
TimeValue.ofSeconds(Integer.getInteger("hawkbit.sdk.http.defaultRetryIntervalSec", 10)));
|
||||||
|
private static final int BUFFER_SIZE = 8096;
|
||||||
|
|
||||||
private final HawkbitServer hawkBitServer;
|
private final HawkbitServer hawkBitServer;
|
||||||
|
|
||||||
@@ -131,10 +132,8 @@ public class HawkbitClient {
|
|||||||
private final BiFunction<Tenant, Controller, RequestInterceptor> requestInterceptorFn;
|
private final BiFunction<Tenant, Controller, RequestInterceptor> requestInterceptorFn;
|
||||||
|
|
||||||
private final HttpRequestRetryStrategy httpRequestRetryStrategy;
|
private final HttpRequestRetryStrategy httpRequestRetryStrategy;
|
||||||
private final int BUFFER_SIZE = 8096;
|
|
||||||
|
|
||||||
public HawkbitClient(
|
public HawkbitClient(final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
|
||||||
final HawkbitServer hawkBitServer, final Encoder encoder, final Decoder decoder, final Contract contract) {
|
|
||||||
this(hawkBitServer, encoder, decoder, contract, null, null);
|
this(hawkBitServer, encoder, decoder, contract, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +225,7 @@ public class HawkbitClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final Cleaner CLEANER = Cleaner.create();
|
private static final Cleaner CLEANER = Cleaner.create();
|
||||||
|
|
||||||
private <T> T service0(final Class<T> serviceType, final Tenant tenant, final Controller controller) {
|
private <T> T service0(final Class<T> serviceType, final Tenant tenant, final Controller controller) {
|
||||||
final String url = controller == null ? hawkBitServer.getMgmtUrl() : hawkBitServer.getDdiUrl();
|
final String url = controller == null ? hawkBitServer.getMgmtUrl() : hawkBitServer.getDdiUrl();
|
||||||
final HttpClientKey key = new HttpClientKey(
|
final HttpClientKey key = new HttpClientKey(
|
||||||
@@ -364,6 +364,7 @@ public class HawkbitClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final String CRLF = "\r\n";
|
private static final String CRLF = "\r\n";
|
||||||
|
|
||||||
private void writeMultipartFile(
|
private void writeMultipartFile(
|
||||||
final MultipartFile multipartFile, final OutputStream out, final String boundary, final Annotation[] parametersAnnotations)
|
final MultipartFile multipartFile, final OutputStream out, final String boundary, final Annotation[] parametersAnnotations)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
@@ -382,6 +383,7 @@ public class HawkbitClient {
|
|||||||
out.write(CRLF.getBytes(StandardCharsets.UTF_8));
|
out.write(CRLF.getBytes(StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeSimpleFormData(
|
private void writeSimpleFormData(
|
||||||
final Object arg, final OutputStream out, final String boundary, final Annotation[] parameterAnnotations) throws IOException {
|
final Object arg, final OutputStream out, final String boundary, final Annotation[] parameterAnnotations) throws IOException {
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
@@ -406,13 +408,16 @@ public class HawkbitClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final String KEYSTORE_PASSWORD;
|
private static final String KEYSTORE_PASSWORD;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final Random random = new SecureRandom();
|
final Random random = new SecureRandom();
|
||||||
final byte[] bytes = new byte[16];
|
final byte[] bytes = new byte[16];
|
||||||
random.nextBytes(bytes);
|
random.nextBytes(bytes);
|
||||||
KEYSTORE_PASSWORD = Base64.getEncoder().encodeToString(bytes);
|
KEYSTORE_PASSWORD = Base64.getEncoder().encodeToString(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Map<HttpClientKey, HttpClientWrapper> HTTP_CLIENTS = new HashMap<>();
|
private static final Map<HttpClientKey, HttpClientWrapper> HTTP_CLIENTS = new HashMap<>();
|
||||||
|
|
||||||
private static HttpClient httpClient(final HttpClientKey key) {
|
private static HttpClient httpClient(final HttpClientKey key) {
|
||||||
synchronized (HTTP_CLIENTS) {
|
synchronized (HTTP_CLIENTS) {
|
||||||
final HttpClientWrapper httpClientWrapper = HTTP_CLIENTS.get(key);
|
final HttpClientWrapper httpClientWrapper = HTTP_CLIENTS.get(key);
|
||||||
|
|||||||
@@ -70,6 +70,9 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>org.eclipse.hawkbit.sdk.demo.device.DeviceApp</mainClass>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import org.eclipse.hawkbit.sdk.device.DdiController;
|
|||||||
import org.eclipse.hawkbit.sdk.device.DdiTenant;
|
import org.eclipse.hawkbit.sdk.device.DdiTenant;
|
||||||
import org.eclipse.hawkbit.sdk.device.UpdateHandler;
|
import org.eclipse.hawkbit.sdk.device.UpdateHandler;
|
||||||
import org.eclipse.hawkbit.sdk.mgmt.AuthenticationSetupHelper;
|
import org.eclipse.hawkbit.sdk.mgmt.AuthenticationSetupHelper;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@@ -66,11 +67,11 @@ public class DeviceApp {
|
|||||||
private final AuthenticationSetupHelper mgmtApi;
|
private final AuthenticationSetupHelper mgmtApi;
|
||||||
|
|
||||||
@SuppressWarnings("java:S3358")
|
@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.ddiTenant = ddiTenant;
|
||||||
this.mgmtApi = mgmtApi;
|
this.mgmtApi = mgmtApi;
|
||||||
final String controllerId = System.getProperty("demo.controller.id");
|
|
||||||
final String securityToken = System.getProperty("demo.controller.securityToken");
|
|
||||||
|
|
||||||
this.device = this.ddiTenant.createController(
|
this.device = this.ddiTenant.createController(
|
||||||
Controller.builder()
|
Controller.builder()
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
spring.main.web-application-type=none
|
spring.main.web-application-type=none
|
||||||
|
spring.shell.interactive.enabled=true
|
||||||
|
|
||||||
logging.level.org.eclipse.hawkbit=DEBUG
|
logging.level.org.eclipse.hawkbit=DEBUG
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skip>false</skip>
|
<skip>false</skip>
|
||||||
<finalName>hawkBit-UI</finalName>
|
<finalName>hawkbit-ui</finalName>
|
||||||
<mainClass>org.eclipse.hawkbit.ui.HawkbitUiApp</mainClass>
|
<mainClass>org.eclipse.hawkbit.ui.HawkbitUiApp</mainClass>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ vaadin.launch-browser=true
|
|||||||
# To improve the performance during development.
|
# To improve the performance during development.
|
||||||
# For more information https://vaadin.com/docs/flow/spring/tutorial-spring-configuration.html#special-configuration-parameters
|
# 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
|
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
|
server.servlet.session.persistent=false
|
||||||
### Vaadin end ###
|
### Vaadin end ###
|
||||||
Reference in New Issue
Block a user