Question

App Platform Keycloak Docker

Running into some issues when deploying keycloak in a container on the app platform. the build is running just fine but when it gets to deploy i keep getting an error. I’ve tried moving the env vars around to see if that would fix it but it doesn’t

FROM quay.io/keycloak/keycloak:latest as builder

ARG KC_HEALTH_ENABLED
ARG KC_METRICS_ENABLED
ARG KC_PROXY
ARG KC_HOSTNAME
ARG KC_PORT_FORWARDING
ARG KC_DB
ARG KC_DB_URL
ARG KC_DB_USERNAME
ARG KC_DB_PASSWORD
ARG KEYCLOAK_ADMIN
ARG KEYCLOAK_ADMIN_PASSWORD

# Enable health and metrics support
ENV KC_HEALTH_ENABLED=${KC_HEALTH_ENABLED}
ENV KC_METRICS_ENABLED=${KC_METRICS_ENABLED}
ENV KC_FEATURES="admin2,token-exchange"
ENV KC_PROXY=${KC_PROXY}
ENV KC_HOSTNAME=${KC_HOSTNAME}
ENV PROXY_ADDRESS_FORWARDING=${KC_PORT_FORWARDING}
ENV KC_DB=${KC_DB}
ENV KC_DB_URL=${KC_DB_URL}
ENV KC_DB_USERNAME=${KC_DB_USERNAME}
ENV KC_DB_PASSWORD=${KC_DB_PASSWORD}
ENV KEYCLOAK_ADMIN=${KEYCLOAK_ADMIN}
ENV KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD}

# Change working directory
WORKDIR /opt/keycloak
RUN /opt/keycloak/bin/kc.sh build

FROM quay.io/keycloak/keycloak:latest

COPY --from=builder /opt/keycloak/ /opt/keycloak/

ENTRYPOINT [ "/opt/keycloak/bin/kc.sh" ]
CMD [ "start-dev" ]
name: boomlabs-sso
databases:
  - engine: PG
    name: db
    num_nodes: 1
    size: basic-xxs
    version: '12'
envs:
  - key: KC_PROXY
    value: edge
    scope: BUILD_TIME
  - key: KC_HEALTH_ENABLED
    value: 'true'
    scope: BUILD_TIME
  - key: KC_METRICS_ENABLED
    value: 'true'
    scope: BUILD_TIME
  - key: KC_DB
    value: postgres
    scope: BUILD_TIME
  - key: KC_DB_USERNAME
    value: ${_self.USERNAME}
    scope: RUN_AND_BUILD_TIME
  - key: KC_DB_PASSWORD
    value: ${_self.PASSWORD}
    scope: RUN_AND_BUILD_TIME
  - key: KC_DB_URL
    value: ${_self.JDBC_DATABASE_URL}
    scope: RUN_AND_BUILD_TIME
  - key: KEYCLOAK_ADMIN
    value: SUPER_SECRET_ADMIN
    scope: RUN_AND_BUILD_TIME
  - key: KEYCLOAK_ADMIN_PASSWORD
    value: SUPER_SECRET_ADMIN_PASSWORD
    scope: RUN_AND_BUILD_TIME
    type: SECRET
  - key: KC_HOSTNAME
    value: ${APP_DOMAIN}
    scope: RUN_AND_BUILD_TIME
  - key: KC_PORT_FORWARDING
    value: 'true'
    scope: RUN_AND_BUILD_TIME
services:
  - dockerfile_path: Dockerfile
    github:
      branch: main
      deploy_on_push: false
      repo: repo
    http_port: 8080
    instance_count: 1
    instance_size_slug: basic-xxs
    name: keycloak
    routes:
      - path: /
    source_dir: /

Here is the logs for deploy:

2022-11-05T17:12:42.389586573Z Updating the configuration and installing your custom providers, if any. Please wait.
2022-11-05T17:13:36.260297165Z 2022-11-05 17:13:36,233 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 45360ms
2022-11-05T17:13:50.969185074Z Nov 05, 2022 5:13:44 PM org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider
2022-11-05T17:13:50.969234748Z INFO: Hostname settings: Base URL: <unset>, Hostname: boomlabs-sso-o4at6.ondigitalocean.app, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin URL: <unset>, Admin: <request>, Port: -1, Proxied: false
2022-11-05T17:13:50.971091548Z Nov 05, 2022 5:13:45 PM org.hibernate.Version
2022-11-05T17:13:50.971124771Z INFO: HHH000412: Hibernate ORM core version %s
2022-11-05T17:13:50.972181787Z Nov 05, 2022 5:13:45 PM org.hibernate.annotations.common.Version
2022-11-05T17:13:50.972204037Z INFO: HCANN000001: Hibernate Commons Annotations {%1$s}
2022-11-05T17:13:50.974289516Z Nov 05, 2022 5:13:46 PM org.hibernate.dialect.Dialect
2022-11-05T17:13:50.974311557Z INFO: HHH000400: Using dialect: %s
2022-11-05T17:13:51.155015451Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.155073971Z INFO: RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.157356402Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.157391797Z INFO: RESTEASY002205: Adding provider class org.keycloak.services.filters.KeycloakSecurityHeadersFilter from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.158869436Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.158898460Z INFO: RESTEASY002205: Adding provider class org.keycloak.services.error.KeycloakErrorHandler from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.160094390Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.160150562Z INFO: RESTEASY002205: Adding provider class org.keycloak.services.error.KcUnrecognizedPropertyExceptionHandler from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.161657131Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.161680504Z INFO: RESTEASY002200: Adding class resource org.keycloak.services.resources.ThemeResource from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.163211532Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.163266375Z INFO: RESTEASY002200: Adding class resource org.keycloak.services.resources.JsResource from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.164181998Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.164203055Z INFO: RESTEASY002220: Adding singleton resource org.keycloak.services.resources.admin.AdminRoot from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.170517416Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.170545222Z INFO: RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RobotsResource from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.171413252Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.171436211Z INFO: RESTEASY002220: Adding singleton resource org.keycloak.quarkus.runtime.services.resources.QuarkusWelcomeResource from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.172409928Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.172433453Z INFO: RESTEASY002220: Adding singleton resource org.keycloak.services.resources.RealmsResource from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.173608485Z Nov 05, 2022 5:13:48 PM org.jboss.resteasy.resteasy_jaxrs.i18n
2022-11-05T17:13:51.173630228Z INFO: RESTEASY002210: Adding provider singleton org.keycloak.services.util.ObjectMapperResolver from Application class org.keycloak.quarkus.runtime.integration.jaxrs.QuarkusKeycloakApplication
2022-11-05T17:13:51.382964364Z Nov 05, 2022 5:13:51 PM org.hibernate.resource.beans.container.spi.AbstractCdiBeanContainer stop
2022-11-05T17:13:51.383027688Z INFO: HHH10005004: Stopping BeanContainer : %s
2022-11-05T17:13:51.387323503Z ERROR: Failed to start server in (development) mode
2022-11-05T17:13:51.387493684Z ERROR: One or more configuration errors have prevented the application from starting. The errors are:
2022-11-05T17:13:51.387517078Z   - No value present
2022-11-05T17:13:51.387525417Z 
2022-11-05T17:13:51.387631034Z For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer