Hey guys,
Is there any way to prefill the database volume on startup (so whenever someone pulls the Stack off docker) ?
The idea is to have some preconfigured Assets and Rules.
Thanks in advance !
Hey guys,
Is there any way to prefill the database volume on startup (so whenever someone pulls the Stack off docker) ?
The idea is to have some preconfigured Assets and Rules.
Thanks in advance !
Yes you can create what we call ‘Setup code’. This includes realms, users, assets, and rules.
The easiest way to do this is by using the custom-project template repository. That will have placeholders for this in the files named CustomKeycloakSetup and CustomManagerSetup (custom-project/setup/src/main/java/org/openremote/manager/setup/custom at main · openremote/custom-project · GitHub)
The rules can be added to the resources folder in setup (or anywhere as long as you reference them correctly)
You can also look at how it is done in the openremote repository for the Demo you can find on our website: openremote/setup/src/main/java/org/openremote/setup/demo at master · openremote/openremote · GitHub
Rules can be found here as referenced in RulesDemoSetup: openremote/setup/src/main/resources/demo/rules/smartcity at master · openremote/openremote · GitHub
Hope this helps you implement it. If you have any questions feel free to post them!
Don
Thanks Don! that’s really helpful, I must have read the wiki so often that I totally overlooked that feature… However, is there a way to export an existing Configuration (made on the platform) and use that as the initial setup ?
Thanks again!
Markus
Sadly, no(t yet)
Good luck!
Oh well! still thanks for your fast reply!
have a good one
(maybe i’ll collaborate and implement it myself when I can find the time)
Okay I found an easy solution for the Problem:
docker exec -i <container_name> pg_restore --verbose --clean --no-acl --no-owner -h localhost -U <PG_Username> -d <PG_Databasename> < ./path/to/your/Databasedump.sql