Skip to content

Instantly share code, notes, and snippets.

@thomasdarimont
Last active March 23, 2022 19:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdarimont/ce0afecfd392f7fd7a76c0f6ca8f2c6f to your computer and use it in GitHub Desktop.
Save thomasdarimont/ce0afecfd392f7fd7a76c0f6ca8f2c6f to your computer and use it in GitHub Desktop.
Run an Embedded Keycloak Server with JBang

The example uses the embedded Spring Boot Keycloak Server to quickly spin up a new Keycloak instance.

Create JBang script with

jbang init spring-keycloak-server

Adapt spring-keycloak-server script.

Run the Keycloak server via:

export KEYCLOAK_CUSTOM_ADMINUSER_PASSWORD=admin
export SERVER_PORT=8081
sh ./spring-keycloak-server

The Keycloak Admin-Console is then available via http://localhost:8081/auth

///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS https://github.com/thomasdarimont/embedded-spring-boot-keycloak-server/tree/7.0.2#embedded-keycloak-server-spring-boot-starter
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan(basePackages = "com.github.thomasdarimont.keycloak")
@SpringBootApplication(exclude = LiquibaseAutoConfiguration.class)
public class SpringKeycloakServer {
public static void main(String[] args) {
SpringApplication.run(SpringKeycloakServer.class, args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment