Skip to main content

Hawkbit

Properties

# Error Code : 42001
spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;DATABASE_TO_LOWER=TRUE

## DDI, DMF API dowload links not configured for HTTPS
## Configuration for building download URLs - START
hawkbit.artifact.url.protocols.download-http.rel=download-http
hawkbit.artifact.url.protocols.download-http.protocol=https
hawkbit.artifact.url.protocols.download-http.supports=DMF,DDI
hawkbit.artifact.url.protocols.download-http.hostname=demo.com
hawkbit.artifact.url.protocols.download-http.ref={protocol}://{hostname}/{tenant}/controller/v1/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{artifactFileName}
hawkbit.artifact.url.protocols.md5sum-http.rel=md5sum-http
hawkbit.artifact.url.protocols.md5sum-http.protocol=${hawkbit.artifact.url.protocols.download-http.protocol}
hawkbit.artifact.url.protocols.md5sum-http.supports=DDI
hawkbit.artifact.url.protocols.md5sum-http.hostname=${hawkbit.artifact.url.protocols.download-http.hostname}
hawkbit.artifact.url.protocols.md5sum-http.ref=${hawkbit.artifact.url.protocols.download-http.ref}.MD5SUM
## Configuration for building download URLs - END

spring.security.user and hawkbit.server.im.users cannot be used at the same time.

hawkbit.server.ui.demo.user only pre-fills the login form; it has nothing to do with the actual account.

The latest version, using h2, hits:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.13.v20230724-7ffb888abf): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "identity" not found; SQL statement:
CALL IDENTITY() [90022-222]
Error Code: 90022
Call: CALL IDENTITY()
Query: ValueReadQuery(name="SEQ_GEN_IDENTITY" sql="CALL IDENTITY()")

This is because IDENTITY() was removed; use this instead:

spring.datasource.url=jdbc:h2:mem:testdb;MODE=LEGACY;DATABASE_TO_LOWER=TRUE

Build

0.3.0+Windows 11

git checkout 0.3.0
mvn -T 16 clean install

0.3.0 M8+ubuntu 22.04

sudo apt install git maven
git checkout 0.3.0M8
mvn -T 4 clean install

# RolloutManagementTest failur, compile again.

Old

# Hugo must be v0.59.1
# pom of docs must add hack to support windows
# asciidoctor-maven-plugin must be v.1.5.7.1 support JAVA 17

mvn clean install
mvn install

mvn install -DskipTests
mvn install -Dmaven.test.skip=true

# Debug
/hawkbit-rest/hawkbit-rest-docs
mvn package -DskipTests

/hawkbit-rest/hawkbit-rest-docs
mvn prepare-package

Copy hawkbit-rest-docs/target/classes/rest-api/*
to docs/content/rest-api
replace /hawkbit/apis/ /doc/bitdove/apis/
replace keyword hawkbit to Bitdove

Dev Tools

Eclipse Marketplace

  • LiClipseText - Support SCSS

Run

java -jar /root/service/app/bitdove/hawkbit-update-server-0.3.0-SNAPSHOT.jar --spring.config.name=application,application-postgresql --spring.config.location=/root/service/config/bitdove/ --spring.profiles.active=prod

java -jar .\hawkbit-runtime\hawkbit-update-server\target\hawkbit-update-server-0.3.0-SNAPSHOT.jar --hawkbit.dmf.rabbitmq.enabled=false

# Simulator
java -jar hawkbit-device-simulator-0.3.0-SNAPSHOT.jar --hawkbit.device.simulator.amqp.enabled=false

Nginx reverse proxy

The particularity of nginx+Vaadin is WEBSOCKET and LONG_POLLING.

nginx.conf
http:{
map $http_upgrade $connection_upgrade {
default Upgrade;
'' close;
}

server {
server_name domain.com;

location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_ignore_client_abort off;
proxy_read_timeout 84600s; # 1 day
proxy_send_timeout 84600s; # 1 day
add_header 'Content-Security-Policy' 'upgrade-insecure-requests';
#break;
}

listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
}

location ~
{
return 301 https://$host$request_uri;
}

Debug

Eclipse - Spring Boot App

Projaect: hawkbit-update-server

Debug Configuration: Spring Boot App

Program arguments:

#
# Windows
#

${env_var:CONFIG_PATH}

--spring.profiles.active=dev,h2-dev
--spring.config.name=application
--spring.config.location="C:/my/build/service/bitdove/config/"
--spring.config.additional-location="C:/my/build/service/bitdove/config/"

Eclipse - Maven Build

Goals:

#
# Windows
#

spring-boot:run -Dmaven.surefire.debug -Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8080 -Dspring-boot.run.arguments=" --spring.profiles.active=dev --spring.config.name=application --spring.config.location=\"C:\\my\\build\\service\\config\\bitdove\\\" --spring.config.additional-location=\"C:\\my\\build\\service\\config\\bitdove\\\" "

Operation

ps -fe | grep hawkbit | grep -v grep | awk '{print $2}' | xargs kill

account

spring.security.oauth2.client.registration.oidc.client-id=clientID
spring.security.oauth2.client.registration.oidc.client-secret=oidc-client-secret
spring.security.oauth2.client.provider.oidc.issuer-uri=https://oidc-provider/issuer-uri
spring.security.oauth2.client.provider.oidc.authorization-uri=https://oidc-provider/authorization-uri
spring.security.oauth2.client.provider.oidc.token-uri=https://oidc-provider/token-uri
spring.security.oauth2.client.provider.oidc.user-info-uri=https://oidc-provider/user-info-uri
spring.security.oauth2.client.provider.oidc.jwk-set-uri=https://oidc-provider/jwk-set-uri

simulator

http://localhost:8083/start?amount=5&name=ddi&api=ddi&gatewaytoken=d5F2mmlARiMuMOquRmLlxW4xZFHy4mEV&polldelay=10&endpoint=http://localhost:8080

Performance Test

bin\runjava com.rabbitmq.perf.PerfTestMulti publish-consume-spec.js publish-consume-result.js

java -jar perf-test-latest.jar -uri amqp://vmubu2204:5672 -z 30

Name

ds == Distribution Set

Source Code

sass/scss

vaadin-sass-compiler ?

Only project-name [boot] can make IDE intelligence work correctly.

Change Block Order of Item in System Configuration

SystemConfigViewAutoConfiguration.java

@Order(value = 1)

Don't duplicate. Must full restart app.

System Configuration

table: sp_tenant_configuration

value will +1 when conf_value modified.

column: optlock_revision

value: 1

column: tenant

data: DEFAULT

column: conf_key

data: rollout.approval.enabled

column: conf_value

data: true

Default config data

/hawkbit-repository-core/src/main/resources/hawkbit-repository-defaults.properties

"System Configuration" default key and value.

Architecture

UploadArtifactView > ArtifactDetailsGridLayout > ArtifactDetailsGrid

/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/details/ArtifactDetailsGrid.java

/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/modelJpaDistributionSetType.java

@Table name = "sp_distribution_set_type"

account

String DEFAULT_TENANT

userDetailsService

InMemoryUserManagementAutoConfiguration

@Bean
@ConditionalOnMissingBean
MultitenancyIndicator multiTenancyIndicator() {
return () -> false;
}

@FunctionalInterface
public interface MultitenancyIndicator {

/**
* @return {@code true} if multi-tenancy is supported, otherwise
* {@code false}.
*/
boolean isMultiTenancySupported();

}

tooltip.documentation.link

Database

Initial

schema_version

flyway version

Other tables are all null.

theme

# Only for compile, fast but did not copy fille to right folder
mvn vaadin:compile-theme

# Rebuild scss
cd hawkbit-ui
mvn process-classes

Auto compile scss with builder

  1. Rightclick on your project > Properties > Builders.
  2. Click New, choose Programm and give it a cool name
  3. "Main" Tab
    • Location: Choose the shell script here
    • Working Directory: I choosed the project folder
  4. "Refresh" Tab
    • Refresh resources upon completion
    • Specific resources
    • Click on "Specify Resources..."
    • Check the resources that you want to be refreshed after the compilation, typically the css files
    • Recursively include sub-folders depends on you and your project
  5. "Build Options"
    • [ ] Allocate Console (uncheck, we want it silent, turn it on for debugging)
    • Launch in Background
    • Run the Builder
      • [ ] After a "clean"
      • During manual builds
      • During auto builds
      • [ ] During a "clean"
    • Specify working set of relevant resources
    • Click "Specify Resources..."
    • Choose the resources you want to compile, typically your .scss files. A Note, don't select the folder with css files here, that gets refreshed after the build, anyway your eclipse might get catched in a never-ending-loop here. So .less files will be enough.
// Login button
.login-button {
border-color: $white-hex-color;
height: 38px;
}

Doc

Hugo

Site config: config.toml

cookie accept: layouts > partials > head.html

Don't use another function in with function.

Multi Tenant

Fragmentary support. Not work. BOSCH remove crucial code.

tenant:
users:
- name: ${USER:admin}
password: ${PASSWORD:admin}
tenant: DEFAULT
grants:
- ALL
- name: ${USER1:user1}
password: ${USER1_PASSWORD:somepassword}
tenant: DEFAULT
grants:
- READ_TARGET
- UPDATE_TARGET
- READ_REPOSITORY
- UPDATE_REPOSITORY
- CREATE_REPOSITORY
- DELETE_REPOSITORY
- name: ${EXT_USER:user2}
password: ${EXT_PASSWORD:somepassword}
tenant: EXTERNAL
grants:
- CREATE_TARGET
- READ_TARGET
- READ_TARGET_SEC_TOKEN
- UPDATE_TARGET
- DELETE_TARGET
- READ_REPOSITORY
- UPDATE_REPOSITORY
- CREATE_REPOSITORY
- DELETE_REPOSITORY

Mod Code (not completed)

hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/InMemoryUserManagementAutoConfiguration.java
hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/MultiUserProperties.java
hawkbit-autoconfigure/src/main/java/org/eclipse/hawkbit/autoconfigure/security/SecurityAutoConfiguration.java
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/security/InMemoryUserAuthoritiesResolver.java
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/login/AbstractHawkbitLoginUI.java
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/menu/DashboardMenu.java

Permissions

"READ_TARGETS",
"UPDATE_TARGETS",
"CREATE_TARGETS",
"DELETE_TARGETS",
"READ_REPOSITORY",
"UPDATE_REPOSITORY",
"CREATE_REPOSITORY",
"DELETE_REPOSITORY",
"READ_TARGET_SECURITY_TOKEN",
"DOWNLOAD_REPOSITORY_ARTIFACT",
"TENANT_CONFIGURATION",
"READ_ROLLOUT",
"UPDATE_ROLLOUT",
"CREATE_ROLLOUT",
"DELETE_ROLLOUT",
"HANDLE_ROLLOUT",
"APPROVE_ROLLOUT"

Demo Mode

hawkbit.server.ui.demo.tenant=DEFAULT
hawkbit.server.ui.demo.user=demo
hawkbit.server.ui.demo.password=12341234
hawkbit.server.ui.demo.disclaimer=This demo site will reset data periodically.

Trouble Shooting

410 GONE

"status": {
"result": {
"finished": "success"

This action finishes the deployment action workflow and pushes the action into state "Finished". Further feedback requests are rejected with "HTTP/1.1 410 GONE".

FlywayValidateException: Validate failed: Migrations have failed validation

Example:

-> Applied to database : -870345472 -> Resolved locally : 1072780543

Modfiy flyway_schema_historychecksum

Change all checksum to Resolved locally checksum.

Known Issue

Set default value have bug. Can not set default value is enable in the database directly.

0.3.0M9

MariaDB

Cannot load driver class: org.mariadb.jdbc.Driver

Use PostgreSQL.