https://github.com/nmasse-itix/keycloak-import-realm
Generates & import data into Keycloak for performance tests
https://github.com/nmasse-itix/keycloak-import-realm
keycloak keycloak-client performance-testing
Last synced: 6 months ago
JSON representation
Generates & import data into Keycloak for performance tests
- Host: GitHub
- URL: https://github.com/nmasse-itix/keycloak-import-realm
- Owner: nmasse-itix
- License: gpl-3.0
- Created: 2021-01-20T11:14:40.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-07T15:57:19.000Z (over 3 years ago)
- Last Synced: 2024-06-20T03:29:02.297Z (12 months ago)
- Topics: keycloak, keycloak-client, performance-testing
- Language: Go
- Homepage: https://www.itix.fr/writing/how-size-your-projects-red-hats-single-sign-technology/
- Size: 80.1 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Keycloak Realm Generator & Importer
This tool is used to load data into Keycloak before running a performance test.
## Usage
### Generation
Generate 5 realms, each one containing 10 clients and 100 users.
Generated files are saved in the current directory.```sh
kci generate --realms 5 --clients 10 --users 100
```Same as above but save files in the specified directory.
```sh
kci generate --realms 5 --clients 10 --users 100 --target realms/
```Generate realms using the provided template.
```sh
kci generate --realms 5 --clients 10 --users 100 --realm my.template
```### Import
Configure your target Keycloak instance.
```sh
kci config set realm --value master
kci config set login --value admin
kci config set password --value S3cr3t
kci config set keycloak_url --value http://localhost:8080/auth
```Import the previously generated realms.
```sh
kci import *.json
```By default, 5 workers are used to speed up the loading process.
You can change this with:```sh
kci config set workers --value 10
```## Container image
An up-to-date container image is built by a Tekton pipeline and pushed to [quay.io/itix/kci](https://quay.io/repository/itix/kci?tab=tags).
Images are built for x86_64, armv5 and arm64.
Each tag in the git repository ends up being a tag in the Quay registry, `latest` being the continuous build of the `main` branch.To use this tool from the command line with podman, you would need to define the following function in your .bashrc / .zshrc.
```sh
function kci () {
touch ~/.kci.yaml
podman run --rm -v $HOME/.kci.yaml:/.kci.yaml:z -v $PWD:/home:z -w /home quay.io/itix/kci:latest "$@"
}
```## Building from sources
To compile the application from sources, you can run the following commands:
```sh
export GOPATH="$HOME/go"
export GOBIN="$GOPATH/bin"
export PATH="$GOBIN:$PATH"
go install github.com/rakyll/statik
go generate ./...
go build -o kci cli/main.go
```