100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Cleaned up setup tasks, renamed KEYCLOAK_PASSWORD to SETUP_ADMIN_PASSWORD
Christian Bauera1b9065b52e6
diff --git a/keycloak/docker-entrypoint.sh b/keycloak/docker-entrypoint.shindex 55e3eaa6d..d9384a7ec 100644--- a/keycloak/docker-entrypoint.sh+++ b/keycloak/docker-entrypoint.sh@@ -1,7 +1,7 @@#!/bin/bash-if [ $KEYCLOAK_USER ] && [ $KEYCLOAK_PASSWORD ]; then- keycloak/bin/add-user-keycloak.sh --user $KEYCLOAK_USER --password $KEYCLOAK_PASSWORD+if [ $SETUP_ADMIN_PASSWORD ]; then+ keycloak/bin/add-user-keycloak.sh --user admin --password $SETUP_ADMIN_PASSWORDfiexec /opt/jboss/keycloak/bin/standalone.sh $@diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/AbstractKeycloakSetup.java b/manager/server/src/main/java/org/openremote/manager/server/setup/AbstractKeycloakSetup.javaindex 300ec7ced..8520be7c2 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/AbstractKeycloakSetup.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/AbstractKeycloakSetup.java@@ -40,8 +40,8 @@ public abstract class AbstractKeycloakSetup implements Setup {// demo data as needed.public static final String ADMIN_CLI_CLIENT_ID = "admin-cli";- public static final String KEYCLOAK_PASSWORD = "KEYCLOAK_PASSWORD";- public static final String KEYCLOAK_PASSWORD_DEFAULT = "secret";+ public static final String SETUP_ADMIN_PASSWORD = "SETUP_ADMIN_PASSWORD";+ public static final String SETUP_ADMIN_PASSWORD_DEFAULT = "secret";public static final String SETUP_KEYCLOAK_EMAIL_HOST = "SETUP_KEYCLOAK_EMAIL_HOST";public static final String SETUP_KEYCLOAK_EMAIL_HOST_DEFAULT = "smtp-host.demo.tld";public static final String SETUP_KEYCLOAK_EMAIL_USER = "SETUP_KEYCLOAK_EMAIL_USER";@@ -95,7 +95,7 @@ public abstract class AbstractKeycloakSetup implements Setup {@Overridepublic void onStart() throws Exception {// Use direct access grant feature of Keycloak Admin CLI to get superuser access token- String keycloakAdminPassword = container.getConfig().getOrDefault(KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT);+ String keycloakAdminPassword = container.getConfig().getOrDefault(SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT);this.accessToken = keycloakProvider.getKeycloak().getAccessToken(MASTER_REALM, new AuthForm(ADMIN_CLI_CLIENT_ID, MASTER_REALM_ADMIN_USER, keycloakAdminPassword)).getToken();diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/SetupService.java b/manager/server/src/main/java/org/openremote/manager/server/setup/SetupService.javaindex 92dbc30fc..8116357b8 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/SetupService.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/SetupService.java@@ -30,15 +30,15 @@ import java.util.ServiceLoader;import java.util.logging.Logger;/**- * Executes setup tasks when the application starts, configuring the state of- * subsystems (database, Keycloak).+ * Executes setup tasks for a clean installation when the application starts.+ * <p>+ * This service is disabled when {@link AbstractSetupTasks#SETUP_WIPE_CLEAN_INSTALL} is <code>false</code>.* <p>* First, this service will load an implementation of {@link SetupTasks} from the* classpath using {@link ServiceLoader}. If multiple providers are found, an error- * is raised. If a provider is found, only its tasks will be enabled.+ * is raised. If a provider is found, only its tasks will be used.* <p>- * If no {@link SetupTasks} provider is found on the classpath, the builtin- * tasks will be enabled, see {@link BuiltinSetupTasks}.+ * If no {@link SetupTasks} provider is found on the classpath, the {@link BuiltinSetupTasks} are used.*/public class SetupService implements ContainerService {@@ -51,22 +51,28 @@ public class SetupService implements ContainerService {@Overridepublic void init(Container container) throws Exception {++ if (!SetupTasks.isSetupWipeCleanInstall(container)) {+ LOG.info("Setup service disabled, " + SetupTasks.SETUP_WIPE_CLEAN_INSTALL + "=false");+ return;+ }+ServiceLoader.load(SetupTasks.class).forEach(discoveredSetupTasks -> {if (setupTasks != null) {throw new IllegalStateException(- "Only one instance of SetupTasks can be configured, already found '"+ "Only one provider of SetupTasks can be configured, already found '"+ setupTasks.getClass().getName() + ", remove from classpath: "+ discoveredSetupTasks.getClass().getName());}- LOG.info("Found setup tasks: " + discoveredSetupTasks.getClass().getName());+ LOG.info("Found custom SetupTasks provider on classpath: " + discoveredSetupTasks.getClass().getName());setupTasks = discoveredSetupTasks;});if (setupTasks == null) {- LOG.info("No custom setup tasks found on classpath, enabling built-in tasks");+ LOG.info("No custom SetupTasks provider found on classpath, enabling: " + BuiltinSetupTasks.class.getName());setupTasks = new BuiltinSetupTasks();}diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/SetupTasks.java b/manager/server/src/main/java/org/openremote/manager/server/setup/SetupTasks.javaindex 107fc80ec..992f5ac82 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/SetupTasks.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/SetupTasks.java@@ -23,11 +23,83 @@ import org.openremote.container.Container;import java.util.List;+import static org.openremote.container.util.MapAccess.getBoolean;+/**- * Returns a list of setup tasks to execute.+ * Provides a list of enabled {@link Setup} tasks.+ * <p>+ * Implementations use the static getter methods of this interface to query configuration, before returning a+ * list of their enabled tasks in {@link #createTasks}.+ * <p>+ * Configuration options can have dependencies, enabling one option may enforce other options to be enabled.+ * <p>+ * The configuration options exposed as container environment variables are:+ * <dl>+ * <dt>{@link #SETUP_WIPE_CLEAN_INSTALL}</dt>+ * <dd>+ * Defaults to enabled if {@link Container#DEV_MODE} is enabled. All setup tasks will be ignored if this option is disabled.+ * </dd>+ * <dt>{@link #SETUP_IMPORT_DEMO_USERS}</dt>+ * <dd>+ * Defaults to enabled if {@link Container#DEV_MODE} is enabled.+ * </dd>+ * <dt>{@link #SETUP_IMPORT_DEMO_ASSETS}</dt>+ * <dd>+ * Defaults to enabled if {@link Container#DEV_MODE} is enabled, enables {@link #SETUP_IMPORT_DEMO_USERS}.+ * </dd>+ * <dt>{@link #SETUP_IMPORT_DEMO_RULES}</dt>+ * <dd>+ * Defaults to enabled if {@link Container#DEV_MODE} is enabled, enables {@link #SETUP_IMPORT_DEMO_ASSETS}.+ * </dd>+ * <dt>{@link #SETUP_IMPORT_DEMO_SCENES}</dt>+ * <dd>+ * Defaults to enabled if {@link Container#DEV_MODE} is enabled, enables {@link #SETUP_IMPORT_DEMO_ASSETS}.+ * </dd>+ * <dt>{@link #SETUP_IMPORT_DEMO_AGENT}</dt>+ * <dd>+ * Defaults to disabled even when {@link Container#DEV_MODE} is enabled (as enabling may require+ * protocol-specific hardware), enables {@link #SETUP_IMPORT_DEMO_ASSETS}.+ * </dd>+ * </dl>*/public interface SetupTasks {+ String SETUP_WIPE_CLEAN_INSTALL = "SETUP_WIPE_CLEAN_INSTALL";+ String SETUP_IMPORT_DEMO_USERS = "SETUP_IMPORT_DEMO_USERS";+ String SETUP_IMPORT_DEMO_ASSETS = "SETUP_IMPORT_DEMO_ASSETS";+ String SETUP_IMPORT_DEMO_RULES = "SETUP_IMPORT_DEMO_RULES";+ String SETUP_IMPORT_DEMO_SCENES = "SETUP_IMPORT_DEMO_SCENES";+ String SETUP_IMPORT_DEMO_AGENT = "SETUP_IMPORT_DEMO_AGENT";++ static boolean isSetupWipeCleanInstall(Container container) {+ return getBoolean(container.getConfig(), SETUP_WIPE_CLEAN_INSTALL, container.isDevMode());+ }++ static boolean isImportDemoUsers(Container container) {+ return isImportDemoAssets(container)+ || getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_USERS, container.isDevMode());+ }++ static boolean isImportDemoAssets(Container container) {+ return isImportDemoAgent(container)+ || isImportDemoRules(container)+ || isImportDemoScenes(container)+ || getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_ASSETS, container.isDevMode());+ }++ static boolean isImportDemoRules(Container container) {+ return getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_RULES, container.isDevMode());+ }++ static boolean isImportDemoScenes(Container container) {+ return getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_SCENES, container.isDevMode());+ }++ // Defaults to always disabled as agents might require actual protocol-specific hardware+ static boolean isImportDemoAgent(Container container) {+ return getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_AGENT, false);+ }+List<Setup> createTasks(Container container);<S extends Setup> S getTaskOfType(Class<S> setupType);diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BasicIdentityDemoSetup.java b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BasicIdentityDemoSetup.javaindex 849579975..a1dd7481f 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BasicIdentityDemoSetup.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BasicIdentityDemoSetup.java@@ -39,8 +39,8 @@ import java.sql.PreparedStatement;*/public class BasicIdentityDemoSetup implements Setup {- public static final String SETUP_BASIC_IDENTITY_ADMIN_PASSWORD = "SETUP_BASIC_IDENTITY_ADMIN_PASSWORD";- public static final String SETUP_BASIC_IDENTITY_ADMIN_PASSWORD_DEFAULT = "secret";+ public static final String SETUP_ADMIN_PASSWORD = "SETUP_ADMIN_PASSWORD";+ public static final String SETUP_ADMIN_PASSWORD_DEFAULT = "secret";final protected ManagerPersistenceService persistenceService;final protected ManagerIdentityService identityService;@@ -52,7 +52,7 @@ public class BasicIdentityDemoSetup implements Setup {this.persistenceService = container.getService(ManagerPersistenceService.class);this.identityService = container.getService(ManagerIdentityService.class);- this.demoAdminPassword = container.getConfig().getOrDefault(SETUP_BASIC_IDENTITY_ADMIN_PASSWORD, SETUP_BASIC_IDENTITY_ADMIN_PASSWORD_DEFAULT);+ this.demoAdminPassword = container.getConfig().getOrDefault(SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT);}@Overridediff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BuiltinSetupTasks.java b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BuiltinSetupTasks.javaindex 22865d4e3..361656e80 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BuiltinSetupTasks.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/BuiltinSetupTasks.java@@ -26,105 +26,42 @@ import org.openremote.manager.server.setup.Setup;import java.util.List;-import static org.openremote.container.util.MapAccess.getBoolean;+import static org.openremote.manager.server.setup.SetupTasks.*;/*** Builtin setup tasks.- * <p>- * All setup tasks are configurable.- * <p>- * When developer mode is enabled all setup tasks default to enabled.- * When developer mode is disabled all setup tasks default to false.- * <p>- * Some setup tasks require other setup tasks so if a dependent task- * is requested to be disabled it will be overridden and enabled anyway- * (see list of config options for details)- * <p>- * Setup tasks are configured via the config hash map supplied in the- * {@link Container} constructor. Available config options are:- * <ul>- * <li>{@link #SETUP_WIPE_CLEAN_INSTALL}</li>- * <li>{@link #SETUP_IMPORT_DEMO_USERS}</li>- * <li>{@link #SETUP_IMPORT_DEMO_ASSETS} depends on {@link #SETUP_IMPORT_DEMO_USERS}</li>- * <li>{@link #SETUP_IMPORT_DEMO_SCENES} depends on {@link #SETUP_IMPORT_DEMO_ASSETS}</li>- * <li>{@link #SETUP_IMPORT_DEMO_RULES} depends on {@link #SETUP_IMPORT_DEMO_SCENES}</li>- * </ul>*/public class BuiltinSetupTasks extends AbstractSetupTasks {- public static final String SETUP_WIPE_CLEAN_INSTALL = "SETUP_WIPE_CLEAN_INSTALL";- public static final String SETUP_IMPORT_DEMO_USERS = "SETUP_IMPORT_DEMO_USERS";- public static final String SETUP_IMPORT_DEMO_ASSETS = "SETUP_IMPORT_DEMO_ASSETS";- public static final String SETUP_IMPORT_DEMO_SCENES = "SETUP_IMPORT_DEMO_SCENES";- public static final String SETUP_IMPORT_DEMO_RULES = "SETUP_IMPORT_DEMO_RULES";- public static final String SETUP_IMPORT_DEMO_AGENT = "SETUP_IMPORT_DEMO_AGENT";-- protected boolean isSetupWipeCleanInstall(Container container) {- return getBoolean(container.getConfig(), SETUP_WIPE_CLEAN_INSTALL, container.isDevMode());- }-- // Demo agent to demo protocols.- protected boolean isImportDemoAgent(Container container) {- return getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_AGENT, false);- }-- // Too many rules are difficult to debug, so they are optional- protected boolean isImportDemoRules(Container container) {- return getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_RULES, container.isDevMode());- }-- // If importing demo rules we have to import demo scenes- protected boolean isImportDemoScenes(Container container) {- return isImportDemoRules(container) || getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_SCENES, container.isDevMode());- }-- // If importing demo rules we have to import demo assets- protected boolean isImportDemoAssets(Container container) {- return isImportDemoRules(container) || getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_ASSETS, container.isDevMode());- }-- // If importing demo assets we have to import demo users- protected boolean isImportDemoUsers(Container container) {- return isImportDemoAssets(container) || getBoolean(container.getConfig(), SETUP_IMPORT_DEMO_USERS, container.isDevMode());- }-@Overridepublic List<Setup> createTasks(Container container) {// Basic vs Keycloak identity providerif (container.getService(ManagerIdentityService.class).isKeycloakEnabled()) {- if (isSetupWipeCleanInstall(container)) {- addTask(new ManagerCleanSetup(container));- addTask(new KeycloakCleanSetup(container));- addTask(new KeycloakInitSetup(container));- }-+ addTask(new ManagerCleanSetup(container));+ addTask(new KeycloakCleanSetup(container));+ addTask(new KeycloakInitSetup(container));if (isImportDemoUsers(container)) {addTask(new KeycloakDemoSetup(container));}-- if (isImportDemoAssets(container)) {- addTask(new ManagerDemoSetup(container, isImportDemoScenes(container)));- }-- if (isImportDemoRules(container)) {- addTask(new RulesDemoSetup(container));- }-- if (isImportDemoAgent(container)) {- addTask(new ManagerDemoAgentSetup(container));- }} else {- if (isSetupWipeCleanInstall(container)) {- addTask(new ManagerCleanSetup(container));- addTask(new BasicIdentityInitSetup(container));- }-+ addTask(new ManagerCleanSetup(container));+ addTask(new BasicIdentityInitSetup(container));if (isImportDemoUsers(container)) {addTask(new BasicIdentityDemoSetup(container));}}+ if (isImportDemoAssets(container)) {+ addTask(new ManagerDemoSetup(container, isImportDemoScenes(container)));+ }+ if (isImportDemoRules(container)) {+ addTask(new RulesDemoSetup(container));+ }+ if (isImportDemoAgent(container)) {+ addTask(new ManagerDemoAgentSetup(container));+ }+return getTasks();}}diff --git a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoAgentSetup.java b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoAgentSetup.javaindex b271d1129..11b530f70 100644--- a/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoAgentSetup.java+++ b/manager/server/src/main/java/org/openremote/manager/server/setup/builtin/ManagerDemoAgentSetup.java@@ -53,7 +53,6 @@ public class ManagerDemoAgentSetup extends AbstractManagerSetup {public String masterRealmId;-final protected boolean knx;final protected String knxGatewayIp;final protected String knxLocalIp;diff --git a/manager/server/src/main/resources/demo/rules/DemoApartmentPresencePrediction.drl b/manager/server/src/main/resources/demo/rules/DemoApartmentPresencePrediction.drlindex af8249e7d..172bb2c9e 100644--- a/manager/server/src/main/resources/demo/rules/DemoApartmentPresencePrediction.drl+++ b/manager/server/src/main/resources/demo/rules/DemoApartmentPresencePrediction.drl@@ -58,7 +58,6 @@ Old:awayActualSceneStartTime // "-", e.g. "18:22"currentScene // "-", Possible values are "-", "Departure", "Arrive"- // in blok61 it is "home", "away", "evening", "night"*/diff --git a/platform/rpi3/README.md b/platform/rpi3/README.mdindex 5b8a331a5..9cec50426 100644--- a/platform/rpi3/README.md+++ b/platform/rpi3/README.md@@ -37,7 +37,7 @@ This will download packages from the Internet, so make sure your machine is connStart OpenRemote with:```-sudo DATABASE_PASSWORD='dbsecret' SETUP_BASIC_IDENTITY_ADMIN_PASSWORD='secret123' IDENTITY_NETWORK_HOST=<IP of your Raspberry Pi3> ./openremote-run.sh+sudo DATABASE_PASSWORD='dbsecret' SETUP_ADMIN_PASSWORD='secret123' IDENTITY_NETWORK_HOST=<IP of your Raspberry Pi3> ./openremote-run.sh```Open the Manager UI on `http://<IP of your Raspberry Pi 3>/` and login with `admin` and your password.diff --git a/platform/rpi3/pi64/openremote-run.sh b/platform/rpi3/pi64/openremote-run.shindex d412e8e21..56eaa54e3 100755--- a/platform/rpi3/pi64/openremote-run.sh+++ b/platform/rpi3/pi64/openremote-run.sh@@ -11,7 +11,7 @@ export DEV_MODE=true# the application, you can configure which setup tasks you want to execute. Careful,# these tasks will clean and populate the Manager database with demo data!export SETUP_WIPE_CLEAN_INSTALL=true-export SETUP_BASIC_IDENTITY_ADMIN_PASSWORD=${SETUP_BASIC_IDENTITY_ADMIN_PASSWORD:-"secret"}+export SETUP_ADMIN_PASSWORD=${SETUP_ADMIN_PASSWORD:-"secret"}export SETUP_IMPORT_DEMO_USERS=trueexport SETUP_IMPORT_DEMO_ASSETS=trueexport SETUP_IMPORT_DEMO_RULES=truediff --git a/profile/demo-rpi.yml b/profile/demo-rpi.ymlindex 24d25a5ca..c030b66c4 100644--- a/profile/demo-rpi.yml+++ b/profile/demo-rpi.yml@@ -32,7 +32,7 @@ services:SETUP_WIPE_CLEAN_INSTALL: 'true'# If you force clean, a new master admin user will be created with this password.- SETUP_BASIC_IDENTITY_ADMIN_PASSWORD: secret+ SETUP_ADMIN_PASSWORD: secret# Other demo data can be imported as needed, these examples only use the simulator protocol.SETUP_IMPORT_DEMO_USERS: 'true'diff --git a/profile/demo.yml b/profile/demo.ymlindex 9f2832498..4fc510cab 100644--- a/profile/demo.yml+++ b/profile/demo.yml@@ -13,7 +13,7 @@## Steps to create a permanent installation:#-# 1. DO NOT FORGET TO CHANGE KEYCLOAK_PASSWORD!+# 1. DO NOT FORGET TO CHANGE SETUP_ADMIN_PASSWORD!## 2. Consider setting a custom DOMAINNAME, LE_EMAIL, and IDENTITY_NETWORK_HOST, see deploy.yml#@@ -25,7 +25,7 @@# 4. Execute once:## SETUP_WIPE_CLEAN_INSTALL=true \-# KEYCLOAK_PASSWORD=secret \+# SETUP_ADMIN_PASSWORD=secret \# docker-compose -p openremote -f profile/demo.yml up## This creates the initial database and optionally imports some examples. Inspect the@@ -99,7 +99,7 @@ services:SETUP_WIPE_CLEAN_INSTALL: 'true'# When you are ready to permanently install your project, replace it with the next lines...# SETUP_WIPE_CLEAN_INSTALL: # Allow override on CLI- # KEYCLOAK_PASSWORD: # Allow override on CLI+ # SETUP_ADMIN_PASSWORD: # Allow override on CLIkeycloak:extends:@@ -110,9 +110,9 @@ services:condition: service_healthyenvironment:# CHANGE THIS PASSWORD BEFORE STARTING THE STACK! THIS IS ONLY FOR DEMO!- KEYCLOAK_PASSWORD: secret+ SETUP_ADMIN_PASSWORD: secret# When you are ready to permanently install your project, replace it with the next line ...- # KEYCLOAK_PASSWORD: # Allow override on CLI+ # SETUP_ADMIN_PASSWORD: # Allow override on CLI# This configuration stores postgresql data in a Docker volume. You manage this volume# independently from your stack with with 'docker volume ls', 'docker volume rm', etc.diff --git a/profile/deploy.yml b/profile/deploy.ymlindex 455eddf05..506d604cf 100644--- a/profile/deploy.yml+++ b/profile/deploy.yml@@ -92,15 +92,15 @@ services:TZ: Europe/Zurich# If developer mode is enabled, all setup tasks will be executed on application startup.- # This will clean all data in Keycloak and the Manager database, and then import demo/test- # data. Some caching and other runtime performance-optimizations will also be disabled.+ # This will clean all data in the database, and then import demo/test data. Some caching and+ # other runtime performance-optimizations will also be disabled.DEV_MODE: 'false'- # This switch can wipe all your Manager and Keycloak data, this is the factory reset!+ # This switch can wipe your database, this is the factory reset!SETUP_WIPE_CLEAN_INSTALL: 'true'# When you are ready to permanently install your project, replace it with the next lines...# SETUP_WIPE_CLEAN_INSTALL: # Allow override on CLI- # KEYCLOAK_PASSWORD: # Allow override on CLI+ # SETUP_ADMIN_PASSWORD: # Allow override on CLI# Optional: Configure SMTP smart host for Keycloak, to send password reset emails etc.#SETUP_KEYCLOAK_EMAIL_HOST: smtp-host.demo.tld@@ -115,6 +115,7 @@ services:SETUP_IMPORT_DEMO_USERS: 'true'SETUP_IMPORT_DEMO_ASSETS: 'true'SETUP_IMPORT_DEMO_RULES: 'true'+ SETUP_IMPORT_DEMO_SCENES: 'true'# Create a demo agent with example configurations for all built-in protocols:#@@ -196,7 +197,6 @@ services:# provides full multi-tenancy identity and role management. The basic provider supports# only superusers and their text passwords, managed in a simple database table.# IDENTITY_PROVIDER: 'basic'- # SETUP_BASIC_IDENTITY_ADMIN_PASSWORD: 'secret'# Location of the static manager (UI and API) resources, you don't need to override this# unless you want to deploy a modified version of the Manager UI.@@ -237,13 +237,10 @@ services:# Switch to DEBUG to diagnose Keycloak problems.KEYCLOAK_LOGLEVEL: INFO- # The master realm superuser, you should not change this.- KEYCLOAK_USER: admin-# CHANGE THIS PASSWORD BEFORE STARTING THE STACK! THIS IS ONLY FOR DEMO!- KEYCLOAK_PASSWORD: secret+ SETUP_ADMIN_PASSWORD: secret# When you are ready to permanently install your project, replace it with the next line ...- # KEYCLOAK_PASSWORD: # Allow override on CLI+ # SETUP_ADMIN_PASSWORD: # Allow override on CLI# Configure how Keycloak connects to the databasePOSTGRES_DATABASE: openremotediff --git a/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy b/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovyindex 3b90f8822..2b201682b 100644--- a/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy+++ b/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy@@ -36,7 +36,7 @@ import static org.openremote.container.security.IdentityService.IDENTITY_NETWORKimport static org.openremote.container.timer.TimerService.Clock.PSEUDOimport static org.openremote.container.timer.TimerService.TIMER_CLOCK_TYPEimport static org.openremote.container.web.WebService.WEBSERVER_LISTEN_PORT-import static org.openremote.manager.server.setup.builtin.BuiltinSetupTasks.*+import static org.openremote.manager.server.setup.SetupTasks.*trait ManagerContainerTrait extends ContainerTrait {diff --git a/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy b/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovyindex 2aa36d6bd..a10ea6f46 100644--- a/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy+++ b/test/src/test/groovy/org/openremote/test/admin/AdminTenantsActivityTest.groovy@@ -37,8 +37,8 @@ import spock.lang.Specificationimport spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class AdminTenantsActivityTest extends Specification implements ManagerContainerTrait, GwtClientTrait {@@ -64,7 +64,7 @@ class AdminTenantsActivityTest extends Specification implements ManagerContainerrealm,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).token}def securityService = new ClientSecurityService(keycloakProvider.getKeycloakDeployment(realm, KEYCLOAK_CLIENT_ID), accessToken)diff --git a/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy b/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovyindex ac0471d09..2dc5dcdc8 100644--- a/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy+++ b/test/src/test/groovy/org/openremote/test/admin/AdminUsersActivityTest.groovy@@ -41,8 +41,8 @@ import spock.util.concurrent.BlockingVariablesimport spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class AdminUsersActivityTest extends Specification implements ManagerContainerTrait, GwtClientTrait {@@ -70,7 +70,7 @@ class AdminUsersActivityTest extends Specification implements ManagerContainerTrrealm,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).token}def securityService = new ClientSecurityService(keycloakProvider.getKeycloakDeployment(realm, KEYCLOAK_CLIENT_ID), accessToken)diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovyindex b7106ec21..afc93aea5 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetBrowserPresenterTest.groovy@@ -39,8 +39,8 @@ import spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getStringimport static org.openremote.manager.server.event.ClientEventService.WEBSOCKET_EVENTS-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class AssetBrowserPresenterTest extends Specification implements ManagerContainerTrait, GwtClientTrait {@@ -64,7 +64,7 @@ class AssetBrowserPresenterTest extends Specification implements ManagerContainerealm,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).token}def securityService = new ClientSecurityService(keycloakProvider.getKeycloakDeployment(realm, KEYCLOAK_CLIENT_ID), accessToken)diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovyindex 5858efebc..b7f559e8e 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetIntegrityTest.groovy@@ -17,8 +17,8 @@ import spock.util.concurrent.PollingConditionsimport javax.ws.rs.WebApplicationExceptionimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class AssetIntegrityTest extends Specification implements ManagerContainerTrait {@@ -36,7 +36,7 @@ class AssetIntegrityTest extends Specification implements ManagerContainerTraitMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the asset resource"diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovyindex 948033067..0ab972fff 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetPermissionsTest.groovy@@ -17,8 +17,8 @@ import spock.util.concurrent.PollingConditionsimport javax.ws.rs.WebApplicationExceptionimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*import static org.openremote.model.asset.AssetMeta.ABOUTimport static org.openremote.model.asset.AssetMeta.LABEL@@ -44,7 +44,7 @@ class AssetPermissionsTest extends Specification implements ManagerContainerTraiMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the asset resource"diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovyindex 8a49d6f80..3a1feafd0 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetUserLinkingTest.groovy@@ -13,8 +13,8 @@ import spock.lang.Specificationimport javax.ws.rs.WebApplicationExceptionimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class AssetUserLinkingTest extends Specification implements ManagerContainerTrait {@@ -34,7 +34,7 @@ class AssetUserLinkingTest extends Specification implements ManagerContainerTraiMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the asset resource"diff --git a/test/src/test/groovy/org/openremote/test/map/MapResourceTest.groovy b/test/src/test/groovy/org/openremote/test/map/MapResourceTest.groovyindex c70b2f345..eb87a66c9 100644--- a/test/src/test/groovy/org/openremote/test/map/MapResourceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/map/MapResourceTest.groovy@@ -23,7 +23,7 @@ class MapResourceTest extends Specification implements ManagerContainerTrait {realm,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "a test client target"diff --git a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovyindex da753fb33..e78db80ff 100644--- a/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/BasicProtocolTest.groovy@@ -42,8 +42,8 @@ import spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getStringimport static org.openremote.manager.server.event.ClientEventService.WEBSOCKET_EVENTS-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.KEYCLOAK_CLIENT_IDimport static org.openremote.model.Constants.MASTER_REALMimport static org.openremote.model.Constants.MASTER_REALM_ADMIN_USER@@ -176,7 +176,7 @@ class BasicProtocolTest extends Specification implements ManagerContainerTrait,MASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).token}List<SharedEvent> collectedSharedEvents = []diff --git a/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovyindex 6e2ba60c9..b429b1803 100644--- a/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/KNXImportTest.groovy@@ -20,8 +20,8 @@package org.openremote.test.protocolimport static org.openremote.model.Constants.*-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.container.util.MapAccess.getStringimport org.openremote.agent.protocol.knx.KNXProtocol@@ -81,7 +81,7 @@ class KNXImportTest extends Specification implements ManagerContainerTrait {MASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the agent resource"diff --git a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovyindex 1fc566ce6..3a335cca5 100644--- a/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/velbus/VelbusProtocolTest.groovy@@ -28,8 +28,8 @@ import spock.lang.Specificationimport spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*import static org.openremote.model.asset.agent.ProtocolConfiguration.initProtocolConfiguration@@ -177,7 +177,7 @@ class VelbusProtocolTest extends Specification implements ManagerContainerTraitMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the agent resource"diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovyindex 5e8d62a2b..5a89b6ceb 100644--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesDeploymentTest.groovy@@ -16,8 +16,8 @@ import spock.lang.Specificationimport spock.util.concurrent.PollingConditionsimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class BasicRulesDeploymentTest extends Specification implements ManagerContainerTrait {@@ -45,7 +45,7 @@ class BasicRulesDeploymentTest extends Specification implements ManagerContainerMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenexpect: "the rules engines to be ready"diff --git a/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy b/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovyindex 5dd22eca9..350eaa7c2 100644--- a/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/rules/BasicRulesetResourceTest.groovy@@ -16,8 +16,8 @@ import spock.util.concurrent.PollingConditionsimport javax.ws.rs.WebApplicationExceptionimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.*class BasicRulesetResourceTest extends Specification implements ManagerContainerTrait {@@ -40,7 +40,7 @@ class BasicRulesetResourceTest extends Specification implements ManagerContainerMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokenand: "the ruleset resource"diff --git a/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy b/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovyindex a7f59ac0d..f31e0c430 100644--- a/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/user/NotificationServiceTest.groovy@@ -18,8 +18,8 @@ import spock.lang.Specificationimport javax.ws.rs.WebApplicationExceptionimport static org.openremote.container.util.MapAccess.getString-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD-import static org.openremote.manager.server.setup.AbstractKeycloakSetup.KEYCLOAK_PASSWORD_DEFAULT+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD+import static org.openremote.manager.server.setup.AbstractKeycloakSetup.SETUP_ADMIN_PASSWORD_DEFAULTimport static org.openremote.model.Constants.KEYCLOAK_CLIENT_IDimport static org.openremote.model.Constants.MASTER_REALMimport static org.openremote.model.Constants.MASTER_REALM_ADMIN_USER@@ -67,7 +67,7 @@ class NotificationServiceTest extends Specification implements ManagerContainerTMASTER_REALM,KEYCLOAK_CLIENT_ID,MASTER_REALM_ADMIN_USER,- getString(container.getConfig(), KEYCLOAK_PASSWORD, KEYCLOAK_PASSWORD_DEFAULT)+ getString(container.getConfig(), SETUP_ADMIN_PASSWORD, SETUP_ADMIN_PASSWORD_DEFAULT)).tokendef notification = new AlertNotification(