Hi guys,
We have working an old version of OR for months, however some of the new features are needed and we want to migrate to the new version. Some of the problems are that custom java code has stopped working, and trying to start from scratch some changes are not reflected when deploying the application, sometimes. That’s why I wanted to run through the steps to see if I missed anything.
I started from the Reschool version, to which I have added in the code a realm for the city of Girona, customising icons and the map.
I open the project in IntelliJ, in theory it’s correctly configured, and compile the code using:
./gradlew clean installDist
All OK, perfect, then I mount the images, first:
docker build -t openremote/deployment:custom ./deployment/build/
(now I don’t mount the image docker build -t openremote/manager:custom ./openremote/manager/build/install/manager/
anymore because the openremote directory doesn’t exist, right?)
So second:
OR_ADMIN_PASSWORD=secret OR_HOSTNAME=localhost docker-compose -f docker-compose.yml -p custom up -d
and then I’m able to see the app in the browser.
In fact, it seems I’m using version 1.5.0 according to the Appearance tab:
And I can see from the beginning I have 2 realms: Master and Girona, it’s strange because Amsterdam it’s defined too (in CustomKeycloakSetup.java and CustomManagerSetup.java) but I can’t see it. Well, it’s not very important, maybe it’s something related to previous versions, let’s continue…
I’m a bit confused, since the gradle.properties contains:
version = 1.0-SNAPSHOT
openremoteVersion = 1.2.1
Should I type there 1.5.0? And use yarn up -E "@openremote/*@^1.5.0"
Why does version 1.5.0 appear when 1.2.1 is still written in part of the files? I guess I’ve skipped a step. The documentation is not clear, I would even say obsolete.
Ok, let’s say that now I want to add some java code (agents, assets…). I stop the application with:
OR_ADMIN_PASSWORD=secret OR_HOSTNAME=localhost docker-compose -f docker-compose.yml -p custom down
I even remove the image:
docker volume rm custom_deployment-data
I add the new code and recompile and mount the application following the same steps as at the beginning and fine, I can see and add my custom agent.
So, have I been doing the right steps or am I missing something? What about the questions above?
And another problem I would like to solve, I can deploy the application with docker-file, but I can’t run it from IntelliJ. I would like to do it when I am developing new java code, to debug it, but it doesn’t work.
Basically, before I used to run the instruction:
npm run serve -- --env config=../../../../deployment/manager/app
inside the openremote folder, but it doesn’t exist anymore, and run the ‘Custom deployment’ configuration. In the case of the version with artifacts, what are the steps to follow?
I add below my docker-compose.yml, just in case.
I would need to be clear that I’m on solid ground before proceeding with the next steps: how to deploy the new version on our server without losing one year of data, and how to deploy the smartphone app, well, step by step…
Thanks in advance, sorry for this rather long literary piece
version: '2.4'
volumes:
proxy-data:
deployment-data:
postgresql-data:
manager-data:
services:
# This service will only populate an empty volume on startup and then exit.
# If the volume already contains data, it exits immediately.
deployment:
image: openremote/deployment:custom
volumes:
- deployment-data:/deployment
proxy:
image: openremote/proxy:${PROXY_VERSION:-latest}
restart: always
depends_on:
manager:
condition: service_healthy
ports:
- "80:80"
- "443:443"
- "8883:8883"
volumes:
- proxy-data:/deployment
- deployment-data:/data
environment:
LE_EMAIL: ${OR_EMAIL_ADMIN}
DOMAINNAME: ${OR_HOSTNAME?OR_HOSTNAME must be set}
DOMAINNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}
postgresql:
image: openremote/postgresql:${POSTGRESQL_VERSION:-latest}
restart: always
volumes:
- postgresql-data:/var/lib/postgresql/data
- manager-data:/storage
ports:
- "5432:5432"
keycloak:
image: openremote/keycloak:${KEYCLOAK_VERSION:-latest}
restart: always
depends_on:
postgresql:
condition: service_healthy
volumes:
- deployment-data:/deployment
environment:
KEYCLOAK_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD:?OR_ADMIN_PASSWORD must be set}
KC_HOSTNAME: ${OR_HOSTNAME:-localhost}
KC_HOSTNAME_PORT: ${OR_SSL_PORT:--1}
manager:
image: openremote/manager:${MANAGER_VERSION:-latest}
restart: always
logging:
options:
max-size: "10m"
max-file: "10"
depends_on:
keycloak:
condition: service_healthy
volumes:
- manager-data:/storage
- deployment-data:/deployment
- ./deployment/map:/deployment/map
environment:
OR_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}
OR_SETUP_TYPE: # Typical values to support are staging and production
OR_SETUP_RUN_ON_RESTART:
OR_EMAIL_HOST:
OR_EMAIL_USER:
OR_EMAIL_PASSWORD:
OR_EMAIL_X_HEADERS:
OR_EMAIL_FROM:
OR_EMAIL_ADMIN:
OR_HOSTNAME: ${OR_HOSTNAME?OR_HOSTNAME must be set}
OR_ADDITIONAL_HOSTNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}
OR_SSL_PORT: ${OR_SSL_PORT:--1}
OR_DEV_MODE: ${OR_DEV_MODE:-false}
OR_MAP_TILES_PATH: ${OR_MAP_TILES_PATH:-/deployment/map/mapdata.mbtiles}
OR_MAP_SETTINGS_PATH: ${OR_MAP_SETTINGS_PATH:-/deployment/map/mapsettings.json}
OR_FORECAST_SOLAR_API_KEY:
WEBSERVER_LISTEN_HOST: 0.0.0.0
IDENTITY_NETWORK_WEBSERVER_PORT: 443
OR_FIREBASE_CONFIG_FILE: /deployment/manager/fcm.json