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
Removed obsolete IDENTITY_NETWORK_* env vars and introduced EXTERNAL_URL, also fixed bug with X-Forwarded-Host processing
Rich Turnerae272ca90989
diff --git a/.gitlab-ci.yml b/.gitlab-ci.ymldeleted file mode 100644index e40d2c7b5..000000000--- a/.gitlab-ci.yml+++ /dev/null@@ -1,360 +0,0 @@-default:- interruptible: true- image: docker:latest- services:- - docker:dind- timeout: 30m--variables:- PROJECT_NAME: demo- GIT_SUBMODULE_STRATEGY: normal- DEPLOYMENT_HOST_USER: ubuntu- DEPLOYMENT_PORT: 22- DAST_WEBSITE: https://staging.${PROJECT_NAME}.openremote.io- PLATFORM: linux/amd64,linux/arm64--workflow:- rules:- - if: $CI_COMMIT_BRANCH != "master"- when: never- - when: always--stages:- - prebuild- - build- - deploy_aws- - build_fail- - test- - tests_fail- - deploy- - dast- - cleanup--lint-Dockerfile:- stage: build- script:- - docker pull hadolint/hadolint- - docker run --rm -i hadolint/hadolint < Dockerfile- allow_failure: true- rules:- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-build/- when: never--lint-swarm-Dockerfile:- stage: build- script:- - echo "I'm in the branch $CI_COMMIT_BRANCH $CI_COMMIT_MESSAGE"- - docker pull hadolint/hadolint- - docker run --rm -i hadolint/hadolint < ./manager/swarm.Dockerfile- after_script:- - env- rules:- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-build/- when: never--build-enviroment:- stage: prebuild- allow_failure: true- before_script:- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY- - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"- script:- - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .- - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"- rules:- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE =~ /skip-build/- when: never- - changes:- - Dockerfile- - when: manual--build-deployment-manager-swarm:- stage: build- allow_failure: true- before_script:- - export DOCKER_CLI_EXPERIMENTAL=enabled- - mkdir -p /root/.docker/cli-plugins- - mv .docker/cli-plugins/docker-buildx /root/.docker/cli-plugins/- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY- - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes- - docker buildx create --use- script:- - docker buildx ls- - docker context ls- - docker run -v $(pwd):/or -v $(pwd)/logs:/root/.npm/_logs "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"- /bin/sh -c "./gradlew --console plain clean installDist"- # Build multi-arch images- - docker buildx build --push --platform $PLATFORM -t openremote/manager:latest manager/build/install/manager- - docker buildx build --push --platform $PLATFORM -t openremote/deployment:latest deployment- - docker buildx build --push --platform $PLATFORM -t openremote/manager-swarm:latest -f manager/build/install/manager/swarm.Dockerfile manager/build/install/manager- rules:- - when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-build/- when: manual- retry:- max: 2- artifacts:- when: on_failure- paths:- - "logs/*"- expire_in: 4 weeks--build-keycloak-postgresql-proxy:- stage: build- allow_failure: true- before_script:- - export DOCKER_CLI_EXPERIMENTAL=enabled- - mkdir -p /root/.docker/cli-plugins- - mv .docker/cli-plugins/docker-buildx /root/.docker/cli-plugins/- - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY- - docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_PASSWORD"- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes- - docker buildx create --use- script:- - docker buildx build --push --platform $PLATFORM -t openremote/proxy:latest proxy- - docker buildx build --push --platform linux/amd64 -t openremote/keycloak:latest keycloak- - docker buildx build --push --platform $PLATFORM -t openremote/postgresql:latest postgresql- rules:- - when: never- - if: $CI_COMMIT_MESSAGE =~ /skip-build/- when: never- - changes:- - proxy/**/*- - postgresql/**/*- - keycloak/**/*- - when: manual- retry:- max: 2--.email_template: ¬ify_email- image: docker:latest- before_script:- - cat $AWS_MAIL > aws_mail.py- script:- - docker pull registry.gitlab.com/openremote/openremote:master- - export WHO=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git log --pretty="%ce" -1)- - export WHEN=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git log --pretty="%ad %ar" -1)- - export WHAT=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git log --pretty="%h %s" -1)- - export REPO=$(docker run --rm -v $(pwd):/or registry.gitlab.com/openremote/openremote:master git remote get-url origin|xargs basename)- - echo $REPO- - docker run -v $(pwd):/usr/src/myapp -w /usr/src/myapp- -e "STAGE=$CI_JOB_STAGE"- -e "WHO=$WHO"- -e "WHAT=$WHAT"- -e "WHEN=$WHEN"- -e "REPO=$REPO"- -e "SMTP_USERNAME=$SMTP_USERNAME"- -e "SMTP_PASSWORD=$SMTP_PASSWORD"- --rm python:3 python aws_mail.py- retry:- max: 2--.notify_whatsapp: ¬ify_whatsapp- image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest- allow_failure: true- variables:- GIT_STRATEGY: none- script:- - >- curl --location --request POST $WHATSAPP_API- --header 'Content-Type: application/javascript'- --data-raw "{- \"message\": \"Your $CI_PROJECT_TITLE+$CI_JOB_STAGE code is $CI_JOB_NAME\",- \"recipient\": \"$WHATSAPP_TEL\",- \"user_id\": \"1\"- }"- retry:- max: 2--.ssh_config: &ssh_config- - mkdir -p ~/.ssh- - chmod 600 "$GITLAB_SSH_PRIVATE_KEY"- - eval "$(ssh-agent -s)"- - ssh-add "$GITLAB_SSH_PRIVATE_KEY"- - ssh-keyscan -H -p $DEPLOYMENT_PORT $DEPLOYMENT_HOST >> ~/.ssh/known_hosts- - alias SSH="ssh -p $DEPLOYMENT_PORT ${DEPLOYMENT_HOST_USER}@${DEPLOYMENT_HOST}"- - alias SCP="scp -p -r -P $DEPLOYMENT_PORT"--.deploy_template: &deploy_definition- before_script:- - *ssh_config- script:- - echo "Deploy to $CI_ENVIRONMENT_SLUG server"- - echo "export CI_REGISTRY_IMAGE=openremote" >> deploy.sh- - if [ ! $DOCKER_IMAGE_TAG ]; then echo "export CI_ENVIRONMENT=$CI_ENVIRONMENT_SLUG" >> deploy.sh; fi- - if [ $DOCKER_IMAGE_TAG ]; then echo "export CI_ENVIRONMENT=$DOCKER_IMAGE_TAG" >> deploy.sh; fi- - echo "export SETUP_WIPE_CLEAN_INSTALL=$SETUP_WIPE_CLEAN_INSTALL" >> deploy.sh- - if [ $SETUP_ADMIN_PASSWORD ]; then echo "export SETUP_ADMIN_PASSWORD=$SETUP_ADMIN_PASSWORD" >> deploy.sh; fi- - if [ $IDENTITY_NETWORK_HOST ]; then echo "export IDENTITY_NETWORK_HOST=$IDENTITY_NETWORK_HOST" >> deploy.sh; fi- - if [ $NEW_IMAGES ]; then echo "docker pull \$CI_REGISTRY_IMAGE/manager:\$CI_ENVIRONMENT" >> deploy.sh; fi- - if [ $NEW_IMAGES ]; then echo "docker pull \$CI_REGISTRY_IMAGE/deployment:\$CI_ENVIRONMENT" >> deploy.sh; fi- - if [ $NEW_IMAGES ]; then echo "docker pull \$CI_REGISTRY_IMAGE/proxy:\$CI_ENVIRONMENT" >> deploy.sh; fi- - if [ $NEW_IMAGES ]; then echo "docker pull \$CI_REGISTRY_IMAGE/postgresql:\$CI_ENVIRONMENT" >> deploy.sh; fi- - if [ $NEW_IMAGES ]; then echo "docker pull \$CI_REGISTRY_IMAGE/keycloak:\$CI_ENVIRONMENT" >> deploy.sh; fi- - echo "docker-compose -p $PROJECT_NAME -f profile/demo-openremote.yml down || exit 666" >> deploy.sh- - echo "docker volume rm ${PROJECT_NAME}_deployment-data" >> deploy.sh- - echo "docker-compose -p $PROJECT_NAME -f profile/demo-openremote.yml up --no-build -d || exit 666" >> deploy.sh- - echo "docker cp FIREBASE_CONFIG_FILE ${PROJECT_NAME}_manager_1:/deployment/manager/fcm.json || exit 666" >> deploy.sh- - echo "docker restart ${PROJECT_NAME}_manager_1 || exit 666" >> deploy.sh- - chmod +x deploy.sh- - SSH mkdir -p profile deployment proxy manager/build/install/manager postgresql keycloak- - SCP ./profile/ deploy.sh ${DEPLOYMENT_HOST_USER}@${DEPLOYMENT_HOST}:~/- - SCP ${FIREBASE_CONFIG_FILE} ${DEPLOYMENT_HOST_USER}@${DEPLOYMENT_HOST}:~/FIREBASE_CONFIG_FILE- - SSH ./deploy.sh- - SSH "docker system prune -f; docker images -q --filter dangling=true | xargs docker rmi; rm -rf proxy/ manager/ postgresql/ keycloak/ profile/ deployment/ deploy.sh .docker/config.json"- after_script:- - *ssh_config- - SSH "docker-compose -p ${PROJECT_NAME} -f profile/demo-openremote.yml logs > demo-openremote.log"- - SCP ${DEPLOYMENT_HOST_USER}@${DEPLOYMENT_HOST}:~/*.log .- - SSH "rm ~/*.log"- artifacts:- when: on_failure- paths:- - demo-openremote.log- expire_in: 4 weeks- retry:- max: 2--# This step is executed when build fails. The purpose is to e-mail a git commiter about the problem.-email failed build:- stage: build_fail- <<: *notify_email- rules:- - when: never- - if: $CI_COMMIT_MESSAGE =~ /deploy-demo/- when: on_failure- - if: $CI_COMMIT_MESSAGE =~ /skip-build/- when: never- - when: on_failure--build FAILED:- stage: build_fail- <<: *notify_whatsapp- rules:- - when: never- - if: $CI_COMMIT_MESSAGE =~ /deploy-demo/- when: on_failure- - if: $CI_COMMIT_MESSAGE =~ /skip-build/- when: never- - when: on_failure--test-master:- stage: test- before_script:- - docker run -v $(pwd):/or- -v /var/run/docker.sock:/var/run/docker.sock "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"- /bin/sh -c "docker-compose -f profile/dev-testing.yml pull"- - docker run -v $(pwd):/or- -v /var/run/docker.sock:/var/run/docker.sock "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"- /bin/sh -c "docker-compose -f profile/dev-testing.yml up --no-build -d"- script:- - docker run --network host -v $(pwd):/or "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"- /bin/sh -c "./gradlew clean test"- rules:- - when: never- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-test/- artifacts:- when: on_failure- paths:- - "test/build/reports/tests/test/*"- - "test/build/reports/tests/test/*/*"- expire_in: 4 weeks- retry:- max: 2--deploy demo on AWS:- stage: deploy_aws- allow_failure: true- rules:- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE =~ /deploy-demo/- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-build/- when: manual- variables:- DEPLOYMENT_HOST: ${PROJECT_NAME}.openremote.io- IDENTITY_NETWORK_HOST: ${PROJECT_NAME}.openremote.io- SETUP_WIPE_CLEAN_INSTALL: "true"- DOCKER_IMAGE_TAG: latest- NEW_IMAGES: "true"- environment:- name: demo- url: https://${PROJECT_NAME}.openremote.io- <<: *deploy_definition--redeploy demo on AWS:- stage: deploy_aws- allow_failure: true- rules:- - if: $CI_COMMIT_MESSAGE =~ /deploy-demo/- when: on_success- variables:- DEPLOYMENT_HOST: ${PROJECT_NAME}.openremote.io- IDENTITY_NETWORK_HOST: ${PROJECT_NAME}.openremote.io- SETUP_WIPE_CLEAN_INSTALL: "true"- DOCKER_IMAGE_TAG: latest- environment:- name: demo- url: https://${PROJECT_NAME}.openremote.io- <<: *deploy_definition--email failed tests:- stage: tests_fail- needs: ["test-master"]- before_script:- - export STAGE='tests'- <<: *notify_email- rules:- - when: never- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-test/- when: on_failure--test FAILED:- stage: tests_fail- needs: ["test-master"]- <<: *notify_whatsapp- rules:- - when: never- - if: $RUN_TESTS == "true"- when: never- - if: $CI_COMMIT_MESSAGE !~ /skip-test/- when: on_failure--manual delete aws cloudformation stack:- image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest- stage: cleanup- before_script:- - |-- PAYLOAD=$(cat << JSON- {- "select":{"include":"ALL_EXCEPT_PATH"},- "type":{"predicateType":"string","value":"urn:openremote:asset:flight"}- }- JSON- )- - echo $PAYLOAD- - export OR_ENDPOINT=$(aws cloudformation describe-stacks --stack-name openremote- --query "Stacks[0].Outputs[?OutputKey=='InstanceIP'].OutputValue" --output text)- - >- curl -X POST --insecure https://$OR_ENDPOINT/api/master/asset/query- --header 'Content-Type: application/json; charset=utf-8'- --data-binary "$PAYLOAD"- script:- - aws cloudformation delete-stack --stack-name $AWS_STACK_NAME- - aws cloudformation wait stack-delete-complete --stack-name $AWS_STACK_NAME- allow_failure: true # set when:manual optional and not blocking- rules:- - if: $CI_COMMIT_MESSAGE !~ /skip-deploy/- when: neverdiff --git a/README.md b/README.mdindex 2e56ec0ad..efc678e5f 100644--- a/README.md+++ b/README.md@@ -38,13 +38,13 @@ The URL you use to access the system is important, by default keycloak expects iBASH:```-KEYCLOAK_FRONTEND_URL=https://192.168.1.1/auth docker-compose -p openremote up -d+EXTERNAL_URL=https://192.168.1.1 docker-compose -p openremote up -d```orCMD:```-cmd /C "set KEYCLOAK_FRONTEND_URL=https://192.168.1.1/auth && docker-compose -p openremote up -d"+cmd /C "set EXTERNAL_URL=https://192.168.1.1 && docker-compose -p openremote up -d"```diff --git a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.javaindex c0bd0da11..751b65816 100644--- a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java+++ b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java@@ -95,17 +95,9 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {public static final int IDENTITY_SESSION_MAX_MINUTES_DEFAULT = 60 * 24; // 1 daypublic static final String IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES = "IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES";public static final int IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES_DEFAULT = 2628000; // 5 years- public static final String IDENTITY_NETWORK_SECURE = "IDENTITY_NETWORK_SECURE";- public static final boolean IDENTITY_NETWORK_SECURE_DEFAULT = false;- public static final String IDENTITY_NETWORK_HOST = "IDENTITY_NETWORK_HOST";- public static final String IDENTITY_NETWORK_HOST_DEFAULT = "localhost";- public static final String IDENTITY_NETWORK_WEBSERVER_PORT = "IDENTITY_NETWORK_WEBSERVER_PORT";- public static final int IDENTITY_NETWORK_WEBSERVER_PORT_DEFAULT = 8080;public static final String KEYCLOAK_AUTH_PATH = "auth";private static final Logger LOG = Logger.getLogger(KeycloakIdentityProvider.class.getName());- // The externally visible address of this installation- protected UriBuilder externalServerUri;// The (internal) URI where Keycloak can be foundprotected UriBuilder keycloakServiceUri;// Configuration options for new realms@@ -151,19 +143,6 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {return;}- boolean identityNetworkSecure = getBoolean(container.getConfig(), IDENTITY_NETWORK_SECURE, IDENTITY_NETWORK_SECURE_DEFAULT);- String identityNetworkHost = getString(container.getConfig(), IDENTITY_NETWORK_HOST, IDENTITY_NETWORK_HOST_DEFAULT);- int identityNetworkPort = getInteger(container.getConfig(), IDENTITY_NETWORK_WEBSERVER_PORT, IDENTITY_NETWORK_WEBSERVER_PORT_DEFAULT);-- externalServerUri = UriBuilder.fromUri("")- .scheme(identityNetworkSecure ? "https" : "http")- .host(identityNetworkHost);-- // Only set the port if it's not the default protocol port- if (identityNetworkPort != 80 && identityNetworkPort != 443) {- externalServerUri = externalServerUri.port(identityNetworkPort);- }-sessionMaxSeconds = getInteger(container.getConfig(), IDENTITY_SESSION_MAX_MINUTES, IDENTITY_SESSION_MAX_MINUTES_DEFAULT) * 60;if (sessionMaxSeconds < 60) {throw new IllegalArgumentException(IDENTITY_SESSION_MAX_MINUTES + " must be more than 1 minute");@@ -177,7 +156,6 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {throw new IllegalArgumentException(IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES + " must be more than 1 minute");}- LOG.info("External system base URL: " + externalServerUri.build());keycloakServiceUri =UriBuilder.fromPath("/").scheme("http")diff --git a/docker-compose.yml b/docker-compose.ymlindex 56f4bbea8..1a0b865cf 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -16,14 +16,14 @@ volumes:services:proxy:- image: openremote/proxy:${PROXY_VERSION:-2.1.2.2}+ image: openremote/proxy:${PROXY_VERSION:-2.1.2.3}restart: alwaysdepends_on:manager:condition: service_healthyports:- - "80:80"- - "443:443"+ - "8000:80"+ - "8443:443"- "8883:8883"postgresql:@@ -39,7 +39,7 @@ services:postgresql:condition: service_healthyenvironment:- KEYCLOAK_FRONTEND_URL: ${KEYCLOAK_FRONTEND_URL:-https://localhost/auth}+ KEYCLOAK_FRONTEND_URL: ${EXTERNAL_URL:-https://localhost}/authKEYCLOAK_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}manager:diff --git a/gitlab-ci/aws-cloudformation.template.arm64.yml b/gitlab-ci/aws-cloudformation.template.arm64.ymlindex 2c6b40dad..b40768f43 100644--- a/gitlab-ci/aws-cloudformation.template.arm64.yml+++ b/gitlab-ci/aws-cloudformation.template.arm64.yml@@ -108,18 +108,18 @@ Resources:if [ ${HostName} ] && [ ${DomainName} ]thenecho export DOMAINNAME=${HostName}.${DomainName} >> deploy.sh- echo 'export IDENTITY_NETWORK_HOST=$DOMAINNAME' >> deploy.sh+ echo 'export EXTERNAL_URL=https://$DOMAINNAME' >> deploy.shelif [ ${DomainName} ]thenecho export DOMAINNAME=${DomainName} >> deploy.sh- echo 'export IDENTITY_NETWORK_HOST=$DOMAINNAME' >> deploy.sh+ echo 'export EXTERNAL_URL=https://$DOMAINNAME' >> deploy.shelif [ ${HostName} ]thenecho export DOMAINNAME=${HostName} >> deploy.sh- echo export 'IDENTITY_NETWORK_HOST=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)' >> deploy.sh+ echo export 'EXTERNAL_URL=https://$(curl http://169.254.169.254/latest/meta-data/public-ipv4)' >> deploy.shelseecho export DOMAINNAME=localhost >> deploy.sh- echo export 'IDENTITY_NETWORK_HOST=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)' >> deploy.sh+ echo export 'EXTERNAL_URL=https://$(curl http://169.254.169.254/latest/meta-data/public-ipv4)' >> deploy.shfiecho export SETUP_ADMIN_PASSWORD=${OpenRemotePassword} >> deploy.shecho export [email protected] >> deploy.sh@@ -152,4 +152,4 @@ Resources:- IpProtocol: icmpFromPort: '8'ToPort: '-1'- CidrIp: 0.0.0.0/0\ No newline at end of file+ CidrIp: 0.0.0.0/0diff --git a/gradle.properties b/gradle.propertiesindex 1f16f2109..cf90a72ca 100644--- a/gradle.properties+++ b/gradle.properties@@ -52,3 +52,4 @@ zwaveVersion = 3.4.0-SNAPSHOThibernateTypesVersion = 2.10.0reflectionsVersion=0.9.12swaggerVersion=2.1.9+jsonSchemaVersion=4.18.0diff --git a/manager/Dockerfile b/manager/Dockerfileindex a22328dd3..2829d0a95 100644--- a/manager/Dockerfile+++ b/manager/Dockerfile@@ -29,16 +29,14 @@ ENV JAVA_TOOL_OPTIONS ${JAVA_TOOL_OPTIONS}ENV TZ ${TZ:-Europe/Amsterdam}ENV SETUP_ADMIN_PASSWORD ${SETUP_ADMIN_PASSWORD:-secret}-ENV IDENTITY_NETWORK_HOST ${IDENTITY_NETWORK_HOST:-localhost}-ENV IDENTITY_NETWORK_SECURE ${IDENTITY_NETWORK_SECURE:-true}-ENV IDENTITY_NETWORK_WEBSERVER_PORT ${IDENTITY_NETWORK_WEBSERVER_PORT:-443}+ENV EXTERNAL_URL ${EXTERNAL_URL:-https://localhost}ENV SETUP_EMAIL_HOST ${SETUP_EMAIL_HOST}ENV SETUP_EMAIL_USER ${SETUP_EMAIL_USER}ENV SETUP_EMAIL_PASSWORD ${SETUP_EMAIL_PASSWORD}ENV SETUP_EMAIL_PORT ${SETUP_EMAIL_PORT:-25}ENV SETUP_EMAIL_TLS ${SETUP_EMAIL_TLS:-true}-ENV SETUP_EMAIL_FROM_KEYCLOAK ${SETUP_EMAIL_FROM_KEYCLOAK:-no-reply@${NETWORK_IDENTITY_HOST:-localhost}}-ENV SETUP_EMAIL_FROM_DEFAULT ${SETUP_EMAIL_FROM_DEFAULT:-no-reply@${NETWORK_IDENTITY_HOST:-localhost}}+ENV SETUP_EMAIL_FROM_KEYCLOAK ${SETUP_EMAIL_FROM_KEYCLOAK:-no-reply@localhost}+ENV SETUP_EMAIL_FROM_DEFAULT ${SETUP_EMAIL_FROM_DEFAULT:-no-reply@localhost}ENV NOTIFICATION_FIREBASE_URL ${NOTIFICATION_FIREBASE_URL:-https://fcm.googleapis.com/fcm/send}ENV NOTIFICATION_FIREBASE_API_KEY ${NOTIFICATION_FIREBASE_API_KEY}ENV FIREBASE_CONFIG_FILE ${FIREBASE_CONFIG_FILE:-/deployment/manager/fcm.json}diff --git a/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java b/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.javaindex 7fccb92cb..9764e4678 100644--- a/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/map/MapResourceImpl.java@@ -42,7 +42,7 @@ public class MapResourceImpl extends WebResource implements MapResource {public ObjectNode getSettings(RequestParams requestParams) {return mapService.getMapSettings(getRequestRealm(),- requestParams.getRequestBaseUri()+ requestParams.getExternalRequestBaseUri());}@@ -50,7 +50,7 @@ public class MapResourceImpl extends WebResource implements MapResource {public ObjectNode getSettingsJs(RequestParams requestParams) {return mapService.getMapSettingsJs(getAuthenticatedRealm(),- requestParams.getRequestBaseUri()+ requestParams.getExternalRequestBaseUri());}diff --git a/manager/src/main/java/org/openremote/manager/syslog/SyslogResourceImpl.java b/manager/src/main/java/org/openremote/manager/syslog/SyslogResourceImpl.javaindex e5ec5f303..1a8dcac52 100644--- a/manager/src/main/java/org/openremote/manager/syslog/SyslogResourceImpl.java+++ b/manager/src/main/java/org/openremote/manager/syslog/SyslogResourceImpl.java@@ -65,7 +65,7 @@ public class SyslogResourceImpl extends WebResource implements SyslogResource {long lastPage = (result.key / perPage) + 1L;Response.ResponseBuilder rb = Response.ok(result.value.toArray(new SyslogEvent[0]));- URI requestBaseUri = requestParams.getRequestBaseUri().build(); // This gives request base from in front of proxy+ URI requestBaseUri = requestParams.getExternalRequestBaseUri().build(); // This gives request base from in front of proxyUriBuilder requestUriBuilder = requestParams.uriInfo.getRequestUriBuilder();requestUriBuilder.scheme(requestBaseUri.getScheme()).host(requestBaseUri.getHost()).port(requestBaseUri.getPort());diff --git a/manager/src/main/java/org/openremote/manager/system/SslHealthStatusProvider.java b/manager/src/main/java/org/openremote/manager/system/SslHealthStatusProvider.javaindex aeb80e9b3..cc5f909f7 100644--- a/manager/src/main/java/org/openremote/manager/system/SslHealthStatusProvider.java+++ b/manager/src/main/java/org/openremote/manager/system/SslHealthStatusProvider.java@@ -26,7 +26,9 @@ import org.openremote.model.system.HealthStatusProvider;import org.openremote.model.value.Values;import javax.net.ssl.*;+import javax.ws.rs.core.UriBuilder;import java.io.IOException;+import java.net.URI;import java.security.cert.CertificateException;import java.security.cert.X509Certificate;import java.time.Instant;@@ -35,12 +37,12 @@ import java.util.logging.Level;import java.util.logging.Logger;import static java.time.temporal.ChronoUnit.DAYS;-import static org.openremote.container.security.keycloak.KeycloakIdentityProvider.*;-import static org.openremote.container.util.MapAccess.getBoolean;-import static org.openremote.container.util.MapAccess.getInteger;+import static org.openremote.container.util.MapAccess.getString;public class SslHealthStatusProvider implements X509TrustManager, HealthStatusProvider, ContainerService {+ public static final String EXTERNAL_URL = "EXTERNAL_URL";+ public static final String EXTERNAL_URL_DEFAULT = "http://localhost";public static final String NAME = "ssl";public static final String VERSION = "1.0";protected static final Logger LOG = Logger.getLogger(SslHealthStatusProvider.class.getName());@@ -56,9 +58,11 @@ public class SslHealthStatusProvider implements X509TrustManager, HealthStatusPr@Overridepublic void init(Container container) throws Exception {- sslEnabled = getBoolean(container.getConfig(), IDENTITY_NETWORK_SECURE, IDENTITY_NETWORK_SECURE_DEFAULT);- hostname = container.getConfig().getOrDefault(IDENTITY_NETWORK_HOST, IDENTITY_NETWORK_HOST_DEFAULT);- port = getInteger(container.getConfig(), IDENTITY_NETWORK_WEBSERVER_PORT, IDENTITY_NETWORK_WEBSERVER_PORT_DEFAULT);+ String externalUrlStr = getString(container.getConfig(), EXTERNAL_URL, EXTERNAL_URL_DEFAULT);+ URI externalURI = UriBuilder.fromUri(externalUrlStr).build();+ sslEnabled = "https".equals(externalURI.getScheme());+ hostname = externalURI.getHost();+ port = externalURI.getPort() > 0 ? externalURI.getPort() : sslEnabled ? 443 : 80;}@Overridediff --git a/model/build.gradle b/model/build.gradleindex 4a3c88ae6..152cb6a77 100644--- a/model/build.gradle+++ b/model/build.gradle@@ -29,6 +29,10 @@ dependencies {compile "com.google.guava:guava:$guavaVersion"compile "io.swagger.core.v3:swagger-annotations:$swaggerVersion"++ compile "com.github.victools:jsonschema-generator:$jsonSchemaVersion"+ compile "com.github.victools:jsonschema-module-jackson:$jsonSchemaVersion"+ compile "com.github.victools:jsonschema-module-javax-validation:$jsonSchemaVersion"}jar {diff --git a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.javaindex 8bef11c7c..b8f4b3747 100644--- a/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java+++ b/model/src/main/java/org/openremote/model/asset/agent/AgentLink.java@@ -112,7 +112,7 @@ public abstract class AgentLink<T extends AgentLink<?>> implements Serializablereturn id;}- @JsonPropertyDescription("Defines {@link ValueFilter}s to apply to an incoming value before it is written to a" ++ @JsonPropertyDescription("Defines ValueFilters to apply to an incoming value before it is written to a" +" protocol linked attribute; this is particularly useful for generic protocols. The message should pass through" +" the filters in array order")public Optional<ValueFilter[]> getValueFilters() {diff --git a/model/src/main/java/org/openremote/model/http/RequestParams.java b/model/src/main/java/org/openremote/model/http/RequestParams.javaindex 228d001eb..f72a20b7e 100644--- a/model/src/main/java/org/openremote/model/http/RequestParams.java+++ b/model/src/main/java/org/openremote/model/http/RequestParams.java@@ -36,9 +36,6 @@ public class RequestParams {@HeaderParam("X-Forwarded-Host")public String forwardedHostHeader;- @HeaderParam("X-Forwarded-Port")- public Integer forwardedPortHeader;-@Contextpublic UriInfo uriInfo;@@ -51,11 +48,22 @@ public class RequestParams {/*** Handles reverse proxying and returns the request base URI*/- public UriBuilder getRequestBaseUri() {+ public UriBuilder getExternalRequestBaseUri() {URI uri = this.uriInfo.getRequestUri();String scheme = TextUtil.isNullOrEmpty(this.forwardedProtoHeader) ? uri.getScheme() : this.forwardedProtoHeader;- int port = this.forwardedPortHeader == null ? uri.getPort() : this.forwardedPortHeader;- String host = TextUtil.isNullOrEmpty(this.forwardedHostHeader) ? uri.getHost() : this.forwardedHostHeader;+ int port = uri.getPort();+ String host = uri.getHost();++ if (this.forwardedHostHeader != null) {+ String[] hostAndPort = this.forwardedHostHeader.split(":");+ if (hostAndPort.length == 1) {+ host = hostAndPort[0];+ } else if (hostAndPort.length == 2) {+ host = hostAndPort[0];+ port = Integer.parseInt(hostAndPort[1]);+ }+ }+return this.uriInfo.getBaseUriBuilder().scheme(scheme).host(host).port(port);}}diff --git a/mvp/aws-cloudformation.template.yml b/mvp/aws-cloudformation.template.ymlindex 9cd1bb443..e2850e021 100644--- a/mvp/aws-cloudformation.template.yml+++ b/mvp/aws-cloudformation.template.yml@@ -132,22 +132,22 @@ Resources:if [ ${HostName} ] && [ ${DomainName} ]thenexport DOMAINNAME=${HostName}.${DomainName}- export IDENTITY_NETWORK_HOST=$DOMAINNAME- echo a $DOMAINNAME $IDENTITY_NETWORK_HOST+ export EXTERNAL_URL=https://$DOMAINNAME+ echo a $DOMAINNAME $EXTERNAL_URLelif [ ${DomainName} ]thenexport DOMAINNAME=${DomainName}- export IDENTITY_NETWORK_HOST=$DOMAINNAME- echo b $DOMAINNAME $IDENTITY_NETWORK_HOST+ export EXTERNAL_URL=https://$DOMAINNAME+ echo b $DOMAINNAME $EXTERNAL_URLelif [ ${HostName} ]thenexport DOMAINNAME=${HostName}- export IDENTITY_NETWORK_HOST=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)- echo c $DOMAINNAME $IDENTITY_NETWORK_HOST+ export EXTERNAL_URL=https://$(curl http://169.254.169.254/latest/meta-data/public-ipv4)+ echo c $DOMAINNAME $EXTERNAL_URLelseexport DOMAINNAME=localhost- export IDENTITY_NETWORK_HOST=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)- echo d $DOMAINNAME $IDENTITY_NETWORK_HOST+ export EXTERNAL_URL=https://$(curl http://169.254.169.254/latest/meta-data/public-ipv4)+ echo d $DOMAINNAME $EXTERNAL_URLfiopenremote-cli -V -texport PASSWORD=${OpenRemotePassword}@@ -162,7 +162,7 @@ Resources:echo export EMAIL_HOST=$EMAIL_HOST >> access.txtecho export PASSWORD=${OpenRemotePassword} >> access.txtecho export DOMAINNAME=$DOMAINNAME >> access.txt- echo export IDENTITY_NETWORK_HOST=$IDENTITY_NETWORK_HOST >> access.txt+ echo export EXTERNAL_URL=$EXTERNAL_URL >> access.txtmkdir ${HostName}cd ${HostName}wget https://github.com/openremote/openremote/raw/master/mvp/fetch_s3_deploy.sh -O fetch.txt@@ -234,4 +234,4 @@ Resources:FromPort: '8'ToPort: '-1'CidrIpv6: ::/0- Description: Ping\ No newline at end of file+ Description: Pingdiff --git a/mvp/mvp-docker-compose.yml b/mvp/mvp-docker-compose.ymlindex a2ef55719..91dec2379 100644--- a/mvp/mvp-docker-compose.yml+++ b/mvp/mvp-docker-compose.yml@@ -28,7 +28,7 @@ volumes:services:proxy:- image: openremote/proxy:${PROXY_VERSION:-2.1.2.2}+ image: openremote/proxy:${PROXY_VERSION:-2.1.2.3}networks:- public- private@@ -84,7 +84,7 @@ services:delay: 10senvironment:SETUP_ADMIN_PASSWORD: ${PASSWORD:-secret}- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}SETUP_EMAIL_HOST: ${EMAIL_HOST:-email-smtp.eu-west-1.amazonaws.com}SETUP_EMAIL_USER: ${EMAIL_USER}SETUP_EMAIL_PASSWORD: ${EMAIL_PASSWORD}@@ -115,7 +115,7 @@ services:- deployment-data:/deploymentenvironment:KEYCLOAK_PASSWORD: ${PASSWORD:-secret}- KEYCLOAK_FRONTEND_URL: "https://${IDENTITY_NETWORK_HOST:-localhost}/auth"+ KEYCLOAK_FRONTEND_URL: "${EXTERNAL_URL:-https://localhost}/auth"postgresql:image: openremote/postgresql:${POSTGRESQL_VERSION:-9.6.21.0}diff --git a/profile/deploy.yml b/profile/deploy.ymlindex 694ac78e8..acda0245d 100644--- a/profile/deploy.yml+++ b/profile/deploy.yml@@ -11,7 +11,8 @@# Here's a list of commonly customised environment variables:## SETUP_ADMIN_PASSWORD-# IDENTITY_NETWORK_HOST+# DOMAINNAME+# EXTERNAL_URL# ADMIN_EMAIL# SETUP_EMAIL_HOST# SETUP_EMAIL_USER@@ -33,7 +34,7 @@ services:# map a Docker volume or host directory to access/store proxy configuration files# and SSL certificates.proxy:- image: openremote/proxy:${PROXY_VERSION:-2.1.2.2}+ image: openremote/proxy:${PROXY_VERSION:-2.1.2.3}restart: always# Override the haproxy.cfg with custom file#volumes:@@ -53,8 +54,8 @@ services:# The public host name of this OpenRemote installation. Set this to request/manage an SSL# certificate with the free https://letsencrypt.org/ provider. The default 'localhost' will- # rely on a baked-in self-signed certificate. If you change this, adjust manager#IDENTITY_NETWORK_HOST.- DOMAINNAME: ${IDENTITY_NETWORK_HOST:-localhost}+ # rely on a baked-in self-signed certificate.+ DOMAINNAME: ${DOMAINNAME:-localhost}# Provide your own email address for your SSL certificates with Let's Encrypt.LE_EMAIL: ${ADMIN_EMAIL:-}@@ -135,16 +136,10 @@ services:# the keycloak identity provider).SETUP_ADMIN_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}- # The public host name of this installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you change proxy#DOMAINNAME, also- # change this to match.- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}-- # Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume https- IDENTITY_NETWORK_SECURE: ${IDENTITY_NETWORK_SECURE:-true}-- # The public port of this OpenRemote installation.- IDENTITY_NETWORK_WEBSERVER_PORT: ${IDENTITY_NETWORK_WEBSERVER_PORT:-443}+ # The public URL of the proxy in front of this manager; must match the proxy#DOMAINNAME (unfortunately+ # docker compose doesn't support chaining environment variables at time of writing, hence the need for+ # two environment variables)+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}# Configure SMTP server, to send password reset emails etc.SETUP_EMAIL_HOST:@@ -291,7 +286,7 @@ services:KEYCLOAK_USER: ${KEYCLOAK_USER:-admin}KEYCLOAK_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}PROXY_ADDRESS_FORWARDING: ${PROXY_ADDRESS_FORWARDING:-true}- KEYCLOAK_FRONTEND_URL: ${KEYCLOAK_FRONTEND_URL:-https://localhost/auth}+ KEYCLOAK_FRONTEND_URL: ${EXTERNAL_URL:-https://localhost}/auth# Custom JVM options (increase heap size if required)JAVA_OPTS: ${KEYCLOAK_JAVA_OPTS:--XX:CompressedClassSpaceSize=50m -XX:MaxMetaspaceSize=250mdiff --git a/profile/dev-proxy.yml b/profile/dev-proxy.ymlindex 6f3c80efe..ce155cc57 100644--- a/profile/dev-proxy.yml+++ b/profile/dev-proxy.yml@@ -7,8 +7,6 @@## - Run the manager in an IDE with the following required environment variables:# WEBSERVER_LISTEN_HOST=0.0.0.0-# IDENTITY_NETWORK_WEBSERVER_PORT=443-# IDENTITY_NETWORK_SECURE=true## Please see deploy.yml for configuration details for each service.#@@ -27,3 +25,35 @@ services:MANAGER_HOST: 'host.docker.internal'KEYCLOAK_HOST: 'host.docker.internal'KEYCLOAK_PORT: 8081+ ports:+ - "80:80" # HTTP for letsencrypt cert generation and in general it redirects to 443 for HTTPS+ - "443:443" # HTTPS /auth directs to keycloak and other paths direct to manager+ - "8883:8883" # MQTTS++ keycloak:+ extends:+ file: deploy.yml+ service: keycloak+ volumes:+ # Map custom themes+ #- ../deployment/keycloak/themes:/deployment/keycloak/themes+ - ./disable-theme-cache.cli:/opt/jboss/startup-scripts/disable-theme-cache.cli+ # Access directly if needed on localhost+ ports:+ - "8081:8080"+ depends_on:+ postgresql:+ condition: service_healthy+ environment:+ # Use manager dev mode reverse proxy to access keycloak so manager and keycloak hosts match+ KEYCLOAK_FRONTEND_URL: ${EXTERNAL_URL:-https://localhost:8443}/auth++ postgresql:+ extends:+ file: deploy.yml+ service: postgresql+ volumes:+ - ./tmp:/tmp+ # Access directly if needed on localhost+ ports:+ - "5432:5432"diff --git a/profile/dev-testing.yml b/profile/dev-testing.ymlindex b45a3dbc9..923e8e855 100644--- a/profile/dev-testing.yml+++ b/profile/dev-testing.yml@@ -24,7 +24,7 @@ services:condition: service_healthyenvironment:# Use manager dev mode reverse proxy to access keycloak so manager and keycloak hosts match- KEYCLOAK_FRONTEND_URL: ${KEYCLOAK_FRONTEND_URL:-http://localhost:8080/auth}+ KEYCLOAK_FRONTEND_URL: ${EXTERNAL_URL:-http://localhost:8080}/authpostgresql:extends:diff --git a/swarm/README.md b/swarm/README.mdindex c0ddd2775..ff1d490db 100644--- a/swarm/README.md+++ b/swarm/README.md@@ -107,7 +107,7 @@ though.```scp swarm/aws-swarm-docker-compose.yml <Manager-Public-IP>:```- deploy docker stack:-```ssh docker@<Manager-Public-IP> IDENTITY_NETWORK_HOST=DNS-enrty docker stack deploy --compose-file aws-swarm-docker-compose.yml aws_demo```+```ssh docker@<Manager-Public-IP> EXTERNAL_URL=DNS-enrty docker stack deploy --compose-file aws-swarm-docker-compose.yml aws_demo```you should see something like this:```diff --git a/swarm/aws-swarm-docker-compose.yml b/swarm/aws-swarm-docker-compose.ymlindex 7fe0827b8..5a068c302 100644--- a/swarm/aws-swarm-docker-compose.yml+++ b/swarm/aws-swarm-docker-compose.yml@@ -72,16 +72,10 @@ services:#SETUP_EMAIL_FROM_KEYCLOAK: '[email protected]'#SETUP_EMAIL_FROM_DEFAULT: '[email protected]'- # The public host name of this OpenRemote installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you change proxy#DOMAINNAME, also- # change this to match.- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}-- # Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume https- IDENTITY_NETWORK_SECURE: 'false'-- # The public port of this OpenRemote installation.- IDENTITY_NETWORK_WEBSERVER_PORT: 8080+ # The public URL of the proxy in front of this manager; must match the proxy#DOMAINNAME (unfortunately+ # docker compose doesn't support chaining environment variables at time of writing, hence the need for+ # two environment variables)+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}# The service-internal host name and port of the identity provider.KEYCLOAK_HOST: keycloakdiff --git a/swarm/k8s.yml b/swarm/k8s.ymlindex acaa55645..85bf4a3a2 100644--- a/swarm/k8s.yml+++ b/swarm/k8s.yml@@ -99,12 +99,8 @@ spec:spec:containers:- env:- - name: IDENTITY_NETWORK_HOST- value: localhost- - name: IDENTITY_NETWORK_SECURE- value: "true"- - name: IDENTITY_NETWORK_WEBSERVER_PORT- value: "443"+ - name: EXTERNAL_URL+ value: https://localhost- name: JAVA_OPTSvalue: -Xms400m -Xmx400m -XX:CompressedClassSpaceSize=25m -XX:MaxMetaspaceSize=150m-XX:InitialCodeCacheSize=50m -XX:ReservedCodeCacheSize=50m -XX:MaxDirectMemorySize=25mdiff --git a/swarm/kube-docker-compose.yml b/swarm/kube-docker-compose.ymlindex be72aea5c..b01ced7e6 100644--- a/swarm/kube-docker-compose.yml+++ b/swarm/kube-docker-compose.yml@@ -102,16 +102,10 @@ services:#SETUP_EMAIL_FROM_KEYCLOAK: '[email protected]'#SETUP_EMAIL_FROM_DEFAULT: '[email protected]'- # The public host name of this OpenRemote installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you change proxy#DOMAINNAME, also- # change this to match.- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}-- # Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume https- IDENTITY_NETWORK_SECURE: 'true'-- # The public port of this OpenRemote installation.- IDENTITY_NETWORK_WEBSERVER_PORT: 443+ # The public URL of the proxy in front of this manager; must match the proxy#DOMAINNAME (unfortunately+ # docker compose doesn't support chaining environment variables at time of writing, hence the need for+ # two environment variables)+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}# The service-internal host name and port of the identity provider.KEYCLOAK_HOST: keycloak@@ -154,7 +148,7 @@ services:DB_PASSWORD: CHANGE_ME_DB_USER_PASSWORDKEYCLOAK_USER: adminPROXY_ADDRESS_FORWARDING: 'true'- KEYCLOAK_FRONTEND_URL: 'https://${IDENTITY_NETWORK_HOST:-localhost}/auth'+ KEYCLOAK_FRONTEND_URL: '${EXTERNAL_URL:-https://localhost}/auth'# CHANGE THIS PASSWORD BEFORE STARTING THE STACK! THIS IS ONLY FOR DEMO!KEYCLOAK_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}diff --git a/swarm/minikube/manager-deployment.yaml b/swarm/minikube/manager-deployment.yamlindex 121dca7fb..0299b08b5 100644--- a/swarm/minikube/manager-deployment.yaml+++ b/swarm/minikube/manager-deployment.yaml@@ -25,12 +25,8 @@ spec:spec:containers:- env:- - name: IDENTITY_NETWORK_HOST- value: localhost- - name: IDENTITY_NETWORK_SECURE- value: "true"- - name: IDENTITY_NETWORK_WEBSERVER_PORT- value: "443"+ - name: EXTERNAL_URL+ value: https://localhost- name: JAVA_OPTSvalue: -Xms400m -Xmx400m -XX:CompressedClassSpaceSize=25m -XX:MaxMetaspaceSize=150m-XX:InitialCodeCacheSize=50m -XX:ReservedCodeCacheSize=50m -XX:MaxDirectMemorySize=25mdiff --git a/swarm/minikube/openremote.yml b/swarm/minikube/openremote.ymlindex 522c4f78c..6dc1c2f8a 100644--- a/swarm/minikube/openremote.yml+++ b/swarm/minikube/openremote.yml@@ -183,12 +183,8 @@ spec:spec:containers:- env:- - name: IDENTITY_NETWORK_HOST- value: localhost- - name: IDENTITY_NETWORK_SECURE- value: "true"- - name: IDENTITY_NETWORK_WEBSERVER_PORT- value: "443"+ - name: EXTERNAL_URL+ value: https://localhost- name: JAVA_OPTSvalue: -Xms400m -Xmx400m -XX:CompressedClassSpaceSize=25m -XX:MaxMetaspaceSize=150m-XX:InitialCodeCacheSize=50m -XX:ReservedCodeCacheSize=50m -XX:MaxDirectMemorySize=25mdiff --git a/swarm/swarm-docker-compose.arm64.yml b/swarm/swarm-docker-compose.arm64.ymlindex 7d5ac1c6f..0decee645 100644--- a/swarm/swarm-docker-compose.arm64.yml+++ b/swarm/swarm-docker-compose.arm64.yml@@ -145,16 +145,10 @@ services:#SETUP_EMAIL_FROM_KEYCLOAK: '[email protected]'#SETUP_EMAIL_FROM_DEFAULT: '[email protected]'- # The public host name of this OpenRemote installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you change proxy#DOMAINNAME, also- # change this to match.- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}-- # Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume https- IDENTITY_NETWORK_SECURE: 'true'-- # The public port of this OpenRemote installation.- IDENTITY_NETWORK_WEBSERVER_PORT: 443+ # The public URL of the proxy in front of this manager; must match the proxy#DOMAINNAME (unfortunately+ # docker compose doesn't support chaining environment variables at time of writing, hence the need for+ # two environment variables)+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}# The service-internal host name and port of the identity provider.KEYCLOAK_HOST: keycloakdiff --git a/swarm/swarm-docker-compose.yml b/swarm/swarm-docker-compose.ymlindex e310ccda0..90656a1f3 100644--- a/swarm/swarm-docker-compose.yml+++ b/swarm/swarm-docker-compose.yml@@ -145,16 +145,10 @@ services:#SETUP_EMAIL_FROM_KEYCLOAK: '[email protected]'#SETUP_EMAIL_FROM_DEFAULT: '[email protected]'- # The public host name of this OpenRemote installation. This name is used in bearer tokens- # and must be the name you access the web services under. If you change proxy#DOMAINNAME, also- # change this to match.- IDENTITY_NETWORK_HOST: ${IDENTITY_NETWORK_HOST:-localhost}-- # Set if SSL is enabled on the frontend reverse proxy and all internal proxies should assume https- IDENTITY_NETWORK_SECURE: 'true'-- # The public port of this OpenRemote installation.- IDENTITY_NETWORK_WEBSERVER_PORT: 443+ # The public URL of the proxy in front of this manager; must match the proxy#DOMAINNAME (unfortunately+ # docker compose doesn't support chaining environment variables at time of writing, hence the need for+ # two environment variables)+ EXTERNAL_URL: ${EXTERNAL_URL:-https://localhost}# The service-internal host name and port of the identity provider.KEYCLOAK_HOST: keycloak@@ -207,7 +201,7 @@ services:# SETUP_ADMIN_PASSWORD: # Allow override on CLI# Configure how Keycloak connects to the database- KEYCLOAK_FRONTEND_URL: 'https://${IDENTITY_NETWORK_HOST:-localhost}/auth'+ KEYCLOAK_FRONTEND_URL: '${EXTERNAL_URL:-https://localhost}/auth'# CHANGE THIS PASSWORD BEFORE STARTING THE STACK! THIS IS ONLY FOR DEMO!KEYCLOAK_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}diff --git a/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy b/test/src/main/groovy/org/openremote/test/ContainerTrait.groovyindex d214d9eb3..1f0e3a081 100644--- a/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy+++ b/test/src/main/groovy/org/openremote/test/ContainerTrait.groovy@@ -67,7 +67,6 @@ import java.util.stream.Collectorsimport java.util.stream.IntStreamimport static java.util.concurrent.TimeUnit.SECONDS-import static org.openremote.container.security.keycloak.KeycloakIdentityProvider.IDENTITY_NETWORK_WEBSERVER_PORTimport static org.openremote.container.web.WebService.WEBSERVER_LISTEN_PORTtrait ContainerTrait {@@ -89,7 +88,7 @@ trait ContainerTrait {if (currentConfig.size() == config.size()) {configsMatch = currentConfig.entrySet().stream().allMatch{entry ->// ignore webserver port config- if (entry.key == WEBSERVER_LISTEN_PORT || entry.key == IDENTITY_NETWORK_WEBSERVER_PORT) {+ if (entry.key == WEBSERVER_LISTEN_PORT) {return true}entry.value == config.get(entry.key)diff --git a/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy b/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovyindex a7966b198..53d549190 100644--- a/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy+++ b/test/src/main/groovy/org/openremote/test/ManagerContainerTrait.groovy@@ -12,8 +12,6 @@ import spock.util.concurrent.PollingConditionsimport java.util.concurrent.TimeUnitimport java.util.stream.Collectors-import static org.openremote.container.security.keycloak.KeycloakIdentityProvider.IDENTITY_NETWORK_HOST-import static org.openremote.container.security.keycloak.KeycloakIdentityProvider.IDENTITY_NETWORK_WEBSERVER_PORTimport static org.openremote.container.timer.TimerService.Clock.PSEUDOimport static org.openremote.container.timer.TimerService.Clock.REALimport static org.openremote.container.timer.TimerService.TIMER_CLOCK_TYPE@@ -29,8 +27,6 @@ trait ManagerContainerTrait extends ContainerTrait {}[(WEBSERVER_LISTEN_PORT) : Integer.toString(serverPort),- (IDENTITY_NETWORK_HOST) : "127.0.0.1",- (IDENTITY_NETWORK_WEBSERVER_PORT): "8081",(SETUP_CREATE_ASSETS) : "true",(SETUP_CREATE_USERS) : "true",(SETUP_CREATE_RULES) : "false",