boldt
May 30, 2022, 8:46am
1
With Wildfly as an application server, it was possible to run KeyCloak as a service on a Windows Server as follows (for example behind an IIS):
.\service.bat install /name keycloak /display Keycloak /desc "Keycloak"
.\service.bat start /name Keycloak
Unfortunately, there is no service.bat
anymore to run KeyCloak 18 as a service, since it’s backed with Quarkus now.
It seems, that there is only the kc.bat
to start KeyCloak:
./kc.bat start
Here, the depricated nssm is recommended; also procrun
is named as a tool, which has its problems too . This similar thread is unanswered yet .
What’s the propper way to run KeyCloak 18 with Quarkus as a service on a Windows Server?
1 Like
Hello,
Have you tried manually creating a service?
CMD
sc create "ServiceName" start= demand displayname= "DisplayName" binpath= [path to .bat file]
boldt
June 1, 2022, 12:10pm
3
Unfortunaltey, sc
does not work. I can register…
PS E:\Keycloak\keycloak-18.0.0\bin> sc.exe create "KeyCloak" start= auto displayname= "KeyCloak" binpath= E:\Keycloak\keycloak-18.0.0\bin\kc.bat
[SC] CreateService SUCCESS
… but cannot start the service:
PS E:\Keycloak\keycloak-18.0.0\bin> sc.exe start KeyCloak
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
Hint: I am using sc.exe
, since I am using the PowerShell
See here as well
I ended up using nssm 2.24, like so:
nssm install KCService1 C:\keycloak-19.0.1\bin\kc.bat
nssm set KCService1 AppParameters start --log=file
nssm set KCService1 AppDirectory C:\keycloak-19.0.1
nssm set KCService1 DisplayName Keycloak Service 1
nssm set KCService1 Description Keycloak Service 1 instance description
nssm set KCService1 AppEnvironmentExtra JAVA_HOME=C:\openjdk-18.0.2_windows-x64_bin\jdk-18.0.2
nssm set KCService1 DependOnService MSSQLSERVER
nssm set KCService1 AppNoConsole 1
3 Likes