Hi, I’d like to create a custom asset using the custom project OR but I’m having a lot of problems. This is probably a recurrent theme in the forum but I have not found an answer yet. To tidy up the process I will list the steps:
1 My environment:
-
openjdk 17.0.20
-
git 2.34.1
-
node v21.7.3
-
yarn v4.1.1
-
JAVA_HOME environment variable set to the path of JDK
2 Repository custom-project cloned.
3 Initialized and updated submodule openremote
4 In IntelliJ I open the project in ~/openremote/custom-project/openremote
5 Setting up the IDE, verify the build settings (IntelliJ)
6 Custom java files were added to:
~/openremote/custom-project/agent/src/main/java/org/openremote/agent/custom
7 Using IntelliJ terminal run ./gradlew clean installDist
in
~/openremote/custom-project
Here I have the first problem, among the settings there is no “custom deployment”, am I missing something?
8 The deployment and manager docker images will be created. To do this open the terminal in the root folder of the custom-project (~/openremote/custom-project)
docker build -t xitdigi/manager:custom ./openremote/manager/build/install/manager/
docker build -t xitdigi/deployment:custom ./deployment/build/
9 Modify the docker-compose.yml file from the root folder of the custom-project, in particular:
manager:
image: xitdigi/manager:custom
restart: always
depends_on:
keycloak:
condition: service_healthy
volumes:
- manager-data:/storage
- deployment-data:/deployment
- ./deployment:/deployment
environment:
OR_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}
OR_SETUP_TYPE: # Typical values to support are staging and production
OR_SETUP_RUN_ON_RESTART:
OR_EMAIL_HOST:
OR_EMAIL_USER:
OR_EMAIL_PASSWORD:
OR_EMAIL_X_HEADERS:
OR_EMAIL_FROM:
OR_EMAIL_ADMIN:
OR_HOSTNAME: ${OR_HOSTNAME?OR_HOSTNAME must be set}
OR_ADDITIONAL_HOSTNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}
OR_SSL_PORT: ${OR_SSL_PORT:--1}
OR_DEV_MODE: ${OR_DEV_MODE:-false}
OR_MAP_TILES_PATH: ${OR_MAP_TILES_PATH:-/deployment/map/mapdata.mbtiles}
OR_MAP_SETTINGS_PATH: ${OR_MAP_SETTINGS_PATH:-/deployment/map/mapsettings.json}
WEBSERVER_LISTEN_HOST: 0.0.0.0
IDENTITY_NETWORK_WEBSERVER_PORT: 443
IDENTITY_NETWORK_SECURE: true
OR_DATA_POINTS_MAX_AGE_DAYS: 1460
deployment:
image: xitdigi/deployment:custom
volumes:
- deployment-data:/deployment
10 running the OR:
OR_HOSTNAME=localhost docker-compose -f docker-compose.yml -p custom up -d
As a result the OR works well but I’m not able to see custom assets. In the custom-project there is a custom asset as an example, should it appear in the list? I don’t see it or any other that has been created and CustomManagerSetup.java was also modified:
package org.openremote.manager.setup.custom;
import org.openremote.manager.setup.ManagerSetup;
import org.openremote.agent.custom.*;
...
public class CustomManagerSetup extends ManagerSetup {
public CustomManagerSetup(Container container) {
super(container);
}
@Override
public void onStart() throws Exception {
super.onStart();
ThingAsset thing = new ThingAsset("Custom Thing").setRealm(Constants.MASTER_REALM);
thing = assetStorageService.merge(thing);
CustomAssetCon ConAsset = new CustomAssetCon("Con Asset").setRealm("Constants.MASTER_REALM")
.setId(UniqueIdentifierGenerator.generateId("con_asset"));
ConAsset = assetStorageService.merge(ConAsset );
}
I really don’t know what I’m missing, any help please?