Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Added keycloak multi arch Dockerfile

Michal Rutka19f52a77e93f
diff --git a/.github/workflows/keycloak-multi.yml b/.github/workflows/keycloak-multi.yml
new file mode 100644
index 000000000..d75f4c4a4
--- /dev/null
+++ b/.github/workflows/keycloak-multi.yml
@@ -0,0 +1,38 @@
+name: build keycloak Docker image and push to it dockerhub
+
+# Controls when the action will run.
+on:
+ # Triggers the workflow on push or pull request events but only for the master branch
+ push:
+ branches: [ master ]
+ paths:
+ - keycloak/**
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+env:
+ PLATFORM: linux/amd64,linux/arm64
+
+jobs:
+ image_keycloak:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: set up QEMU
+ uses: docker/setup-qemu-action@v1
+ with:
+ platforms: all
+ - name: install buildx
+ id: buildx
+ uses: docker/setup-buildx-action@v1
+ with:
+ version: latest
+ install: true
+ - name: available platforms
+ run: echo ${{ steps.buildx.outputs.platforms }}
+ - name: login to docker hub
+ run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USER }}" --password-stdin
+ - name: build and push images
+ run: |
+ docker build --push --platform $PLATFORM -t openremote/keycloak:multi -f keycloak/multi.Dockerfile keycloak
diff --git a/.github/workflows/manager.yml b/.github/workflows/manager.yml
index db744766c..bb68a025b 100644
--- a/.github/workflows/manager.yml
+++ b/.github/workflows/manager.yml
@@ -14,7 +14,6 @@ on:
env:
PLATFORM: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
- KEYCLOAK_PLATFORM: linux/amd64
jobs:
image_deployment:
diff --git a/keycloak/tools/cli/databases/mariadb/change-database.cli b/keycloak/tools/cli/databases/mariadb/change-database.cli
new file mode 100644
index 000000000..2f099f2ef
--- /dev/null
+++ b/keycloak/tools/cli/databases/mariadb/change-database.cli
@@ -0,0 +1,9 @@
+/subsystem=datasources/data-source=KeycloakDS: remove()
+/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url=jdbc:mariadb://${env.DB_ADDR:mariadb}:${env.DB_PORT:3306}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}, driver-name=mariadb)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=user-name, value=${env.DB_USER:keycloak})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=password, value=${env.DB_PASSWORD:password})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=check-valid-connection-sql, value="SELECT 1")
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation, value=true)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation-millis, value=60000)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=flush-strategy, value=IdleConnections)
+/subsystem=datasources/jdbc-driver=mariadb:add(driver-name=mariadb, driver-module-name=org.mariadb.jdbc, driver-xa-datasource-class-name=org.mariadb.jdbc.MySQLDataSource)
diff --git a/keycloak/tools/cli/databases/mariadb/standalone-configuration.cli b/keycloak/tools/cli/databases/mariadb/standalone-configuration.cli
new file mode 100644
index 000000000..60c045345
--- /dev/null
+++ b/keycloak/tools/cli/databases/mariadb/standalone-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mariadb/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/mariadb/standalone-ha-configuration.cli b/keycloak/tools/cli/databases/mariadb/standalone-ha-configuration.cli
new file mode 100644
index 000000000..de5913612
--- /dev/null
+++ b/keycloak/tools/cli/databases/mariadb/standalone-ha-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mariadb/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/mssql/change-database.cli b/keycloak/tools/cli/databases/mssql/change-database.cli
new file mode 100644
index 000000000..1591e0eae
--- /dev/null
+++ b/keycloak/tools/cli/databases/mssql/change-database.cli
@@ -0,0 +1,11 @@
+/subsystem=datasources/data-source=KeycloakDS: remove()
+/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url="jdbc:sqlserver://${env.DB_ADDR:mssql}:${env.DB_PORT:1433};databaseName=${env.DB_DATABASE:keycloak};sendStringParametersAsUnicode=false;integratedSecurity=false;user=${env.DB_USER:keycloak};password=${env.DB_PASSWORD:password};${env.JDBC_PARAMS:}", driver-name=sqlserver)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=user-name, value=${env.DB_USER:keycloak})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=password, value=${env.DB_PASSWORD:password})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=check-valid-connection-sql, value="SELECT 1")
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation, value=true)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation-millis, value=60000)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=flush-strategy, value=IdleConnections)
+/subsystem=datasources/jdbc-driver=sqlserver:add(driver-name=sqlserver,driver-module-name=com.microsoft.sqlserver.jdbc,driver-xa-datasource-class-name=com.microsoft.sqlserver.jdbc.SQLServerXADataSource)
+
+/subsystem=keycloak-server/spi=connectionsJpa/provider=default:write-attribute(name=properties.schema,value=${env.DB_SCHEMA:dbo})
\ No newline at end of file
diff --git a/keycloak/tools/cli/databases/mssql/standalone-configuration.cli b/keycloak/tools/cli/databases/mssql/standalone-configuration.cli
new file mode 100644
index 000000000..8a616cab6
--- /dev/null
+++ b/keycloak/tools/cli/databases/mssql/standalone-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mssql/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/mssql/standalone-ha-configuration.cli b/keycloak/tools/cli/databases/mssql/standalone-ha-configuration.cli
new file mode 100644
index 000000000..5057630f6
--- /dev/null
+++ b/keycloak/tools/cli/databases/mssql/standalone-ha-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mssql/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/mysql/change-database.cli b/keycloak/tools/cli/databases/mysql/change-database.cli
new file mode 100644
index 000000000..e70969737
--- /dev/null
+++ b/keycloak/tools/cli/databases/mysql/change-database.cli
@@ -0,0 +1,9 @@
+/subsystem=datasources/data-source=KeycloakDS: remove()
+/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url=jdbc:mysql://${env.DB_ADDR:mysql}:${env.DB_PORT:3306}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}, driver-name=mysql)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=user-name, value=${env.DB_USER:keycloak})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=password, value=${env.DB_PASSWORD:password})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=check-valid-connection-sql, value="SELECT 1")
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation, value=true)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation-millis, value=60000)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=flush-strategy, value=IdleConnections)
+/subsystem=datasources/jdbc-driver=mysql:add(driver-name=mysql, driver-module-name=com.mysql.jdbc, driver-xa-datasource-class-name=com.mysql.cj.jdbc.MysqlXADataSource)
diff --git a/keycloak/tools/cli/databases/mysql/standalone-configuration.cli b/keycloak/tools/cli/databases/mysql/standalone-configuration.cli
new file mode 100644
index 000000000..00370f68f
--- /dev/null
+++ b/keycloak/tools/cli/databases/mysql/standalone-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mysql/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/mysql/standalone-ha-configuration.cli b/keycloak/tools/cli/databases/mysql/standalone-ha-configuration.cli
new file mode 100644
index 000000000..5787e8a53
--- /dev/null
+++ b/keycloak/tools/cli/databases/mysql/standalone-ha-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/mysql/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/oracle/change-database.cli b/keycloak/tools/cli/databases/oracle/change-database.cli
new file mode 100644
index 000000000..3ea85bf08
--- /dev/null
+++ b/keycloak/tools/cli/databases/oracle/change-database.cli
@@ -0,0 +1,9 @@
+/subsystem=datasources/data-source=KeycloakDS: remove()
+/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url=jdbc:oracle:thin:@${env.DB_ADDR:oracle}:${env.DB_PORT:1521}:${env.DB_DATABASE:XE}${env.JDBC_PARAMS:}, driver-name=oracle)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=user-name, value=${env.DB_USER:SYSTEM})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=password, value=${env.DB_PASSWORD:oracle})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=check-valid-connection-sql, value="SELECT 1 FROM dual")
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation, value=true)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation-millis, value=60000)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=flush-strategy, value=IdleConnections)
+/subsystem=datasources/jdbc-driver=oracle:add(driver-name=oracle, driver-module-name=com.oracle.jdbc, driver-xa-datasource-class-name=oracle.jdbc.xa.client.OracleXADataSource)
diff --git a/keycloak/tools/cli/databases/oracle/standalone-configuration.cli b/keycloak/tools/cli/databases/oracle/standalone-configuration.cli
new file mode 100644
index 000000000..4f1f3dcd0
--- /dev/null
+++ b/keycloak/tools/cli/databases/oracle/standalone-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/oracle/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/oracle/standalone-ha-configuration.cli b/keycloak/tools/cli/databases/oracle/standalone-ha-configuration.cli
new file mode 100644
index 000000000..57762b819
--- /dev/null
+++ b/keycloak/tools/cli/databases/oracle/standalone-ha-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/oracle/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/postgres/change-database.cli b/keycloak/tools/cli/databases/postgres/change-database.cli
new file mode 100644
index 000000000..f6b70425f
--- /dev/null
+++ b/keycloak/tools/cli/databases/postgres/change-database.cli
@@ -0,0 +1,11 @@
+/subsystem=datasources/data-source=KeycloakDS: remove()
+/subsystem=datasources/data-source=KeycloakDS: add(jndi-name=java:jboss/datasources/KeycloakDS,enabled=true,use-java-context=true,use-ccm=true, connection-url=jdbc:postgresql://${env.DB_ADDR:postgres}/${env.DB_DATABASE:keycloak}${env.JDBC_PARAMS:}, driver-name=postgresql)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=user-name, value=${env.DB_USER:keycloak})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=password, value=${env.DB_PASSWORD:password})
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=check-valid-connection-sql, value="SELECT 1")
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation, value=true)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=background-validation-millis, value=60000)
+/subsystem=datasources/data-source=KeycloakDS: write-attribute(name=flush-strategy, value=IdleConnections)
+/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql, driver-module-name=org.postgresql.jdbc, driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)
+
+/subsystem=keycloak-server/spi=connectionsJpa/provider=default:write-attribute(name=properties.schema,value=${env.DB_SCHEMA:public})
diff --git a/keycloak/tools/cli/databases/postgres/standalone-configuration.cli b/keycloak/tools/cli/databases/postgres/standalone-configuration.cli
new file mode 100644
index 000000000..e10ff84b9
--- /dev/null
+++ b/keycloak/tools/cli/databases/postgres/standalone-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/postgres/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/databases/postgres/standalone-ha-configuration.cli b/keycloak/tools/cli/databases/postgres/standalone-ha-configuration.cli
new file mode 100644
index 000000000..e95f34448
--- /dev/null
+++ b/keycloak/tools/cli/databases/postgres/standalone-ha-configuration.cli
@@ -0,0 +1,3 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/databases/postgres/change-database.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/files-plaintext-vault.cli b/keycloak/tools/cli/files-plaintext-vault.cli
new file mode 100644
index 000000000..991d04480
--- /dev/null
+++ b/keycloak/tools/cli/files-plaintext-vault.cli
@@ -0,0 +1,6 @@
+embed-server --server-config=$configuration_file --std-out=discard
+echo ** Adding vault spi **
+/subsystem=keycloak-server/spi=vault/:add
+/subsystem=keycloak-server/spi=vault/provider=files-plaintext/:add(enabled=true,properties={dir => $plaintext_vault_provider_dir})
+stop-embedded-server
+
diff --git a/keycloak/tools/cli/hostname.cli b/keycloak/tools/cli/hostname.cli
new file mode 100644
index 000000000..c9e82e125
--- /dev/null
+++ b/keycloak/tools/cli/hostname.cli
@@ -0,0 +1,2 @@
+/subsystem=keycloak-server/spi=hostname:write-attribute(name=default-provider, value="${keycloak.hostname.provider:default}")
+/subsystem=keycloak-server/spi=hostname/provider=fixed/:add(properties={hostname => "${keycloak.hostname.fixed.hostname:localhost}",httpPort => "${keycloak.hostname.fixed.httpPort:-1}",httpsPort => "${keycloak.hostname.fixed.httpsPort:-1}",alwaysHttps => "${keycloak.hostname.fixed.alwaysHttps:false}"},enabled=true)
diff --git a/keycloak/tools/cli/infinispan/cache-owners.cli b/keycloak/tools/cli/infinispan/cache-owners.cli
new file mode 100644
index 000000000..dc207e762
--- /dev/null
+++ b/keycloak/tools/cli/infinispan/cache-owners.cli
@@ -0,0 +1,11 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+batch
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=clientSessions: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineClientSessions: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens: write-attribute(name=owners, value=${env.CACHE_OWNERS_COUNT:1})
+/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions: write-attribute(name=owners, value=${env.CACHE_OWNERS_AUTH_SESSIONS_COUNT:1})
+run-batch
+stop-embedded-server
\ No newline at end of file
diff --git a/keycloak/tools/cli/jgroups/discovery/default.cli b/keycloak/tools/cli/jgroups/discovery/default.cli
new file mode 100644
index 000000000..68da05a1c
--- /dev/null
+++ b/keycloak/tools/cli/jgroups/discovery/default.cli
@@ -0,0 +1,11 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+batch
+/subsystem=jgroups/stack=udp/protocol=PING:remove()
+/subsystem=jgroups/stack=udp/protocol=$keycloak_jgroups_discovery_protocol:add(add-index=0, properties=$keycloak_jgroups_discovery_protocol_properties)
+
+/subsystem=jgroups/stack=tcp/protocol=MPING:remove()
+/subsystem=jgroups/stack=tcp/protocol=$keycloak_jgroups_discovery_protocol:add(add-index=0, properties=$keycloak_jgroups_discovery_protocol_properties)
+
+/subsystem=jgroups/channel=ee:write-attribute(name="stack", value=$keycloak_jgroups_transport_stack)
+run-batch
+stop-embedded-server
diff --git a/keycloak/tools/cli/loglevel.cli b/keycloak/tools/cli/loglevel.cli
new file mode 100644
index 000000000..c6adb8826
--- /dev/null
+++ b/keycloak/tools/cli/loglevel.cli
@@ -0,0 +1,9 @@
+/subsystem=logging/logger=org.keycloak:add
+/subsystem=logging/logger=org.keycloak:write-attribute(name=level,value=${env.KEYCLOAK_LOGLEVEL:INFO})
+
+/subsystem=logging/root-logger=ROOT:change-root-log-level(level=${env.ROOT_LOGLEVEL:INFO})
+
+/subsystem=logging/root-logger=ROOT:remove-handler(name="FILE")
+/subsystem=logging/periodic-rotating-file-handler=FILE:remove
+
+/subsystem=logging/console-handler=CONSOLE:undefine-attribute(name=level)
diff --git a/keycloak/tools/cli/metrics/db.cli b/keycloak/tools/cli/metrics/db.cli
new file mode 100644
index 000000000..752465717
--- /dev/null
+++ b/keycloak/tools/cli/metrics/db.cli
@@ -0,0 +1,5 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+batch
+/subsystem=datasources/data-source=KeycloakDS:write-attribute(name=statistics-enabled, value=true)
+run-batch
+stop-embedded-server
\ No newline at end of file
diff --git a/keycloak/tools/cli/metrics/http.cli b/keycloak/tools/cli/metrics/http.cli
new file mode 100644
index 000000000..322c7db9b
--- /dev/null
+++ b/keycloak/tools/cli/metrics/http.cli
@@ -0,0 +1,5 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+batch
+/subsystem=undertow:write-attribute(name=statistics-enabled,value=true)
+run-batch
+stop-embedded-server
\ No newline at end of file
diff --git a/keycloak/tools/cli/metrics/jgroups.cli b/keycloak/tools/cli/metrics/jgroups.cli
new file mode 100644
index 000000000..dac4cb55d
--- /dev/null
+++ b/keycloak/tools/cli/metrics/jgroups.cli
@@ -0,0 +1,5 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+batch
+/subsystem=jgroups/channel=ee:write-attribute(name=statistics-enabled, value=true)
+run-batch
+stop-embedded-server
\ No newline at end of file
diff --git a/keycloak/tools/cli/proxy.cli b/keycloak/tools/cli/proxy.cli
new file mode 100644
index 000000000..3c1984b1b
--- /dev/null
+++ b/keycloak/tools/cli/proxy.cli
@@ -0,0 +1,2 @@
+/subsystem=undertow/server=default-server/http-listener=default: write-attribute(name=proxy-address-forwarding, value=${env.PROXY_ADDRESS_FORWARDING:false})
+/subsystem=undertow/server=default-server/https-listener=https: write-attribute(name=proxy-address-forwarding, value=${env.PROXY_ADDRESS_FORWARDING:false})
diff --git a/keycloak/tools/cli/standalone-configuration.cli b/keycloak/tools/cli/standalone-configuration.cli
new file mode 100644
index 000000000..6e47c46ca
--- /dev/null
+++ b/keycloak/tools/cli/standalone-configuration.cli
@@ -0,0 +1,6 @@
+embed-server --server-config=standalone.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/loglevel.cli
+run-batch --file=/opt/jboss/tools/cli/proxy.cli
+run-batch --file=/opt/jboss/tools/cli/hostname.cli
+run-batch --file=/opt/jboss/tools/cli/theme.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/standalone-ha-configuration.cli b/keycloak/tools/cli/standalone-ha-configuration.cli
new file mode 100644
index 000000000..33e1440f3
--- /dev/null
+++ b/keycloak/tools/cli/standalone-ha-configuration.cli
@@ -0,0 +1,6 @@
+embed-server --server-config=standalone-ha.xml --std-out=echo
+run-batch --file=/opt/jboss/tools/cli/loglevel.cli
+run-batch --file=/opt/jboss/tools/cli/proxy.cli
+run-batch --file=/opt/jboss/tools/cli/hostname.cli
+run-batch --file=/opt/jboss/tools/cli/theme.cli
+stop-embedded-server
diff --git a/keycloak/tools/cli/theme.cli b/keycloak/tools/cli/theme.cli
new file mode 100644
index 000000000..dba1937d7
--- /dev/null
+++ b/keycloak/tools/cli/theme.cli
@@ -0,0 +1,2 @@
+/subsystem=keycloak-server/theme=defaults:write-attribute(name=welcomeTheme,value=${env.KEYCLOAK_WELCOME_THEME:keycloak})
+/subsystem=keycloak-server/theme=defaults:write-attribute(name=default,value=${env.KEYCLOAK_DEFAULT_THEME:keycloak})
diff --git a/keycloak/tools/cli/x509-keystore.cli b/keycloak/tools/cli/x509-keystore.cli
new file mode 100644
index 000000000..270a70065
--- /dev/null
+++ b/keycloak/tools/cli/x509-keystore.cli
@@ -0,0 +1,9 @@
+embed-server --server-config=$configuration_file --std-out=discard
+/subsystem=elytron/key-store=kcKeyStore:add(path=$keycloak_tls_keystore_file,type=JKS,credential-reference={clear-text=$keycloak_tls_keystore_password})
+/subsystem=elytron/key-manager=kcKeyManager:add(key-store=kcKeyStore,credential-reference={clear-text=$keycloak_tls_keystore_password})
+/subsystem=elytron/server-ssl-context=kcSSLContext:add(key-manager=kcKeyManager)
+batch
+/subsystem=undertow/server=default-server/https-listener=https:undefine-attribute(name=security-realm)
+/subsystem=undertow/server=default-server/https-listener=https:write-attribute(name=ssl-context,value=kcSSLContext)
+run-batch
+stop-embedded-server
diff --git a/keycloak/tools/cli/x509-truststore.cli b/keycloak/tools/cli/x509-truststore.cli
new file mode 100644
index 000000000..79f94db09
--- /dev/null
+++ b/keycloak/tools/cli/x509-truststore.cli
@@ -0,0 +1,25 @@
+embed-server --server-config=$configuration_file --std-out=discard
+/subsystem=elytron/key-store=kcTrustStore:add(path=$keycloak_tls_truststore_file,type=JKS,credential-reference={clear-text=$keycloak_tls_truststore_password})
+/subsystem=elytron/trust-manager=kcTrustManager:add(key-store=kcTrustStore)
+if (outcome != success) of /subsystem=elytron/server-ssl-context=kcSSLContext:read-resource
+ # Since WF requires a Key Manager for creating /subsystem=elytron/server-ssl-context, there's nothing we can do at this point.
+ # We can not automatically generate a self-signed key (Elytron doesn't support this, see https://docs.wildfly.org/13/WildFly_Elytron_Security.html#configure-ssltls),
+ # and we don't have anything else at hand.
+ # However, there is no big harm here - the Trust Store is more needed by Keycloak Truststore SPI.
+ echo "WARNING! There is no Key Manager (No Key Store specified). Skipping HTTPS Listener configuration..."
+else
+ # The SSL Context has been added by keystore, not much to do - just append trust store and we are done.
+ /subsystem=elytron/server-ssl-context=kcSSLContext:write-attribute(name=trust-manager, value=kcTrustManager)
+ /subsystem=elytron/server-ssl-context=kcSSLContext:write-attribute(name=want-client-auth, value=true)
+end-if
+
+if (outcome != success) of /subsystem=keycloak-server/spi=truststore:read-resource
+ /subsystem=keycloak-server/spi=truststore/:add
+end-if
+/subsystem=keycloak-server/spi=truststore/provider=file/:add(enabled=true,properties={ \
+ file => $keycloak_tls_truststore_file, \
+ password => $keycloak_tls_truststore_password, \
+ hostname-verification-policy => "WILDCARD", \
+disabled => "false"})
+
+stop-embedded-server
\ No newline at end of file
diff --git a/keycloak/tools/databases/mariadb/module.xml b/keycloak/tools/databases/mariadb/module.xml
new file mode 100644
index 000000000..a3f6f962d
--- /dev/null
+++ b/keycloak/tools/databases/mariadb/module.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<module xmlns="urn:jboss:module:1.0" name="org.mariadb.jdbc">
+ <resources>
+ <resource-root path="mariadb-jdbc.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>
diff --git a/keycloak/tools/databases/mssql/module.xml b/keycloak/tools/databases/mssql/module.xml
new file mode 100644
index 000000000..23574b804
--- /dev/null
+++ b/keycloak/tools/databases/mssql/module.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver.jdbc">
+
+<resources>
+ <resource-root path="mssql-jdbc.jar"/>
+</resources>
+<dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ <module name="javax.xml.bind.api"/>
+ <module name="javax.servlet.api" optional="true"/>
+</dependencies>
+</module>
diff --git a/keycloak/tools/databases/mysql/module.xml b/keycloak/tools/databases/mysql/module.xml
new file mode 100644
index 000000000..600bdedbf
--- /dev/null
+++ b/keycloak/tools/databases/mysql/module.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<module xmlns="urn:jboss:module:1.0" name="com.mysql.jdbc">
+ <resources>
+ <resource-root path="mysql-connector-java-JDBC_MYSQL_VERSION.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>
diff --git a/keycloak/tools/databases/oracle/module.xml b/keycloak/tools/databases/oracle/module.xml
new file mode 100644
index 000000000..8720a08f9
--- /dev/null
+++ b/keycloak/tools/databases/oracle/module.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<module xmlns="urn:jboss:module:1.0" name="com.oracle.jdbc">
+ <resources>
+ <resource-root path="driver/ojdbc.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>
diff --git a/keycloak/tools/databases/postgres/module.xml b/keycloak/tools/databases/postgres/module.xml
new file mode 100644
index 000000000..2180e59ea
--- /dev/null
+++ b/keycloak/tools/databases/postgres/module.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ JBoss, Home of Professional Open Source.
+ ~ Copyright 2010, Red Hat, Inc., and individual contributors
+ ~ as indicated by the @author tags. See the copyright.txt file in the
+ ~ distribution for a full listing of individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ -->
+<module xmlns="urn:jboss:module:1.0" name="org.postgresql.jdbc">
+ <resources>
+ <resource-root path="postgres-jdbc.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>