Hey there,
I’m trying to extend the OpenRemote project for a custom project.
Naturally, the first step is to have a running local environment as I’ll be modifying both the backend and frontend.
I’ve followed the steps (to the best of my knowledge) detailed in the following guides:
Preparing the environment
Installing and using Docker
Setting up an IDE
Currently, I’m attempting to run the dev-proxy.yml profile and running the manager through my IDE.
The project builds without errors and the console prints that Webserver is available on 0.0.0.0:8080 as noted in the documentation. However, when I try to access it, I get a “Not Found” page.
I’m not sure if this is a port problem or what, I’m relatively new to Docker so I haven’t yet fully grasped the entire configuration.
It’s worth mentioning that if I build my containers using an adjust deploy.yml file which builds the manager from my local “build” directory instead of pulling an image, it works properly, but if I try doing the same from my IDE it doesn’t.
Note: I tried working on a fresh clone of the Openremote repo but for some reason my IDE was producing errors for the Main.java file, so I’m working on an older copy I had (which I’ve adjusted slightly).
I’ll attach a copy of my run configuration, build settings, and profile.
runtime-log
deploy.yml
# OpenRemote v3
#
# This is the base configuration profile. Note that you must extend this configuration to complete
# it with service dependencies and volume mappings, see docker-compose.yml for a usable complete
# configuration.
#
# This file contains a description of all the environment variables available for each service
# including their default values. These can be overridden in many ways, shell environment variable,
# env file, extending/merging this compose file, etc.
#
# Here's a list of commonly customised environment variables:
#
# SETUP_ADMIN_PASSWORD
# IDENTITY_NETWORK_HOST
# ADMIN_EMAIL
# SETUP_EMAIL_HOST
# SETUP_EMAIL_USER
# SETUP_EMAIL_PASSWORD
# SETUP_EMAIL_FROM_KEYCLOAK
# SETUP_EMAIL_FROM_DEFAULT
# NOTIFICATION_FIREBASE_API_KEY
# IDENTITY_PROVIDER
#
version: '2.4'
# If you enable volume mappings in services, you need this. Otherwise, remove the volumes
volumes:
postgresql-data:
deployment-data:
services:
# Reverse proxy which uses self signed certificate when DOMAINNAME=localhost. You can
# 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}
restart: always
# Override the haproxy.cfg with custom file
#volumes:
# -${MY_PROXY_CONFIG_FILE}:/etc/haproxy/haproxy.cfg
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: ${TZ:-Africa/Cairo}
# File to which std out will be logged
LOGFILE: ${PROXY_LOGFILE:-/var/log/proxy.log}
# Customize proxy log, defaults to 'notice', requests are logged at 'info'.
# Available levels are: emerg, alert, crit, err, warning, notice, info, debug
PROXY_LOGLEVEL: ${PROXY_LOGLEVEL:-notice}
# 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}
# Provide your own email address for your SSL certificates with Let's Encrypt.
LE_EMAIL: ${ADMIN_EMAIL:-}
# 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!)
# e.g. '--staging --logs-dir=/etc/letsencrypt'
LE_EXTRA_ARGS: ${PROXY_EXTRA_ARGS:-}
# The proxy supports up to 10 custom redirects from hostname to any path on the
# manager service.
# e.g. PROXY_HOST_REDIRECT_1_NAME: www.my-console-master.tld
# PROXY_HOST_REDIRECT_1_TARGET: /console/master
PROXY_HOST_REDIRECT_1_NAME:
PROXY_HOST_REDIRECT_1_TARGET:
PROXY_HOST_REDIRECT_2_NAME:
PROXY_HOST_REDIRECT_2_TARGET:
PROXY_HOST_REDIRECT_3_NAME:
PROXY_HOST_REDIRECT_3_TARGET:
PROXY_HOST_REDIRECT_4_NAME:
PROXY_HOST_REDIRECT_4_TARGET:
PROXY_HOST_REDIRECT_5_NAME:
PROXY_HOST_REDIRECT_5_TARGET:
PROXY_HOST_REDIRECT_6_NAME:
PROXY_HOST_REDIRECT_6_TARGET:
PROXY_HOST_REDIRECT_7_NAME:
PROXY_HOST_REDIRECT_7_TARGET:
PROXY_HOST_REDIRECT_8_NAME:
PROXY_HOST_REDIRECT_8_TARGET:
PROXY_HOST_REDIRECT_9_NAME:
PROXY_HOST_REDIRECT_9_TARGET:
PROXY_HOST_REDIRECT_10_NAME:
PROXY_HOST_REDIRECT_10_TARGET:
# Expose public services (web server, MQTT broker)
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
#- "5433:5432" # Postgres
# The OpenRemote Manager
manager:
#image: openremote/manager:${MANAGER_VERSION:-latest}
build: '../manager/build/install/manager'
restart: always
# Map any custom content into the /deployment dir:
# /deployment/manager/app - contains custom web content
# /deployment/manager/extensions - contains JARS to be loaded on the classpath
# /deployment/manager/provisioning - contains JSON files for provisioning the system
# /deployment/map/mapdata.mbtiles - map tile data
# /deployment/map/mapsettings.json - map styling
volumes:
#- deployment-data:/deployment
- ../deployment:/deployment
#- ../manager/build/install/manager:/deployment/manager/app
#- ../deployment/build:/deployment/manager/app
#- ../deployment:/deployment/manager/app
#- ../deployment/build:/deployment
# Expose any devices required by agents
#devices:
# - /dev/ttyACM0
#ports:
# - "8000:8000" # Remote debugging port - NOT FOR PRODUCTION USE!!!
# - "8080:8080" # Web server port
logging:
options:
# Use very little logging for container STDOUT, this is
# quick to view and download with Docker remote client
# and `docker logs -f`. If you want to tail the whole
# and larger, rotated file log, use instead:
#
# docker exec -it openremote_manager_1 tail -f /deployment/openremote.log.0
#
max-size: "1m"
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: ${TZ:-Africa/Cairo}
# The password for the super user (admin) of the master realm (must match keycloak password if using
# 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}
# Configure SMTP server, to send password reset emails etc.
SETUP_EMAIL_HOST:
SETUP_EMAIL_USER:
SETUP_EMAIL_PASSWORD:
SETUP_EMAIL_PORT: ${SETUP_EMAIL_PORT:-25}
SETUP_EMAIL_TLS: ${SETUP_EMAIL_TLS:-true}
SETUP_EMAIL_FROM_KEYCLOAK: ${SETUP_EMAIL_FROM_KEYCLOAK:-no-reply@localhost}
SETUP_EMAIL_FROM_DEFAULT: ${SETUP_EMAIL_FROM_DEFAULT:-no-reply@localhost}
# Console applications can register for push notifications through FCM.
NOTIFICATION_FIREBASE_URL: ${NOTIFICATION_FIREBASE_URL:-https://fcm.googleapis.com/fcm/send}
NOTIFICATION_FIREBASE_API_KEY:
FIREBASE_CONFIG_FILE: ${FIREBASE_CONFIG_FILE:-/deployment/manager/fcm.json}
# Developer mode (see code for usages of DEV_MODE flag)
DEV_MODE: ${DEV_MODE:-false}
# !! 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}
# Manager web server interface binding; default:
WEBSERVER_LISTEN_HOST: ${WEBSERVER_LISTEN_HOST:-0.0.0.0}
# Database settings
DB_VENDOR: ${DB_VENDOR:-postgres}
DB_HOST: ${DB_HOST:-postgresql}
DB_PORT: ${DB_PORT:-5432}
DB_NAME: ${DB_NAME:-openremote}
DB_SCHEMA: ${DB_SCHEMA:-openremote}
DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
DB_MIN_POOL_SIZE: ${DB_MIN_POOL_SIZE:-5}
DB_MAX_POOL_SIZE: ${DB_MAX_POOL_SIZE:-20}
DB_CONNECTION_TIMEOUT_SECONDS: ${DB_CONNECTION_TIMEOUT_SECONDS:-300}
# The service-internal host name and port of the keycloak identity provider; defaults:
KEYCLOAK_HOST: ${KEYCLOAK_HOST:-keycloak}
KEYCLOAK_PORT: ${KEYCLOAK_PORT:-8080}
# Location of built in web content.
APP_DOCROOT: ${APP_DOCROOT:-/opt/web}
# Location of the custom web content.
CUSTOM_APP_DOCROOT: ${CUSTOM_APP_DOCROOT:-/deployment/manager/app}
# Location for the provisioning files
PROVISIONING_DOCROOT: ${PROVISIONING_DOCROOT:-/deployment/manager/provisioning}
# Redirect path when root URI is requested
ROOT_REDIRECT_PATH: ${ROOT_REDIRECT_PATH:-/manager}
MAP_TILES_PATH: ${MAP_TILES_PATH:-/deployment/map/mapdata.mbtiles}
MAP_SETTINGS_PATH: ${MAP_SETTINGS_PATH:-/deployment/map/mapsettings.json}
MAP_TILESERVER_HOST:
MAP_TILESERVER_PORT: ${MAP_TILESERVER_PORT:-8082}
MAP_TILESERVER_REQUEST_TIMEOUT: ${MAP_TILESERVER_REQUEST_TIMEOUT:-10000}
# Override logging.properties with a file of your choice; if not set then defaults
# to embedded logging.properties or logging-dev.properties (if DEV_MODE=true)
LOGGING_CONFIG_FILE:
SCHEDULED_TASKS_THREADS_MAX: ${SCHEDULED_TASKS_THREADS_MAX:-4}
RULE_EVENT_EXPIRES: ${RULE_EVENT_EXPIRES:-1h}
IDENTITY_PROVIDER: ${IDENTITY_PROVIDER:-keycloak}
IDENTITY_SESSION_MAX_MINUTES: ${IDENTITY_SESSION_MAX_MINUTES:-1440}
IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES: ${IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES:-2628000}
MANAGER_JAVA_OPTS: ${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}
# Keycloak identity provider
keycloak:
image: openremote/keycloak:${KEYCLOAK_VERSION:-12.0.1.1}
restart: always
environment:
TZ: ${TZ:-Africa/Cairo}
KEYCLOAK_LOGLEVEL: ${KEYCLOAK_LOGLEVEL:-INFO}
DB_VENDOR: ${DB_VENDOR:-postgres}
DB_ADDR: ${DB_HOST:-postgresql}
DB_PORT: ${DB_PORT:-5432}
DB_DATABASE: ${DB_NAME:-openremote}
DB_USER: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
DB_SCHEMA: ${DB_SCHEMA:-public}
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}
JAVA_OPTS: ${KEYCLOAK_JAVA_OPTS:--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}
# PostgreSQL DBMS
postgresql:
image: openremote/postgresql:${POSTGRESQL_VERSION:-9.6.21.0}
restart: always
volumes:
- postgresql-data:/var/lib/postgresql/data
environment:
TZ: ${TZ:-Africa/Cairo}
PGTZ: ${PGTZ:-Africa/Cairo}
POSTGRES_DB: ${DB_NAME:-openremote}
POSTGRES_USER: ${DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
dev-proxy.yml
# OpenRemote v3
#
# Profile for running the reverse proxy on https://localhost/ with the manager backend mapped to the host machine on
# localhost:8080 and the keycloak backend mapped to the host machine on localhost:8081
#
# Your changes will be visible live on browser reload or after restart:
#
# - Run the manager in an IDE with the following required environment variables:
# WEBSERVER_LISTEN_HOST=0.0.0.0
#
# Please see deploy.yml for configuration details for each service.
#
version: '2.4'
volumes:
postgresql-data:
services:
proxy:
extends:
file: deploy.yml
service: proxy
environment:
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"
manager Dockerfile
I tried to make it similar to the ENV variables in the deply.yml file
FROM adoptopenjdk/openjdk8:ubi-minimal-jre
### S6 installation
ENV S6_OVERLAY_VERSION=v2.2.0.3
RUN apkArch="$(uname -m)"; \
case "${apkArch}" in \
x86_64) s6Arch='amd64'; ;; \
armv7) s6Arch='arm'; ;; \
armv7l) s6Arch='arm'; ;; \
armhf) s6Arch='armhf'; ;; \
aarch64) s6Arch='aarch64'; ;; \
ppc64le) s6Arch='ppc64le'; ;; \
*) echo >&2 "Error: unsupported architecture ${apkArch}"; exit 1 ;; \
esac; \
curl -LfsSo /tmp/s6-overlay.tar.gz https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-${s6Arch}.tar.gz;
RUN tar xzf /tmp/s6-overlay.tar.gz -C / --exclude="./bin" && \
tar xzf /tmp/s6-overlay.tar.gz -C /usr ./bin
### End S6 installation
# Add git commit label must be specified at build time using --build-arg GIT_COMMIT=dadadadadad
ARG GIT_COMMIT=unknown
LABEL git-commit=$GIT_COMMIT
ENV JAVA_TOOL_OPTIONS ${JAVA_TOOL_OPTIONS}
ENV TZ ${TZ:-Africa/Cairo}
ENV SETUP_ADMIN_PASSWORD ${SETUP_ADMIN_PASSWORD:-secret}
#ENV EXTERNAL_URL ${EXTERNAL_URL:-https://localhost}
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 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@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}
ENV DEV_MODE ${DEV_MODE:-false}
ENV SETUP_WIPE_CLEAN_INSTALL ${SETUP_WIPE_CLEAN_INSTALL:-false}
ENV WEBSERVER_LISTEN_HOST ${WEBSERVER_LISTEN_HOST:-0.0.0.0}
ENV DB_VENDOR ${DB_VENDOR:-postgres}
ENV DB_HOST ${DB_HOST:-postgresql}
ENV DB_PORT ${DB_PORT:-5432}
ENV DB_NAME ${DB_NAME:-openremote}
ENV DB_SCHEMA ${DB_SCHEMA:-openremote}
ENV DB_USERNAME ${DB_USERNAME:-postgres}
ENV DB_PASSWORD ${DB_PASSWORD:-postgres}
ENV DB_MIN_POOL_SIZE ${DB_MIN_POOL_SIZE:-5}
ENV DB_MAX_POOL_SIZE ${DB_MAX_POOL_SIZE:-20}
ENV DB_CONNECTION_TIMEOUT_SECONDS ${DB_CONNECTION_TIMEOUT_SECONDS:-300}
ENV KEYCLOAK_HOST ${KEYCLOAK_HOST:-keycloak}
ENV KEYCLOAK_PORT ${KEYCLOAK_PORT:-8080}
#ENV KEYCLOAK_GRANT_FILE ${KEYCLOAK_GRANT_FILE:-/deployment/manager/keycloak.json}
ENV APP_DOCROOT ${APP_DOCROOT:-/opt/web}
ENV CUSTOM_APP_DOCROOT ${CUSTOM_APP_DOCROOT:-/deployment/manager/app}
ENV PROVISIONING_DOCROOT ${PROVISIONING_DOCROOT:-/deployment/manager/provisioning}
ENV ROOT_REDIRECT_PATH ${ROOT_REDIRECT_PATH:-/manager}
ENV MAP_TILES_PATH ${MAP_TILES_PATH:-/deployment/map/mapdata.mbtiles}
ENV MAP_SETTINGS_PATH ${MAP_SETTINGS_PATH:-/deployment/map/mapsettings.json}
ENV DATA_POINTS_EXPORT_DIR ${DATA_POINTS_EXPORT_DIR:-/tmp}
ENV LOGGING_CONFIG_FILE ${LOGGING_CONFIG_FILE}
ENV MAP_TILESERVER_HOST ${MAP_TILESERVER_HOST}
ENV MAP_TILESERVER_PORT ${MAP_TILESERVER_PORT:-8082}
ENV MAP_TILESERVER_REQUEST_TIMEOUT ${MAP_TILESERVER_REQUEST_TIMEOUT:-10000}
ENV SCHEDULED_TASKS_THREADS_MAX ${SCHEDULED_TASKS_THREADS_MAX:-4}
ENV RULE_EVENT_EXPIRES ${RULE_EVENT_EXPIRES:-1h}
ENV IDENTITY_PROVIDER ${IDENTITY_PROVIDER:-keycloak}
ENV IDENTITY_SESSION_MAX_MINUTES ${IDENTITY_SESSION_MAX_MINUTES:-1440}
ENV IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES ${IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES:-2628000}
ENV MANAGER_JAVA_OPTS ${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}
EXPOSE 8080
HEALTHCHECK --interval=3s --timeout=3s --start-period=30s --retries=120 CMD curl --fail --silent http://localhost:8080 || exit 1
RUN mkdir -p /opt/app
RUN mkdir -p /deployment/manager/extensions
RUN mkdir -p /zwave
WORKDIR /opt/app
ADD lib /opt/app/lib
ADD web /opt/web
ADD map /opt/map
ENTRYPOINT ["/init"]
CMD java $MANAGER_JAVA_OPTS -cp /opt/app/lib/*:/deployment/manager/extensions/* org.openremote.manager.Main