Skip to content

Commit

Permalink
Opensource/docker compose2 (#146)
Browse files Browse the repository at this point in the history
* docker-compose created

* docker.yml added

---------

Co-authored-by: DanielOber <[email protected]>
Co-authored-by: Der-Alex-K <[email protected]>
  • Loading branch information
3 people committed Jun 20, 2024
1 parent 5666d56 commit 48a8b13
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ $(pwd)
# helps local on dev computer to manage different java-versions (see more: https://www.jenv.be/)
.java-version

# do not check in application profile yml
apigateway/**/application-*.yml
# do not check in local application profile yml
apigateway/**/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public ReactiveSessionRepository<MapSession> reactiveSessionRepository(
}

@Bean
@Profile({ "local", "test" })
@Profile({ "local", "docker", "test" })
public Config localConfig(@Value("${spring.session.timeout}") final int timeout) {
final var hazelcastConfig = new Config();
hazelcastConfig.setInstanceName(this.hazelcastInstanceName);
Expand Down
79 changes: 79 additions & 0 deletions apigateway/src/main/resources/application-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
server:
port: 8082

spring:

# Define the local keycloak realm here
realm: Dave

session.timeout: 36000

# spring cloud gateway config
cloud:
gateway:
actuator:
verbose:
enabled: false
globalcors:
corsConfigurations:
# The cors configuration to allow frontend developers cross origin request via this api gateway
'[/**]':
allowedOrigins:
- "http://localhost:8081"
- "http://127.0.0.1:8081"
allowedMethods: "*"
allowedHeaders: "*"
allowCredentials: true
maxAge: 3600
routes:
- id: sso
uri: ${SSO_BASE_URL}
predicates:
- Path=/api/sso/userinfo
filters:
- RewritePath=/api/sso/userinfo, /auth/realms/${spring.realm}/protocol/openid-connect/userinfo
- id: backend
uri: http://dave-backend:39146/
predicates:
- Path=/api/dave-backend-service/**
filters:
- name: Retry
args:
retries: 2
methods: GET,POST
backoff:
firstBackoff: 10ms
maxBackoff: 50ms
factor: 2
basedOnPreviousValue: false
- RewritePath=/api/dave-backend-service/(?<urlsegments>.*), /$\{urlsegments}
- RemoveResponseHeader=WWW-Authenticate
- id: eai
uri: http://localhost:8080/
predicates:
- Path=/api/dave-eai-service/**
metadata:
response-timeout: 1800000
filters:
- RewritePath=/api/dave-eai-service/(?<urlsegments>.*), /$\{urlsegments}
- RemoveResponseHeader=WWW-Authenticate
default-filters:
- RemoveResponseHeader=Expires
- RemoveRequestHeader=cookie
- RemoveRequestHeader=x-xsrf-token
- TokenRelay=

# security config
security:
oauth2:
client:
provider:
keycloak:
issuer-uri: ${SSO_BASE_URL}/auth/realms/${spring.realm}
registration:
keycloak:
client-id: dave
client-secret: ${SSO_CLIENT_SECRET}

http:
log-request-details: on
13 changes: 13 additions & 0 deletions apigateway/src/main/resources/application-no-security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
spring:
autoconfigure:
exclude:
- org.springframework.cloud.security.oauth2.gateway.TokenRelayAutoConfiguration
- org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration
cloud:
gateway:
# The whole list need to be overridden to remove CustomTokenRelayGatewayFilter
default-filters:
- RemoveResponseHeader=Expires
- RemoveRequestHeader=cookie
- RemoveRequestHeader=x-xsrf-token

2 changes: 1 addition & 1 deletion apigateway/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<springProperty scope="context" name="springAppName" source="spring.application.name"/>


<springProfile name="dev,kon,local,test,demo,hotfix">
<springProfile name="dev,kon,local,test,demo,hotfix,docker">

<!-- Log appender -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
Expand Down
20 changes: 20 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dokumentation

## Architektur

![Architektur](img/DAVe_Architektur_LS2.drawio.png)

## Technisches Setup
Zum schnellen Starten eines vollständig lauffähigen DAVe Datenportal ist im Verzeichnis "stack" ein docker-compose-Skript verfügbar.
Dieses fährt folgende Komponenten hoch:
* ElasticSearch
* Kibana
* H2-Datenbank
* DAVe-Backend
* DAVe-Frontend (Datenportal)

Die Security-Funktionen für Login etc. sind dabei ausgeschaltet.

Mit dem voreingestellten Profil "sample" wird eine Beispiel-Zählstelle mit einer Beispielzählung in die Datenbank bzw. den Index eingespielt.

Das Frontend ist nach dem Hochfahren unter "http://localhost:8082" verfügbar.
Binary file added docs/img/DAVe_Architektur_LS2.drawio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions stack/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: dave
services:

dave-frontend:
container_name: dave-frontend
image: itatm/dave-frontend:latest
environment:
- SPRING_PROFILES_ACTIVE=docker,no-security
- SSO_BASE_URL=http://sso.de
ports:
- "8082:8082"
pull_policy: always

dave-backend:
container_name: dave-backend
image: itatm/dave-backend:latest
environment:
- SPRING_PROFILES_ACTIVE=docker,no-security,sample
- elasticsearch.host=dave-elasticsearch
- SSO_BASE_URL=http://sso.de
ports:
- "39146:39146"
pull_policy: always
depends_on:
- elasticsearch
restart: on-failure

elasticsearch:
container_name: dave-elasticsearch
image: bitnami/elasticsearch:7.17.14
environment:
- discovery.type=single-node
- path.data=%USERPROFILE%/dave/data/mydatafile
volumes:
- c:/path/to/mydata:/usr/share/elasticsearch/data
ports:
- 9200:9200

kibana:
container_name: dave-kibana
image: bitnami/kibana:7.17.14
ports:
- 5601:5601

0 comments on commit 48a8b13

Please sign in to comment.