This application is used to configure Keycloak+Kong installations, locally or as part of a cluster.
An app that serves as a UI for accessing different running services.
Continues in Aether Landing Page README
An app represents an application and defines a set of public URLs. The main difference between an app and a service is that the app cannot be added to a realm.
Continues in App README
A service represents an application and defines a set of public and protected URLs and the routes to access to them.
Continues in Service README
A solution gathers a set of services.
Continues in Solution README
All the commands are defined in the entrypoint.sh
file.
entrypoint.sh {command-name} {rest-of-arguments}
Shows the help message with all the possible commands.
Runs bash inside the container.
Evaluates shell command inside the container.
Checks the Keycloak connection. Returns status 0
on success.
Adds a new realm in Keycloak using a default realm template.
add_realm {realm} \
{*description=abc} \
{*login_theme=abc} \
{*account_theme=abc} \
{*admin_theme=abc} \
{*email_theme=abc}
Adds or updates an admin user to an existing realm in Keycloak.
add_user {realm} {username} {*password} {*reset_password_on_first_login}
Adds or updates a user to an existing realm in Keycloak.
add_user {realm} {username} {*password} {*reset_password_on_first_login}
Adds an existing user to a group on an existing realm in Keycloak.
add_user_group {realm} {username} {group_name}
Adds a confidential client to an existing realm in Keycloak. Required for any realm that will use OIDC for authentication.
add_confidential_client {realm} {client-name} {*login_theme=abc}
# or
add_oidc_client {realm} {client-name} {*login_theme=abc}
Adds a public client to an existing realm in Keycloak. Allows token generation.
add_public_client {realm} {client-name} {*login_theme=abc}
Decodes a Keycloak JSON Web Token (JWT).
decode_token {token}
Checks the Kong connection. Returns status 0
on success.
Registers an app as a service in Kong,
using the app definition in APPS_PATH
directory.
add_app {app-name}
# or
register_app {app-name}
Note: The expected app file is
{APPS_PATH}/{app-name}.json
.
Removes an app in Kong,
using the app definition in APPS_PATH
directory.
remove_app {app-name}
Note: The expected app file is
{APPS_PATH}/{app-name}.json
.
Adds a service to an existing realm in Kong,
using the service definition in SERVICES_PATH
directory.
add_service {service-name} {realm} {oidc-client}
Note: The expected service file is
{SERVICES_PATH}/{service-name}.json
.
Removes a service from an existing realm in Kong,
using the service definition in SERVICES_PATH
directory.
remove_service {service-name} {realm}
# removes service from all realms
remove_service {service-name}
# or
remove_service {service-name} "*"
Note: The expected service file is
{SERVICES_PATH}/{service-name}.json
.
Note: the service will not be entirely removed if it's still used by another realm.
Adds a package of services to an existing realm in Kong,
using the solution definition in SOLUTION_PATH
directory.
add_solution {solution-name} {realm} {oidc-client}
Note: The expected solution file is
{SOLUTION_PATH}/{solution-name}.json
.
Removes a package of services from an existing realm in Kong,
using the solution definition in SOLUTION_PATH
directory.
remove_solution {solution-name} {realm}
# removes solution from all realms
remove_solution {solution-name}
# or
remove_solution {solution-name} "*"
Note: The expected solution file is
{SOLUTION_PATH}/{solution-name}.json
.
Note: the solution will not be entirely removed if it's still used by another realm.
Adds a Superuser to the Kafka Cluster.
add_kafka_su {username} {password}
Gives an existing user superuser status.
grant_kafka_su {username}
Adds a kafka user for a tenant, and adds ACL to their namespace.
add_kafka_tenant {tenant}
Gets SASL Credential for a given kafka tenant.
get_kafka_creds {tenant}
Adds a Superuser to the Confluent Cloud Kafka Cluster.
add_ccloud_su {username} {password}
Gives an existing user superuser status.
grant_ccloud_su {username}
Removes a Superuser and their credentials, account and permissions.
delete_ccloud_su {username}
Adds a kafka user for a tenant, and adds ACL to their namespace.
add_ccloud_tenant {tenant}
Removes a tenant and their credentials, account and permissions (does not remove data / topics).
delete_ccloud_tenant {username}
Adds a ccloud APIKey for a tenant.
add_ccloud_key {tenant} "{*description}"
Lists previously registered tenants in CCloud cluster.
list_ccloud_tenants
Lists ACLs of CCloud tenants, or of a single tenant referenced by name.
list_ccloud_acls {*tenant}
Lists active APIKeys on the cluster (names only).
list_ccloud_api_keys
Checks the ElasticSearch connection. Returns status 0
on success.
Prepares ElasticSearch.
setup_elasticsearch
Adds a tenant to ElasticSearch.
add_elasticsearch_tenant {tenant}
-
DEBUG
: Enables debug mode. Isfalse
if unset or set to empty string, anything else is consideredtrue
. -
BASE_DOMAIN
: Installation hostname. -
BASE_HOST
: Installation hostname with protocol. -
APPS_PATH
: Path to app files directory. Defaults to/code/app
. -
SERVICES_PATH
: Path to service files directory. Defaults to/code/service
. -
SOLUTIONS_PATH
: Path to solution files directory. Defaults to/code/solution
. -
SERVICES_DATA_PATH
: Path to the services data to be displayed in the landing page. Defaults to/code/data/services.json
.
-
TEMPLATES_PATH
: Path to template files directory. Defaults to/code/templates
. -
CORS_TEMPLATE_PATH
: Path to Kong service CORS plugin template file. This template is used with theregister_app
command. Defaults to{TEMPLATES_PATH}/cors_template.json
. -
OIDC_TEMPLATE_PATH
: Path to Kong service OIDC plugin template file. This template is used with theadd_service
andadd_solution
commands. Defaults to{TEMPLATES_PATH}/oidc_template.json
. -
REALM_TEMPLATE_PATH
: Path to Keycloak realm template file. This template is used with theadd_solution
andadd_service
commands. Defaults to{TEMPLATES_PATH}/realm_template.json
. -
CLIENT_TEMPLATE_PATH
: Path to Keycloak client template file. This template is used with theadd_confidential_client
,add_oidc_client
andadd_public_client
commands. Defaults to{TEMPLATES_PATH}/client_template.json
. -
ES_ROLE_TEMPLATE_PATH
: Path to ElasticSearch role template file. This template is used with theadd_elasticsearch_tenant
command. Defaults to{TEMPLATES_PATH}/es_role_template.json
.
All of these templates are going to be parsed using the
python template strings feature.
This means that even the keys or the values can contain $-based
strings that
will be replaced with the environment variable or command argument values.
Some of the expected $-based
strings are:
domain
: replaced withBASE_DOMAIN
environment variable value.host
: replaced withBASE_HOST
environment variable value.realm
: replaced with therealm
command argument value.tenant
: replaced with thetenant
command argument value.publicRealm
: replaced withPUBLIC_REALM
environment variable value.oidc_client_id
: replaced with theoidc-client
command argument value.oidc_client_secret
: replaced withoidc
client secret fetched form Keycloak.
Review the code to get the expected strings in each case.
WEB_SERVER_PORT
: Web server port. Defaults to8007
.WEB_SERVICE_NAME
: Name of this app used by kong to serve the routes. Defaults togateway
.
KEYCLOAK_INTERNAL
: Keycloak internal URL. Usuallyhttp://keycloak:8080/
. Note: Ending/
is required to connect to admin console.KEYCLOAK_MASTER_REALM
: Keycloak master realm name. Defaults tomaster
.KEYCLOAK_GLOBAL_ADMIN
: Keycloak admin user in the master realm.KEYCLOAK_GLOBAL_PASSWORD
: Keycloak admin user's password in the master realm.
KONG_INTERNAL
: Kong internal URL. Usuallyhttp://kong:8001
.PUBLIC_REALM
: Kong public realm. Defaults to-
.
ZOOKEEPER_HOST
: Zookeeper host address. Usually127.0.0.1:32181
.ZOOKEEPER_USER
: Zookeeper user.ZOOKEEPER_PW
: Zookeeper user's password.KAFKA_SECRET
: Kafka registered administrative credentials.
CC_URL
: Confluent Cloud URL. Usuallyhttps://confluent.cloud
.CC_CLI_PATH
: Confluent Cloud client path. Usuallyccloud
.CC_API_USER
: Confluent Cloud permissioned user.CC_API_PASSWORD
: Confluent Cloud user's password.CC_ENVIRONMENT_NAME
: Confluent Cloud environment to use. Usuallydefault
.CC_CLUSTER_NAME
: Confluent Cloud cluster to modify. Usuallydefault
.
ELASTICSEARCH_HOST
: Elasticsearch internal URL. Usuallyhttp://elasticsearch:9200
.ELASTICSEARCH_USER
: Elasticsearch user.ELASTICSEARCH_PW
: Elasticsearch user's password.