So my first custom deployment is going very well. Got my development environment setup and a new MQTT handler running fairly easily. As I start to work on the logic of the handler I make changes and restart the custom deployment application through my IDE, I keep losing my services users, and assets. How can I prevent this.
Make sure to have the following environment variables:
OR_DEV_MODE=true;
OR_SETUP_RUN_ON_RESTART=false
Hi, it looks like it is not closed this thread yet but do not have a confirmation if it worked. The same thing happens to me, If I create assets or realm they disappear when I restart the manager. I have tried with
OR_DEV_MODE=true;
OR_SETUP_RUN_ON_RESTART=false
and also with both options set to false (in dev-ui.yml). However, when I try to load the UI appears this:
I can see some errors in docker container:
entityProvider : Error loading client ‘openremote’ for realm ‘master’ from identity provider, exception from call to identity provider follows
2024-02-21 13:44:05 profile-manager-1 | com.google.common.util.concurrent.UncheckedExecutionException: jakarta.ws.rs.NotAuthorizedException: HTTP 401 Unauthorized
I probably forgot some step, but which one?
Thanks
Hi,
This should clear things up. When running in IDE OR_DEV_MODE
defaults to true
this means that OR_SETUP_RUN_ON_RESTART
defaults to true
unless explicitly set.
So setup tasks (this includes cleaning the DB) will run if OR_SETUP_RUN_ON_RESTART
is true
based on above, you can write custom setup code to do any data population you may want but I guess you are doing it interactively through the UI which is why you don’t want to lose it on restart of the manager.
The other point to note is that if you are using the development compose profiles such as dev-testing.yml
then they don’t create a docker volume for persisting postgresql data, so if you ever recreate these containers then your data will be lost, if you just keep the same instance running (even between reboots) then data should still be in the container at least.
You can always look at the logs during startup it should clearly indicate if setup has run.