This is an implementation of the Opbeans Demo app in Java as an Spring Boot application . It uses the same database schema as the Node version.
By default it will use a pre-populated in memory H2 database.
To run the application run the following command from the opbeans folder:
./mvnw spring-boot:run
To run locally, including Server, Kibana and Elasticsearch, use the provided docker compose file by running the command
docker-compose up- Start Elastic Cloud trial (if you don't have it yet)
- Add environmental variables
ELASTIC_CLOUD_IDandELASTIC_CLOUD_CREDENTIALS(in formatlogin:password) - Run
docker-compose -f docker-compose-elastic-cloud.yml upThe simplest way to test this demo is by running:
make testTests are written using bats under the tests dir
Publish the docker image with
VERSION=1.2.3 make publishNOTE: VERSION refers to the tag for the docker image which will be published in the registry
Database can be overridden by using system properties and overriding values from the application property files:
./mvnw spring-boot:run -Dspring.jpa.database=POSTGRESQL -Dspring.datasource.driverClassName=org.postgresql.Driver -Dspring.datasource.url=jdbc:postgresql://localhost/opbeans?user=postgres&password=verysecure
Another possible way is to create a different property file like application-customdb.properties and enabling it with a profile:
./mvnw spring-boot:run -Dspring.profiles.active=customdb
The application has a built-in bug that you can trigger by navigating to the path /is-it-coffee-time.
There is a load generator Docker image that you can build with the following command:
docker build -t opbeans-java-loadgen -f loadgen/Dockerfile loadgen
Then you can run opbeans-java-loadgen as follows:
docker run --name opbeans-java-loadgen --network=host -d opbeans-java-loadgen