The docker-compose.yaml
file contains a Keycloak cluster configuration with three instances, connected to a PostgreSQL database and fronted by a Traefik load balancer.
You can use this configuration to run the cluster locally for testing purposes.
First, bind the keycloak.localhost
domain to the local address:
echo "127.0.0.1 keycloak.localhost" >> /etc/hosts
Start the cluster with docker-compose:
docker-compose up -d
Build the custom Keycloak image using:
docker build -t keycloak-cluster:latest .
You can also tag the image with a specific version:
docker build -t keycloak-cluster:1.0.0 .
- Authenticate to your AWS account using the AWS CLI:
aws configure
- Login to Amazon ECR:
aws ecr get-login-password --region YOUR_REGION | docker login --username AWS --password-stdin YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com
- Create an ECR repository (if not already created):
aws ecr create-repository --repository-name keycloak-cluster
- Tag your Docker image for ECR:
docker tag keycloak-cluster:latest YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/keycloak-cluster:latest
- Push the image to ECR:
docker push YOUR_ACCOUNT_ID.dkr.ecr.YOUR_REGION.amazonaws.com/keycloak-cluster:latest
Replace the following placeholders with your actual values:
YOUR_REGION
: Your AWS region (e.g., us-east-1)YOUR_ACCOUNT_ID
: Your 12-digit AWS account ID
The load testing setup uses K6 (https://k6.io/)
To run the tests locally:
export KC_HOST="https://keycloak.localhost"
export KC_REALM="teste"
export CLIENT_ID="load-test"
export CLIENT_SECRET="???"
k6 run k6/call.js --insecure-skip-tls-verify