title: Keycloak 10 partially starts when run as a service
body: <p>I have currently installed Keycloak 10.0.2 in domain mode with two servers on Ubuntu 18.04. When running manually as <code>./domain.sh --host-config=host-master.xml</code> all the services start normally and the system works fine.</p>
  <p>I wanted to run Keycloak as a service and followed the steps given in <a href="https://medium.com/@hasnat.saeed/setup-keycloak-server-on-ubuntu-18-04-ed8c7c79a2d9" rel="nofollow noreferrer">https://medium.com/@hasnat.saeed/setup-keycloak-server-on-ubuntu-18-04-ed8c7c79a2d9</a>. The problem is that the service shows as Active but navigating to the management URL results <code>The site can't be reached</code> error. I checked the generated log file and it seems that the services have started only partially.</p>
  <pre><code>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
  </code></pre>
  <p>Whereas when run manually I see that there are many more services that have started.</p>
  <pre><code>[Server:server-one] 13:44:34,349 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 36) WFLYSRV0010: Deployed &quot;keycloak-server.war&quot; (runtime-name : &quot;keycloak-server.war&quot;)
  [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)
  </code></pre>
  <p>Not sure what is going wrong. Need help resolving the issue.</p>
  <p>Here are my configuration details:</p>
  <p><strong>Service Details</strong></p>
  <pre><code>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
  </code></pre>
  <p><strong>/etc/keycloak/keycloak.conf</strong></p>
  <pre><code># 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
  </code></pre>
  <p><strong>/data/keycloak/bin/launch.sh</strong></p>
  <pre><code>#!/bin/bash
  
  WILDFLY_HOME=&quot;/data/keycloak&quot;
  
  if [[ &quot;$1&quot; == &quot;domain&quot; ]]; then
      if [[ &quot;$5&quot; == &quot;YES&quot; ]]; 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
  </code></pre>
  <p><strong>/etc/systemd/system/keycloak.service</strong></p>
  <pre><code>[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
  </code></pre>