作为服务运行时,Keycloak 10部分启动

时间:2020-06-26 14:00:12

标签: keycloak keycloak-services

我目前已在Ubuntu 18.04上的两台服务器上以域模式安装Keycloak 10.0.2。以./domain.sh --host-config=host-master.xml手动运行时,所有服务均正常启动,系统运行正常。

我想将Keycloak作为服务运行,并遵循https://medium.com/@hasnat.saeed/setup-keycloak-server-on-ubuntu-18-04-ed8c7c79a2d9中给出的步骤。问题在于该服务显示为“活动”,但导航到管理URL结果The site can't be reached错误。我检查了生成的日志文件,似乎服务仅部分启动。

2020-06-26 12:53:52,164 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 10.0.2 (WildFly Core 11.1.1.Final) (Host Controller) started in 12675ms - Started 83 of 86 services (28 services are lazy, passive or on-demand)
2020-06-26 12:53:52,238 INFO  [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server server-one

当手动运行时,我看到有更多的服务已经启动。

[Server:server-one] 13:44:34,349 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 36) WFLYSRV0010: Deployed "keycloak-server.war" (runtime-name : "keycloak-server.war")
[Server:server-one] 13:44:34,463 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
[Server:server-one] 13:44:34,475 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 10.0.2 (WildFly Core 11.1.1.Final) started in 30123ms - Started 673 of 979 services (703
services are lazy, passive or on-demand)

不知道出了什么问题。需要解决此问题的帮助。

这是我的配置详细信息:

服务详细信息

keycloak.service - Keycloak Authentication Server
   Loaded: loaded (/etc/systemd/system/keycloak.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-06-26 13:47:12 UTC; 2min 23s ago
 Main PID: 116569 (launch.sh)
    Tasks: 187 (limit: 9479)
   CGroup: /system.slice/keycloak.service
           ├─116569 /bin/bash /data/keycloak/bin/launch.sh domain domain.xml host-master.xml 0.0.0.0 YES
           ├─116578 /bin/sh /data/keycloak/bin/domain.sh -c domain.xml --host-config=host-master.xml

/etc/keycloak/keycloak.conf

# The mode you want to run
WILDFLY_MODE=domain

# The configuration you want to run
WILDFLY_DOMAIN_CONFIG=domain.xml

# Host configuration
WILDFLY_HOST_CONFIG=host-master.xml

# The address to bind to
WILDFLY_BIND=0.0.0.0

# Whether this host is a domain controller. If not run with --backup switch
IS_DC=YES

/data/keycloak/bin/launch.sh

#!/bin/bash

WILDFLY_HOME="/data/keycloak"

if [[ "$1" == "domain" ]]; then
    if [[ "$5" == "YES" ]]; then
        $WILDFLY_HOME/bin/domain.sh -c $2 --host-config=$3
    else
        $WILDFLY_HOME/bin/domain.sh -c $2 --host-config=$3 --backup
    fi
else
    $WILDFLY_HOME/bin/standalone.sh -c $2 -b $4
fi

/etc/systemd/system/keycloak.service

[Unit]
Description=Keycloak Authentication Server
After=syslog.target network.target
Before=httpd.service

[Service]
Environment=LAUNCH_JBOSS_IN_BACKGROUND=1
EnvironmentFile=-/etc/keycloak/keycloak.conf
User=keycloak
Group=keycloak
LimitNOFILE=102642
PIDFile=/var/run/keycloak/keycloak.pid
ExecStart=/data/keycloak/bin/launch.sh $WILDFLY_MODE $WILDFLY_DOMAIN_CONFIG $WILDFLY_HOST_CONFIG $WILDFLY_BIND $IS_DC
StandardOutput=null

[Install]
WantedBy=multi-user.target

1 个答案:

答案 0 :(得分:0)

我也遵循相同的中型教程,并面临与您相同的问题。原来,我必须以root用户而不是keycloak用户的身份运行服务。我也不知道为什么。