https://github.com/thomasvitale/spring-boot-multitenancy
Samples showing how to build multitenant applications with Java and Spring Boot
https://github.com/thomasvitale/spring-boot-multitenancy
java keycloak micrometer multitenancy spring-boot testcontainers
Last synced: 7 months ago
JSON representation
Samples showing how to build multitenant applications with Java and Spring Boot
- Host: GitHub
- URL: https://github.com/thomasvitale/spring-boot-multitenancy
- Owner: ThomasVitale
- License: apache-2.0
- Created: 2023-05-06T17:53:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-17T15:49:21.000Z (over 1 year ago)
- Last Synced: 2025-02-27T02:54:03.207Z (7 months ago)
- Topics: java, keycloak, micrometer, multitenancy, spring-boot, testcontainers
- Language: Java
- Homepage:
- Size: 397 KB
- Stars: 128
- Watchers: 8
- Forks: 55
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spring Boot Multitenancy
## Stack
* Java 21
* Spring Boot 3.2
* Grafana OSS## Usage
You can use Docker Compose to run the necessary backing services for observability, authentication, and AI.
From the project root folder, run Docker Compose.
```bash
docker-compose up -d
```The Instrument Service application can be run as follows to rely on Testcontainers to spin up a PostgreSQL database:
```bash
./gradlew bootTestRun
```The Edge Service application can be run as follows:
```bash
./gradlew bootRun
```The Chat Service application can be run using one of the two techniques described above. If you don't want to rely on Testcontainers,
make sure you have [Ollama](https://ollama.ai/) installed and the Llama2 model available (`ollama run llama2`).Two tenants are configured: `dukes` and `beans`. Ensure you add the following configuration to your `hosts` file to resolve tenants from DNS names.
```bash
127.0.0.1 dukes.rock
127.0.0.1 beans.rock
```Now open the browser window and navigate to `http://dukes.rock/instruments/`. You'll be redirected to the Keycloak authentication page. Log in with `isabelle/password`. The result will be the list of instruments from the Dukes rock band.
Now open another browser window and navigate to `http://beans.rock/instruments/`. You'll be redirected to the Keycloak authentication page. Log in with `bjorn/password`. The result will be the list of instruments from the Beans rock band.