Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: added more detailed config instructions in readme #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ src/main/resources/stops/agency.txt

local_config/
node_modules

.vscode/

src/main/resources/application.properties
80 changes: 50 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,20 @@ Tiamat supports looking up and populating references to tariff zones and topogra
Stop places and other entities are versioned. This means that you have full version history of stop places and what person that made those changes.
Tiamat also includes a diff tool. This is used to compare and show the difference between two versions of a stop place (or other entity).


## Build
`mvn clean install`

You need the directory `/deployments/data` with rights for the user who
performs the build.




## Integration tests
Tiamat uses testcontainers to run integration tests against a real database. To run Testcontainers-based tests, you need a Docker-API compatible container runtime
for more detail see https://www.testcontainers.org/supported_docker_environment/

(default profiles are set in application.properties)

## Run with external properties file and PostgreSQL
To run with PostgreSQL you ned an external application.properties.
To run with PostgreSQL you need an external application.properties.
Below is an example of application.properties:
```
spring.jpa.database=POSTGRESQL
Expand All @@ -74,7 +70,6 @@ spring.http.gzip.enabled=true

#spring.jpa.properties.hibernate.format_sql=true


spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.batch_versioned_data=true

Expand Down Expand Up @@ -104,8 +99,6 @@ spring.jpa.properties.hibernate.jdbc.batch_size=20
spring.jpa.properties.hibernate.default_batch_fetch_size=16
spring.jpa.properties.hibernate.generate_statistics=false



changelog.publish.enabled=false


Expand All @@ -115,13 +108,10 @@ jettyMinThreads=1
spring.datasource.hikari.maximumPoolSize=40
spring.datasource.hikari.leakDetectionThreshold=30000



tiamat.locals.language.default=eng

tariffZoneLookupService.resetReferences=true


debug=true

# Disable feature detection by this undocumented parameter. Check the org.hibernate.engine.jdbc.internal.JdbcServiceImpl.configure method for more details.
Expand All @@ -142,15 +132,10 @@ spring.datasource.url=jdbc:postgresql://localhost:5436/tiamat
spring.datasource.username=tiamat
spring.datasource.password=tiamat




aspect.enabled=true

netex.id.valid.prefix.list={TopographicPlace:{'KVE','WOF','OSM','ENT','LAN'},TariffZone:{'*'},FareZone:{'*'},GroupOfTariffZones:{'*'}}



server.port=1888

blobstore.gcs.blob.path=exports
Expand All @@ -163,31 +148,49 @@ management.security.enabled=false
authorization.enabled = true
rutebanken.kubernetes.enabled=false

#OAuth2 Resource Server
tiamat.oauth2.resourceserver.auth0.ror.jwt.audience=notinuse
tiamat.oauth2.resourceserver.auth0.ror.claim.namespace=notinuse



#keycloak config
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8080/auth/realms/entur
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8080/realms/entur/protocol/openid-connect/certs


async.export.path=/tmp


publicationDeliveryUnmarshaller.validateAgainstSchema=false
publicationDeliveryStreamingOutput.validateAgainstSchema=false
netex.validPrefix=NSR
netex.profile.version=1.12:NO-NeTEx-stops:1.4
blobstore.local.folder=/tmp/local-gcs-storage/tiamat/export
spring.profiles.active=local-blobstore,activemq

```

To start Tiamat with specific `application.properties` set the **spring.config.location** system property like:

`java -jar -Dspring.config.location=/path/to/application.properties --add-opens java.base/java.lang=ALL-UNNAMED -Denv=dev tiamat-0.0.2-SNAPSHOT.jar`



*Note: For VSCode users you can set this as a launch config in .vscode/launch.json file (example below)*
```
{
"configurations": [
{
"type": "java",
"name": "Spring Boot-TiamatApplication<tiamat>",
"request": "launch",
"cwd": "${workspaceFolder}",
"mainClass": "org.rutebanken.tiamat.TiamatApplication",
"projectName": "tiamat",
"args": "",
"envFile": "${workspaceFolder}/.env",
"vmArgs": "-Denv=dev -Dspring.config.location=/path/to/application.properties --add-opens java.base/java.lang=ALL-UNNAMED"
}
]
}

To start Tiamat with this configuration, specify **spring.config.location**:

`java -jar -Dspring.config.location=/path/to/tiamat.properties --add-opens java.base/java.lang=ALL-UNNAMED -Denv=dev tiamat-0.0.2-SNAPSHOT.jar`
```

## Database

Expand Down Expand Up @@ -220,13 +223,30 @@ It's all initiated by an entity listener annotated with `PrePersist` on the clas
## Keycloak/Auth0
Both Tiamat and Abzu are set up to be used with Keycloak or Auth0.

Run a docker container with Keycloak:
```
docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:23.0.1 start-dev
```


### Keycloak configuraiton
- Create realm e.g. Entur
- Create client for frontend e.g. abzu
- Under client setting configure Mapper e.g. entur-roles
- Create Roles e.g. deleteStop, editStop, viewStop
- Add User and assign roles
- Add User attribute roles `{"r":"editStops","o":"NSB","e":{"StopPlaceType":["*"]}}##{"r":"editStops","o":"RB","e":{"EntityType":["*"]}}##{"r":"deleteStops","o":"RB","e":{"EntityType":["StopPlace"]}}##{"r":"deleteStops","o":"RB"}##{"r":"editRouteData","o":"RUT"}`
- Go to http://localhost:8080/admin/master/console/
- From top left create a new realm
- Set the realm name to "entur"
- Go to "Clients"
- create a new client with id "entur-abzu"
- leave everything else as default/blank
- Under client Roles:
- Create the 3 roles with names:
- "deleteStop", "editStop", "viewStop"
- Go to "Users"
- Crete new user called "abzu-user" (this will be used by the frontent app (abzu))
- Go to "Role mapping" and click "Assign role":
- From the filters select "Filter by clienst"
- assign the 3 roles from the client "entur-abzu"
- click "Assign"
- Go to "Attributes" and add the following attribute:
- key: "roles" with value: `{"r":"editStops","o":"NSB","e":{"StopPlaceType":["*"]}}##{"r":"editStops","o":"RB","e":{"EntityType":["*"]}}##{"r":"deleteStops","o":"RB","e":{"EntityType":["StopPlace"]}}##{"r":"deleteStops","o":"RB"}##{"r":"editRouteData","o":"RUT"}`


## Validation for incoming and outgoing NeTEx publication delivery
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public Object get(DataFetchingEnvironment environment) {
ignoreStopPlaceId = environment.getArgument(IGNORE_STOPPLACE_ID);
}

if (environment.getArgument(INCLUDE_EXPIRED)) {
if (environment.getArgument(INCLUDE_EXPIRED) != null) {
pointInTime = null;
}
stopPlacesPage = stopPlaceRepository.findStopPlacesWithin(boundingBox.xMin, boundingBox.yMin, boundingBox.xMax,
Expand Down