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
Changed SETUP_WIPE_CLEAN_INSTALL to SETUP_CLEAN_ON_RESTART
Rich Turner3cdd3b64c55c
diff --git a/.ci_cd/aws/smtp_credentials_generate.py b/.ci_cd/aws/smtp_credentials_generate.pynew file mode 100644index 000000000..173fdb14a--- /dev/null+++ b/.ci_cd/aws/smtp_credentials_generate.py@@ -0,0 +1,65 @@+#!/usr/bin/env python3++import hmac+import hashlib+import base64+import argparse++SMTP_REGIONS = [+ 'us-east-2', # US East (Ohio)+ 'us-east-1', # US East (N. Virginia)+ 'us-west-2', # US West (Oregon)+ 'ap-south-1', # Asia Pacific (Mumbai)+ 'ap-northeast-2', # Asia Pacific (Seoul)+ 'ap-southeast-1', # Asia Pacific (Singapore)+ 'ap-southeast-2', # Asia Pacific (Sydney)+ 'ap-northeast-1', # Asia Pacific (Tokyo)+ 'ca-central-1', # Canada (Central)+ 'eu-central-1', # Europe (Frankfurt)+ 'eu-west-1', # Europe (Ireland)+ 'eu-west-2', # Europe (London)+ 'sa-east-1', # South America (Sao Paulo)+ 'us-gov-west-1', # AWS GovCloud (US)+]++# These values are required to calculate the signature. Do not change them.+DATE = "11111111"+SERVICE = "ses"+MESSAGE = "SendRawEmail"+TERMINAL = "aws4_request"+VERSION = 0x04+++def sign(key, msg):+ return hmac.new(key, msg.encode('utf-8'), hashlib.sha256).digest()+++def calculate_key(secret_access_key, region):+ if region not in SMTP_REGIONS:+ raise ValueError(f"The {region} Region doesn't have an SMTP endpoint.")++ signature = sign(("AWS4" + secret_access_key).encode('utf-8'), DATE)+ signature = sign(signature, region)+ signature = sign(signature, SERVICE)+ signature = sign(signature, TERMINAL)+ signature = sign(signature, MESSAGE)+ signature_and_version = bytes([VERSION]) + signature+ smtp_password = base64.b64encode(signature_and_version)+ return smtp_password.decode('utf-8')+++def main():+ parser = argparse.ArgumentParser(+ description='Convert a Secret Access Key for an IAM user to an SMTP password.')+ parser.add_argument(+ 'secret', help='The Secret Access Key to convert.')+ parser.add_argument(+ 'region',+ help='The AWS Region where the SMTP password will be used.',+ choices=SMTP_REGIONS)+ args = parser.parse_args()+ print(calculate_key(args.secret, args.region))+++if __name__ == '__main__':+ main()diff --git a/.ci_cd/env/.env b/.ci_cd/env/.envindex 7f4bb69fd..823c13935 100644--- a/.ci_cd/env/.env+++ b/.ci_cd/env/.env@@ -1,3 +1,3 @@CLEAN_INSTALL=true-SETUP_WIPE_CLEAN_INSTALL=true+SETUP_CLEAN_ON_RESTART=trueENV_COMPOSE_FILE=profile/demo.ymldiff --git a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java b/container/src/main/java/org/openremote/container/persistence/PersistenceService.javaindex 1a94fef5f..b43f7a0e7 100644--- a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java+++ b/container/src/main/java/org/openremote/container/persistence/PersistenceService.java@@ -197,7 +197,7 @@ public class PersistenceService implements ContainerService, Consumer<Persistenc* database artifacts from wipe/migrate in FlywayDB...) you must have it in the 'public'* schema. Hence we need a different schema here.*/- public static final String SETUP_WIPE_CLEAN_INSTALL = "SETUP_WIPE_CLEAN_INSTALL";+ public static final String SETUP_CLEAN_ON_RESTART = "SETUP_CLEAN_ON_RESTART";public static final String PERSISTENCE_UNIT_NAME = "PERSISTENCE_UNIT_NAME";public static final String PERSISTENCE_UNIT_NAME_DEFAULT = "OpenRemotePU";public static final String DB_VENDOR = "DB_VENDOR";@@ -285,7 +285,7 @@ public class PersistenceService implements ContainerService, Consumer<PersistencpersistenceUnitName = getString(container.getConfig(), PERSISTENCE_UNIT_NAME, PERSISTENCE_UNIT_NAME_DEFAULT);- forceClean = getBoolean(container.getConfig(), SETUP_WIPE_CLEAN_INSTALL, container.isDevMode());+ forceClean = getBoolean(container.getConfig(), SETUP_CLEAN_ON_RESTART, container.isDevMode());openDatabase(container, database, dbUsername, dbPassword, connectionUrl);prepareSchema(connectionUrl, dbUsername, dbPassword, dbSchema);diff --git a/docker-compose.yml b/docker-compose.ymlindex 2a9be0479..466f6e783 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -70,7 +70,7 @@ services:# Set this variable `demo` to auto provision demo assets etc.SETUP_TYPE:SETUP_ADMIN_PASSWORD:- SETUP_WIPE_CLEAN_INSTALL:+ SETUP_CLEAN_ON_RESTART:SETUP_EMAIL_HOST:SETUP_EMAIL_USER:SETUP_EMAIL_PASSWORD:diff --git a/manager/Dockerfile b/manager/Dockerfileindex 5ce9dae84..0df4bbb04 100644--- a/manager/Dockerfile+++ b/manager/Dockerfile@@ -23,7 +23,7 @@ ENV NOTIFICATION_FIREBASE_URL ${NOTIFICATION_FIREBASE_URL:-https://fcm.googleapiENV NOTIFICATION_FIREBASE_API_KEY ${NOTIFICATION_FIREBASE_API_KEY}ENV FIREBASE_CONFIG_FILE ${FIREBASE_CONFIG_FILE:-/deployment/manager/fcm.json}ENV DEV_MODE ${DEV_MODE:-false}-ENV SETUP_WIPE_CLEAN_INSTALL ${SETUP_WIPE_CLEAN_INSTALL:-false}+ENV SETUP_CLEAN_ON_RESTART ${SETUP_CLEAN_ON_RESTART:-false}ENV WEBSERVER_LISTEN_HOST ${WEBSERVER_LISTEN_HOST:-0.0.0.0}ENV DB_VENDOR ${DB_VENDOR:-postgres}ENV DB_HOST ${DB_HOST:-postgresql}diff --git a/profile/demo.yml b/profile/demo.ymlindex 39bc43084..45162c5ae 100644--- a/profile/demo.yml+++ b/profile/demo.yml@@ -74,7 +74,7 @@ services:# Set this variable `demo` to auto provision demo assets etc.SETUP_TYPE:SETUP_ADMIN_PASSWORD:- SETUP_WIPE_CLEAN_INSTALL:+ SETUP_CLEAN_ON_RESTART:SETUP_EMAIL_HOST:SETUP_EMAIL_USER:SETUP_EMAIL_PASSWORD:diff --git a/profile/deploy.yml b/profile/deploy.ymlindex 49e2d1561..8d3fda574 100644--- a/profile/deploy.yml+++ b/profile/deploy.yml@@ -174,7 +174,7 @@ services:# !! WARNING: This will wipe your database !!# Force a full clean and setup on startup irrespective of whether there is existing data# Default behaviour is false unless DEV_MODE = true or openremote database doesn't already exist- SETUP_WIPE_CLEAN_INSTALL: ${SETUP_WIPE_CLEAN_INSTALL:-false}+ SETUP_CLEAN_ON_RESTART: ${SETUP_CLEAN_ON_RESTART:-false}# Manager web server interface binding; default:WEBSERVER_LISTEN_HOST: ${WEBSERVER_LISTEN_HOST:-0.0.0.0}diff --git a/profile/dev-ui.yml b/profile/dev-ui.ymlindex ed042a4e7..51a622128 100644--- a/profile/dev-ui.yml+++ b/profile/dev-ui.yml@@ -49,7 +49,7 @@ services:volumes:- temp-data:/tmpenvironment:- SETUP_WIPE_CLEAN_INSTALL: "true"+ SETUP_CLEAN_ON_RESTART: "true"EXTERNAL_URL: http://${HOST:-localhost:8080}DEV_MODE: "true"ports: