Bare Metal Deployment¶
Deploy directly to Keycloak running on bare metal or VMs.
Overview¶
Install the extension by copying the JAR file to Keycloak's providers directory. This method works for: - Traditional server installations - VM deployments - Manual installations - Development environments
Prerequisites¶
- Keycloak 22.0 or later installed
- Java 21 or later
- Access to Keycloak's filesystem
- Appropriate file permissions
Installation Steps¶
1. Download the Extension¶
Download the latest JAR from GitHub Releases:
2. Copy to Keycloak¶
Default Keycloak paths:
- Linux/Unix: /opt/keycloak/providers/
- Windows: C:\keycloak\providers\
- Custom: $KEYCLOAK_HOME/providers/
3. Rebuild Keycloak¶
Keycloak needs to rebuild its internal cache to recognize new providers:
4. Configure Environment Variables¶
Add configuration to your environment or startup script:
Add to /etc/environment or your startup script:
Set system environment variables:
[Environment]::SetEnvironmentVariable("kete.routes.kafka-example.destination.kind", "kafka", "Machine")
[Environment]::SetEnvironmentVariable("kete.routes.kafka-example.destination.bootstrap.servers", "localhost:9092", "Machine")
[Environment]::SetEnvironmentVariable("kete.routes.kafka-example.destination.topic", "keycloak-events", "Machine")
[Environment]::SetEnvironmentVariable("kete.routes.kafka-example.event-matchers.filter", "list:LOGIN,LOGOUT", "Machine")
5. Restart Keycloak¶
Configuration Methods¶
Method 1: Environment Variables¶
Set in your shell profile, systemd service file, or Windows environment variables.
Method 2: Configuration File¶
Create a properties file and reference it:
keycloak.conf or custom properties file:
kete.routes.kafka-example.destination.kind=kafka
kete.routes.kafka-example.destination.bootstrap.servers=localhost:9092
kete.routes.kafka-example.destination.topic=keycloak-events
Method 3: Startup Arguments¶
Pass directly to Keycloak:
Systemd Service Configuration¶
For Linux systems using systemd:
/etc/systemd/system/keycloak.service:
[Unit]
Description=Keycloak Server
After=network.target
[Service]
Type=simple
User=keycloak
Group=keycloak
Environment="kete.routes.kafka-example.destination.kind=kafka"
Environment="kete.routes.kafka-example.destination.bootstrap.servers=localhost:9092"
ExecStart=/opt/keycloak/bin/kc.sh start
Restart=on-failure
[Install]
WantedBy=multi-user.target
Reload and restart:
Upgrades¶
Upgrading the Extension¶
# 1. Stop Keycloak
sudo systemctl stop keycloak
# 2. Remove old version
rm /opt/keycloak/providers/kete.jar
# 3. Download new version
curl -L -o /opt/keycloak/providers/kete.jar https://github.com/FortuneN/kete/releases/latest/download/kete.jar
# 4. Rebuild
/opt/keycloak/bin/kc.sh build
# 5. Start Keycloak
sudo systemctl start keycloak
# 1. Stop Keycloak service
Stop-Service keycloak
# 2. Remove old version
Remove-Item C:\keycloak\providers\kete.jar
# 3. Download new version
Invoke-WebRequest -Uri https://github.com/FortuneN/kete/releases/latest/download/kete.jar -OutFile C:\keycloak\providers\kete.jar
# 4. Rebuild
C:\keycloak\bin\kc.bat build
# 5. Start Keycloak service
Start-Service keycloak