BridgeWay Hub it's an API Gateway for easy launch and using, based on the Spring framework 6, keycloak as a security layer and eureka client for registration in the service discovery, etc. You can see the all dependencies here
Before running the app you need to configure the next services that depends on:
- Keycloak
- DB for Keycloak if needed
- Eureka Server, my solution
Clone the repository using git clone https://github.com/Justedlev/bridgewayhub.git
and after that run the app local,
you can use the simple run configuration, that based on .env
and jvm options, make sure that the service registry (eureka service) already started
or disable the dependency in pom.xml
I have a repository on Docker Hub
Simple command to run the container: docker compose up -d --build
The full compose.yaml that I personally use
name: justedlev-microservice
services:
bridgewayhub:
container_name: bridgewayhub
image: justedlev/bridgewayhub:0.0.1-SNAPSHOT
build:
context: .
environment:
SERVICE_REGISTRY: http://{example}:{example}@service-discovery:8761/eureka
ORIGINS: http://service-discovery:8761,http://localhost:8761,http://localhost:3000
USERNAME: "{example}"
PASSWORD: "{example}"
ROLES: admin,user,editor,owner
KEYCLOAK_HOST: http://sso:9321
KEYCLOAK_REALM: "{example}"
KEYCLOAK_ISSUER_URI: ${KEYCLOAK_HOST}/realms/${KEYCLOAK_REALM}
KEYCLOAK_JWKS_URI: ${KEYCLOAK_ISSUER_URI}/protocol/openid-connect/certs
KEYCLOAK_TOKEN_ENDPOINT: ${KEYCLOAK_ISSUER_URI}/protocol/openid-connect/token
KEYCLOAK_INTROSPECTION_ENDPOINT: ${KEYCLOAK_ISSUER_URI}/protocol/openid-connect/token/introspect
KEYCLOAK_CLIENT_ID: "{example}"
KEYCLOAK_CLIENT_SECRET: "{example}"
ports:
- 8123:8123
depends_on:
- sso
- service-discovery
# Service discovery
service-discovery:
container_name: service-discovery
image: justedlev/simple-eureka-server:1.0.0-SNAPSHOT
environment:
USERNAME: "{example}"
PASSWORD: "{example}"
ports:
- 8761:8761
# SSO service (keycloak)
sso:
container_name: keycloak
image: quay.io/keycloak/keycloak:24.0.2
command: [ "start-dev", "--http-port=9321" ]
environment:
KEYCLOAK_ADMIN: "{example}"
KEYCLOAK_ADMIN_PASSWORD: "{example}"
KC_HEALTH_ENABLED: true
KC_HOSTNAME: localhost
KC_DB: postgres
KC_DB_URL: jdbc:postgresql://postgres:5432/{example}
KC_DB_USERNAME: "{example}"
KC_DB_PASSWORD: "{example}"
KC_DB_SCHEMA: keycloak
depends_on:
- postgres
ports:
- 9321:9321
# Postgres DB
postgres:
container_name: postgres
image: postgres:16.2-alpine
environment:
POSTGRES_DB: "{example}"
POSTGRES_USER: "{example}"
POSTGRES_PASSWORD: "{example}"
volumes:
- db-data:/var/lib/postgresql/data
ports:
- 5432:5432
healthcheck:
test: [ "CMD", "pg_isready", "-U {example}", "-d" ]
interval: 15s
timeout: 10s
retries: 5
start_period: 12s
restart: unless-stopped
deploy:
resources:
limits:
cpus: "1"
memory: 250MB
volumes:
db-data: