I'm trying to set up hawkBit update server as per https://www.eclipse.org/hawkbit/gettingstarted/ but a lot of issues that I do not know how to resolve. The following is summary setup steps:
- Prerequisites
sudo apt install -y default-jre default-jdk
java -version
*openjdk version "11.0.9.1" 2020-11-04*
*OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04)*
*OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)*
sudo apt install maven
sudo apt-get -y install mariadb-server
- Download build source code
git clone https://github.com/eclipse/hawkbit.git
cd hawkbit
mvn clean install
*Start hawkBit update server*
*Access http://localhost:8080/UI/login to check*
java -jar ./hawkbit-runtime/hawkbit-update-server/target/hawkbit-update-server-0.3.0-SNAPSHOT.jar
- Customize hawkBit 3.1. Set up data base
sudo mysql -u root
*Welcome to the MariaDB monitor. Commands end with ; or \g.*
*Your MariaDB connection id is 31*
*Server version: 10.1.47-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04*
*Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.*
*Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.*
MariaDB [(none)]> USE mysql;
*Reading table information for completion of table and column names*
*You can turn off this feature to get a quicker startup with -A*
*Database changed*
MariaDB [mysql]> CREATE USER 'test'@'localhost' IDENTIFIED BY '123456a@';
*Query OK, 0 rows affected (0.00 sec)*
*MariaDB [mysql]> UPDATE user SET authentication_string=password('123456a@') where user='test';*
*Query OK, 0 rows affected (0.00 sec)*
*Rows matched: 1 Changed: 0 Warnings: 0*
MariaDB [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost';
*Query OK, 0 rows affected (0.00 sec)*
MariaDB [mysql]> UPDATE user SET plugin='mysql_native_password' WHERE User='test';
*Query OK, 1 row affected (0.01 sec)*
*Rows matched: 1 Changed: 1 Warnings: 0*
MariaDB [mysql]> FLUSH PRIVILEGES;
*Query OK, 0 rows affected (0.00 sec)*
MariaDB [mysql]> CREATE DATABASE hawkbit;
*Query OK, 1 row affected (0.00 sec)*
MariaDB [mysql]> ALTER DATABASE hawkbit COLLATE latin1_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [mysql]> grant all privileges on hawkbit.* TO 'test'@'localhost' identified by '123456a@';
*Query OK, 0 rows affected (0.01 sec)*
MariaDB [(none)]> exit
*Bye*
sudo service mysql restart
Append the following code to hawkbit-runtime/hawkbit-update-server/pom.xml
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>compile</scope>
</dependency>
Override the following code to hawkbit-runtime/hawkbit-update-server/src/main/resources/application-mysql.properties:
spring.jpa.database=mysql
spring.datasource.url=jdbc:mysql://localhost:3306/hawkbit
spring.datasource.username=test
spring.datasource.password=123456a@
spring.datasource.driverClassName=org.mariadb.jdbc.Driver
Application.properties is appended with new URL:
server.hostname=http://<my_ip_addr>
server.port=<my_port>
Rebuild and run:
cd hawkbit
mvn clean install
java -jar ./hawkbit-runtime/hawkbit-update-server/target/hawkbit-update-server-0.3.0-SNAPSHOT.jar --spring.profiles.active=mysql
Open http://<my_ip_addr>:<my_port>, I cannot log in by "admin" username and "admin" password.
Run hawkBit without --spring.profiles.active=mysql, I succeed to log in by admin, admin. Even the application.properties is kept unchanged, the results are the same.
I try to comment out all User Security:
# spring.security.user.name=admin
# spring.security.user.password={noop}admin-pwd
# spring.main.allow-bean-definition-overriding=true
and uncomment Define own users instead of default "admin" user:
hawkbit.server.im.users[0].username=test
hawkbit.server.im.users[0].password={noop}123456a@
hawkbit.server.im.users[0].firstname=Huong
hawkbit.server.im.users[0].lastname=Ha
hawkbit.server.im.users[0].permissions=ALL
the build failed with the following log:
[INFO] hawkBit :: Runtime :: Update Server ................ FAILURE [ 7.579 s]
[INFO] hawkBit :: Test Report ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14:59 min
[INFO] Finished at: 2020-12-26T16:47:05+07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project hawkbit-update-server: There are test failures.
[ERROR]
[ERROR] Please refer to /home/huong/software-update-server/hawkbit/hawkbit-runtime/hawkbit-update-server/target/surefire-reports for the individual test results.
So I have some questions and hope someone could help:
- The exact steps to setup hawkBit update server. Any experiences would be helpful
- The hawkbit database (is created as above) is an empty database, do you have an database which is compatible with hawkBit?
Thanks, Huong Ha
The procedure you are following is quite correct. However, there are couple of remarks regarding your approach:
skipTests
maven argument:mvn clean install -DskipTests
. It will drastically decrease the build time.application.properties
in order to use MySQL database. Instead just specify the--spring.profiles.active=mysql
program argument for activating the "mysql" Spring profile and adapt theapplication-mysql.properties
as needed (in your case changing the username and password datasource config).spring.security.user.name
andspring.security.user.password
orhawkbit.server.im.users
, not both. Spring security user should work out of the box. Additionally, you should NOT comment outspring.main.allow-bean-definition-overriding=true
, it is responsible for the bean overriding mechanism of Spring and has nothing to do with Spring Security.Hope that brings you further ;)