Hello all,
my team is developing a system that, among other components, contains Keycloak. That system is rolled out on many individual bare-metal Windows servers. To make that manageable, we want to completely automate the rollout process. This process will transfer files from some repository to the target system, make necessary configurations, register Windows services and then start them.
For Keycloak, we need to create an admin user. Based on the Server Administration Guide, this is what we do:
- Start Keycloak process with environment variables
KEYCLOAK_ADMIN
andKEYCLOAK_ADMIN_PASSWORD
- Wait until process is running - either by checking log output or by trying to connect with
kcadm
- Create realms, clients etc. using
kcadm
- Stop Keycloak process
- Wait until process is stopped
- Register Keycloak as Windows service
- Start Windows service
This approach works, but it really feels clumsy. Especially step 2 (and to a lesser extent 4 and 5) requires some non-trivial coding. I wonder if there is not an easier approach, like a command that starts Keycloak, creates the intial admin account and directly stops Keycloak.
Does anyone of you have some ideas if and how this could be simplified?