version: "2.2" networks: keycloak: ipam: config: - subnet: 10.0.1.0/24 db_replication: ipam: config: - subnet: 10.0.3.0/24 services: mariadb_bootstrap: build: db/mariadb image: keycloak_test_mariadb:${KEYCLOAK_VERSION:-latest} networks: - db_replication environment: MYSQL_ROOT_PASSWORD: root MYSQL_INITDB_SKIP_TZINFO: foo MYSQL_DATABASE: keycloak MYSQL_USER: keycloak MYSQL_PASSWORD: keycloak entrypoint: docker-entrypoint-wsrep.sh command: --wsrep-new-cluster mariadb_1: build: db/mariadb image: keycloak_test_mariadb:${KEYCLOAK_VERSION:-latest} networks: - db_replication - keycloak environment: MYSQL_ROOT_PASSWORD: root MYSQL_INITDB_SKIP_TZINFO: foo entrypoint: docker-entrypoint-wsrep.sh command: --wsrep_cluster_address=gcomm://${MARIADB_RUNNING_HOST:-mariadb_bootstrap} ports: - "3316:3306" mariadb_2: build: db/mariadb image: keycloak_test_mariadb:${KEYCLOAK_VERSION:-latest} networks: - db_replication - keycloak environment: MYSQL_ROOT_PASSWORD: root MYSQL_INITDB_SKIP_TZINFO: foo entrypoint: docker-entrypoint-wsrep.sh command: --wsrep_cluster_address=gcomm://${MARIADB_RUNNING_HOST:-mariadb_bootstrap} ports: - "3326:3306" mariadb_3: build: db/mariadb image: keycloak_test_mariadb:${KEYCLOAK_VERSION:-latest} networks: - db_replication - keycloak environment: MYSQL_ROOT_PASSWORD: root MYSQL_INITDB_SKIP_TZINFO: foo entrypoint: docker-entrypoint-wsrep.sh command: --wsrep_cluster_address=gcomm://${MARIADB_RUNNING_HOST:-mariadb_bootstrap} ports: - "3336:3306" keycloak: build: keycloak/target/docker image: keycloak_test_keycloak:${KEYCLOAK_VERSION:-latest} networks: - keycloak environment: MARIADB_HA_MODE: ${MARIADB_HA_MODE:-replication} MARIADB_HOSTS: ${MARIADB_HOSTS:-mariadb_1:3306,mariadb_2:3306} MARIADB_OPTIONS: ${MARIADB_OPTIONS} MARIADB_DATABASE: keycloak MARIADB_USER: keycloak MARIADB_PASSWORD: keycloak KEYCLOAK_USER: admin KEYCLOAK_PASSWORD: admin # docker-compose syntax note: ${ENV_VAR:-} JAVA_OPTS: ${KEYCLOAK_JVM_MEMORY:--Xms64m -Xmx2g -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m} -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true HTTP_MAX_CONNECTIONS: ${KEYCLOAK_HTTP_MAX_CONNECTIONS:-500} WORKER_IO_THREADS: ${KEYCLOAK_WORKER_IO_THREADS:-2} WORKER_TASK_MAX_THREADS: ${KEYCLOAK_WORKER_TASK_MAX_THREADS:-16} DS_MIN_POOL_SIZE: ${KEYCLOAK_DS_MIN_POOL_SIZE:-10} DS_MAX_POOL_SIZE: ${KEYCLOAK_DS_MAX_POOL_SIZE:-100} DS_POOL_PREFILL: "${KEYCLOAK_DS_POOL_PREFILL:-true}" DS_PS_CACHE_SIZE: ${KEYCLOAK_DS_PS_CACHE_SIZE:-100} ports: - "8080:8080" - "8443:8443" - "7989:7989" - "9990:9990" - "9999:9999"