Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

MVP tuning

Michal Rutkacbaca5df0470
diff --git a/mvp/aws-cloudformation.template.yml b/mvp/aws-cloudformation.template.yml
index 1d2b7b17a..0abf29502 100644
--- a/mvp/aws-cloudformation.template.yml
+++ b/mvp/aws-cloudformation.template.yml
@@ -88,7 +88,7 @@ Resources:
# Create volume for deployment (needed for SWARM due to concurency in compose-file)
docker volume create openremote_deployment-data
docker run --rm -v openremote_deployment-data:/deployment openremote/deployment:latest
- wget https://github.com/openremote/openremote/raw/master/mvp/swarm-docker-compose.yml
+ wget https://github.com/openremote/openremote/raw/master/mvp/mvp-docker-compose.yml
docker swarm init
if [ ${HostName} ] && [ ${DomainName} ]
then
@@ -111,7 +111,7 @@ Resources:
echo d $DOMAINNAME $IDENTITY_NETWORK_HOST
fi
export SETUP_ADMIN_PASSWORD=${OpenRemotePassword}
- docker-compose -f swarm-docker-compose.yml -p openremote up -d
+ docker-compose -f mvp-docker-compose.yml -p openremote up -d
InstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
diff --git a/mvp/mvp-docker-compose.yml b/mvp/mvp-docker-compose.yml
new file mode 100644
index 000000000..86f272744
--- /dev/null
+++ b/mvp/mvp-docker-compose.yml
@@ -0,0 +1,328 @@
+# OpenRemote v3
+#
+# By default running this profile installs the stack in swarm on https://localhost using a
+# self-signed SSL certificate, with username 'admin' and password 'secret'.
+#
+# Install Docker Community edition (https://docker.com/) on Windows, macOS, or Linux.
+#
+# Start a demo stack in the project root directory with:
+#
+# dosker swarm init
+# docker pull openremote/deployment
+# docker-compose -p demo up -d --no-build deployment
+# docker stack deploy --compose-file swarm-docker-compose.yml demo
+#
+# Stop the stack:
+#
+# docker stack rm demo
+#
+# For full documentation, see profile/deploy.yml
+#
+# For swarm (production) use version 3, for developement use version 2
+version: '3.7'
+
+networks:
+ public:
+ driver: overlay
+ driver_opts:
+ encrypted: 'true'
+ private:
+ driver: overlay
+ driver_opts:
+ encrypted: 'true'
+ attachable: false
+
+# If you enable volume mappings in services, you need this. Otherwise, remove the volumes
+volumes:
+ proxy-data:
+ deployment-data:
+ postgresql-data:
+
+services:
+
+ proxy:
+
+ image: openremote/proxy:${DATE_TAG:-latest}
+ networks:
+ - public
+ - private
+ depends_on:
+ - manager
+ healthcheck:
+ interval: 3s
+ timeout: 3s
+ start_period: 2s
+ retries: 30
+ test: ["CMD", "curl", "--fail", "--silent", "http://localhost:80"]
+ environment:
+ TZ: Europe/Amsterdam
+ DOMAINNAME: ${DOMAINNAME:-localhost}
+ LE_EMAIL: ${LE_EMAIL:[email protected]}
+
+ # Enable --staging will manage fake certificates, so avoid hitting the rate limits of Let's Encrypt
+ # when testing (this is important, you are limited to 5 duplicate certificates per week!)
+ # LE_EXTRA_ARGS: '--staging --logs-dir=/etc/letsencrypt'
+
+ # Traffic should be forwarded to this service (defaults to manager:8080)
+ # PROXY_BACKEND_HOST: manager
+ # PROXY_BACKEND_PORT: 8080
+
+ # The proxy supports up to 10 custom redirects from hostname to any path on the
+ # backend service. This can be used to give consoles a vanity domain name.
+ # PROXY_HOST_REDIRECT_1_NAME: www.my-console-master.tld
+ # PROXY_HOST_REDIRECT_1_TARGET: /console/master
+ # PROXY_HOST_REDIRECT_2_NAME: www.my-console-tenant-a.tld
+ # PROXY_HOST_REDIRECT_2_TARGET: /console/building
+ # PROXY_HOST_REDIRECT_3_NAME: ...
+
+ # Customize proxy log, defaults to 'notice', requests are logged at 'info'.
+ # Available levels are: emerg, alert, crit, err, warning, notice, info, debug
+ # PROXY_LOGLEVEL: 'notice'
+
+ # Run proxy, obtain and automatically renew SSL certificates if DOMAINNAME is not localhost. Use
+ # the command 'help' to get a list of all options.
+ command: run
+
+ # Expose a public web service mapped to ports on the host.
+ ports:
+ - "80:80"
+ - "443:443"
+
+ volumes:
+ - proxy-data:/deployment
+ # Override the haproxy.cfg with custom file
+ # -${MY_PROXY_CONFIG_FILE}:/etc/haproxy/haproxy.cfg
+
+ deploy:
+ replicas: 1
+ restart_policy:
+ # Have a chance to look inside log before restarts to prevent hitting
+ # letsencrypt limit of number issued certificates per week, which is 5
+ delay: 10s
+ window: 30s
+ # Configure uninterrupted updates with rollback
+ update_config:
+ failure_action: rollback
+ order: start-first
+ delay: 30m
+
+ # This configuration uses the manager's deployment-specific data such as map tiles,
+ # console application static resources (HTML, JS, CSS), extensions, and other
+ # configuration files which were baked into the managers image.
+ manager:
+
+ image: openremote/manager:${DATE_TAG:-latest}
+ networks:
+ - private
+ depends_on:
+ - keycloak
+ healthcheck:
+ interval: 3s
+ timeout: 3s
+ start_period: 2s
+ retries: 120
+ test: ["CMD", "curl", "--fail", "--silent", "http://localhost:8080"]
+ environment:
+
+ # It is important that all services have the same timezone and are time synchronized.
+ # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
+ TZ: Europe/Amsterdam
+
+ # If developer mode is enabled, all setup tasks will be executed on application startup.
+ # 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: ${DEV_MODE:-false}
+
+ # This switch can wipe your database, this is the factory reset!
+ SETUP_WIPE_CLEAN_INSTALL: ${SETUP_WIPE_CLEAN_INSTALL:-true}
+ SETUP_ADMIN_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}
+
+ # When you are ready to permanently install your project, replace it with the next lines...
+ # SETUP_WIPE_CLEAN_INSTALL: # Allow override on CLI
+
+ # Configure SMTP smart host, to send password reset emails etc.
+ #SETUP_EMAIL_HOST: smtp-host.demo.tld
+ #SETUP_EMAIL_USER: 'smtp-user'
+ #SETUP_EMAIL_PASSWORD: 'smtp-password'
+ #SETUP_EMAIL_PORT: 25
+ #SETUP_EMAIL_TLS: 'true'
+ #SETUP_EMAIL_FROM_KEYCLOAK: '[email protected]'
+ #SETUP_EMAIL_FROM_DEFAULT: '[email protected]'
+
+ # Other demo data can be imported as needed, these examples only use the simulator protocol.
+ 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:
+ #
+ # - KNX IP gateway
+ # - Velbus IP gateway or serial bridge
+ #
+ SETUP_IMPORT_DEMO_AGENT: 'true'
+ SETUP_IMPORT_DEMO_AGENT_KNX: 'false'
+ # SETUP_IMPORT_DEMO_AGENT_KNX_GATEWAY_IP: '10.0.0.11'
+ # SETUP_IMPORT_DEMO_AGENT_KNX_LOCAL_IP: '10.0.0.12'
+ SETUP_IMPORT_DEMO_AGENT_VELBUS: 'false'
+ # SETUP_IMPORT_DEMO_AGENT_VELBUS_COM_PORT: 'COM3'
+ # TODO: Additional docker settings are necessary to use com ports and multicast from within containers
+
+ # 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 service-internal JDBC connection URL for the database service.
+ DATABASE_CONNECTION_URL: jdbc:postgresql://postgresql/openremote
+
+ # The database connection settings, passwords should be changed in production!
+ DATABASE_USERNAME: openremote
+ DATABASE_PASSWORD: CHANGE_ME_DB_USER_PASSWORD
+ DATABASE_MIN_POOL_SIZE: 5
+ DATABASE_MAX_POOL_SIZE: 20
+ DATABASE_CONNECTION_TIMEOUT_SECONDS: 300
+
+ # The service-internal host name and port of the identity provider.
+ KEYCLOAK_HOST: keycloak
+ KEYCLOAK_PORT: 8080
+ MASTER_REALM_KEYCLOAK_THEME: ${MASTER_REALM_KEYCLOAK_THEME:-openremote}
+
+ # The service-internal webservice interface binding, bind to all interfaces
+ # when running in container. Default is 127.0.0.1.
+ WEBSERVER_LISTEN_HOST: 0.0.0.0
+
+ ROOT_REDIRECT_PATH: ${ROOT_REDIRECT_PATH:-/manager}
+
+ JAVA_OPTS: '-Xms400m -Xmx400m
+ -XX:CompressedClassSpaceSize=25m -XX:MaxMetaspaceSize=150m
+ -XX:InitialCodeCacheSize=50m -XX:ReservedCodeCacheSize=50m
+ -XX:MaxDirectMemorySize=25m
+ -XX:NativeMemoryTracking=summary
+ -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/javadump.core.hprof'
+
+ volumes:
+ - deployment-data:/deployment
+
+ deploy:
+ replicas: 1
+ # Configure uninterrupted updates with rollback
+ update_config:
+ failure_action: rollback
+ order: start-first
+ delay: 10s
+
+ keycloak:
+
+ # Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`
+ image: openremote/keycloak:${DATE_TAG:-latest}
+ networks:
+ - public
+ - private
+ depends_on:
+ - postgresql
+ healthcheck:
+ test: ["CMD", "curl", "--fail", "--silent", "http://localhost:8080/auth"]
+ interval: 3s
+ timeout: 3s
+ # This was 600s in the Dockerfile, but that seems way too long.
+ start_period: 60s
+ retries: 30
+ environment:
+
+ # It is important that all services have the same timezone and are time synchronized.
+ # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
+ TZ: Europe/Amsterdam
+
+ # Switch to DEBUG to diagnose Keycloak problems.
+ KEYCLOAK_LOGLEVEL: INFO
+
+ # When you are ready to permanently install your project, replace it with the next line ...
+ # SETUP_ADMIN_PASSWORD: # Allow override on CLI
+
+ # Configure how Keycloak connects to the database
+ DB_VENDOR: postgres
+ DB_ADDR: postgresql
+ DB_PORT: 5432
+ DB_DATABASE: openremote
+ DB_USER: openremote
+ DB_SCHEMA: public
+ DB_PASSWORD: CHANGE_ME_DB_USER_PASSWORD
+ KEYCLOAK_USER: admin
+ PROXY_ADDRESS_FORWARDING: 'true'
+
+ # CHANGE THIS PASSWORD BEFORE STARTING THE STACK! THIS IS ONLY FOR DEMO!
+ KEYCLOAK_PASSWORD: ${SETUP_ADMIN_PASSWORD:-secret}
+
+ # Custom JVM options (increase heap size if required)
+ JAVA_OPTS: '-Xms300m -Xmx300m
+ -XX:CompressedClassSpaceSize=50m -XX:MaxMetaspaceSize=250m
+ -XX:InitialCodeCacheSize=50m -XX:ReservedCodeCacheSize=50m
+ -XX:MaxDirectMemorySize=25m
+ -XX:NativeMemoryTracking=summary
+ -XX:+ExitOnOutOfMemoryError
+ -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/javadump.core.hprof
+ -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true'
+
+ ports:
+ - "8081:8080"
+
+ volumes:
+ - deployment-data:/deployment
+
+ deploy:
+ replicas: 1
+ # Configure uninterrupted updates with rollback
+ update_config:
+ failure_action: rollback
+ order: start-first
+ delay: 10m
+
+ # 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.
+ # Alternatively, you can store postgresql data in a directory on your host.
+ postgresql:
+ # Image will be pulled when using the `docker-compose pull` command or `docker-compose up --no-build`
+ image: openremote/postgresql:${DATE_TAG:-latest}
+ networks:
+ - private
+ healthcheck:
+ interval: 3s
+ timeout: 3s
+ start_period: 2s
+ retries: 30
+ test: ["CMD", "gosu", "postgres", "pg_isready"]
+ environment:
+
+ # It is important that all services have the same timezone and are time synchronized.
+ # Bearer tokens are only valid for minutes, and authentication fails if Keycloak drifts.
+ TZ: Europe/Amsterdam
+
+ # Create database and user if there is no data. For production, run
+ # this once with your volume mapping for the data directory (see docker-compose.yml),
+ # then remove the variables and restart to preserve the stored data. It
+ # doesn't hurt if you don't remove it, an existing will never be reconfigured.
+ POSTGRES_DB: openremote
+ POSTGRES_USER: openremote
+ POSTGRES_PASSWORD: CHANGE_ME_DB_USER_PASSWORD
+
+ # You can open an SQL console on a running container with:
+ # docker exec -it <container ID> psql -U openremote
+
+ volumes:
+ - postgresql-data:/var/lib/postgresql/data
+
+ deploy:
+ replicas: 1
+ # Configure uninterrupted updates with rollback
+ update_config:
+ failure_action: rollback
+ order: start-first
+ delay: 20m
+
diff --git a/mvp/swarm-docker-compose.yml b/swarm/swarm-docker-compose.yml
similarity index 100%
rename from mvp/swarm-docker-compose.yml
rename to swarm/swarm-docker-compose.yml