{"id":20710879,"url":"https://github.com/entur/uttu","last_synced_at":"2025-04-23T06:20:23.568Z","repository":{"id":37848233,"uuid":"145386475","full_name":"entur/uttu","owner":"entur","description":"Back-end for Nplan","archived":false,"fork":false,"pushed_at":"2025-04-17T04:51:55.000Z","size":2223,"stargazers_count":6,"open_issues_count":16,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-17T18:48:55.734Z","etag":null,"topics":["flexible-transport","java-11","postgresql","ror","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/entur.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-08-20T08:08:51.000Z","updated_at":"2025-04-17T04:46:24.000Z","dependencies_parsed_at":"2023-12-07T09:34:35.786Z","dependency_job_id":"dc667a1a-b97b-42b6-80da-604c89940a22","html_url":"https://github.com/entur/uttu","commit_stats":null,"previous_names":[],"tags_count":1141,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Futtu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Futtu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Futtu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/entur%2Futtu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/entur","download_url":"https://codeload.github.com/entur/uttu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250380374,"owners_count":21420941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flexible-transport","java-11","postgresql","ror","spring-boot"],"created_at":"2024-11-17T02:13:25.744Z","updated_at":"2025-04-23T06:20:23.560Z","avatar_url":"https://github.com/entur.png","language":"Java","readme":"# Uttu\n[![CircleCI](https://dl.circleci.com/status-badge/img/gh/entur/uttu/tree/master.svg?style=svg\u0026circle-token=a7e5de16c44926fd9d7dbb3e045dac39904005b2)](https://dl.circleci.com/status-badge/redirect/gh/entur/uttu/tree/master) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=entur_uttu\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=entur_uttu)\n\nBack-end for Nplan, a simple timetable editor. Front-end is [Enki](https://github.com/entur/enki).\n\n## Codestyle\n\nUttu uses [Prettier Java](https://github.com/jhipster/prettier-java). Use `mvn prettier:write` to reformat code before\npushing changes. You can also configure your IDE to reformat code when you save a file.\n\n## Security\n\nRunning uttu with vanilla security features requires an OAuth2 issuer, which can be set with the following property:\n\n```properties\nuttu.security.jwt.issuer-uri=https://my-jwt-issuer\n```\n\nIn addition, a UserContextService implementation must be selected. The following gives full access to all authenticated \nusers:\n\n```properties\nuttu.security.user-context-service=full-access\n```\n\n### Run without authentication\n\nFor the purpose of running locally, authentication can be switched off altogether by combining the\nfull-access property above with the `local-no-authentication` profile.\n\n## Organisation registry\n\nUttu needs an organisation registry in order to populate authority and operator references. You may\nprovide a NeTEx file of organisations with \n\n```properties\nuttu.organisations.netex-file-uri=\u003cpath-to-file\u003e\n```\n\nAlternatively, organisations data can be fetched over HTTP in NeTEx xml format:\n\n```properties\nuttu.organisations.netex-http-uri=\u003cpath-to-http-endpoint\u003e\n```\n\nNote that the HTTP strategy requires an organisations api WebClient bean called\n`orgRegisterClient`. A basic default is provided, but if you need anything more\nthan that, you should provide your own bean.\n\nRefer to [`src/test/resources/fixtures/organisations.xml`](src/test/resources/fixtures/organisations.xml) for an example\nof a NeTEx file with organisations.\n\nYou can also provide your own implementation of the [`OrganisationRegistry`](src/main/java/no/entur/uttu/organisation/spi/OrganisationRegistry.java)\ninterface.\n\n### Override exported authority or operator id\n\nIt is possible to override the exported authority or operator id for a given organisation like this:\n\n```properties\nno.entur.uttu.organisations.overrides={\\\n    'SomeInternalId': {\\\n        'Operator': 'KOL:Operator:BAR',\\\n        'Authority': 'KOL:Authority:BAR'\\\n    }\\\n}\n```\n\nThis is useful if the organisation registry uses internal IDs, but you need to map them to \"NeTEx\" IDs.\n\nYou can also map an existing NeTEx ID to something else:\n\n```properties\nno.entur.uttu.organisations.overrides={\\\n    'FOO:Operator:BAR': {\\\n        'Operator': 'FOO:Operator:BAZ'\\\n    }\\\n}\n```\n\nOverrides can also be provided per provider/codespace. The following override only applies\nwithin the FOO codespace during export.\n\n```properties\nno.entur.uttu.organisations.overrides.provider={\\\n    'FOO': {\\\n        'OldId': 'FOO:Operator:BAZ'\\\n    }\\\n}\n```\n\n\n\n## Stop place registry\n\nUttu needs a stop place registry in order to allow lookup of stop places from quay refs, used when creating\njourney patterns with fixed transit stops, and with hail-and-ride areas.\n\nYou may provide a NeTEx file of stop places with\n\n```properties\nuttu.stopplace.netex-file-uri=\u003cpath-to-file\u003e\n```\n\nor provide your own implementation of the [`StopPlaceRegistry`](src/main/java/no/entur/uttu/stopplace/spi/StopPlaceRegistry.java) interface.\n\nRefer to [`src/test/resources/fixtures/stopplace.xml`](src/test/resources/fixtures/stopplace.xml) for an example of a \nNeTEx file with stop places.\n\n## Optional export notification message\n\nIf you want to notify an external system about a NeTEx file export, you can\nprovide an implementation of the `MessagingService` interface –– see\n`src/main/java/no/entur/uttu/export/messaging/spi/MessagingService.java`.\n\nThe default MessagingService implementation is a noop.\n\n## Disable Google PubSub autoconfiguration\n\nIf you don't use Google PubSub, set this property:\n\n    # This property is needed to avoid pubsub autoconfiguration\n    spring.cloud.gcp.pubsub.enabled=false\n\n## Disable AWS S3 autoconfiguration\n\nIf you don't use AWS S3 through AWSpring, set this property:\n\n    # This property is needed to avoid AWS S3 autoconfiguration\n    spring.cloud.aws.s3.enabled=false\n\nThis feature is automatically enabled due to transitive dependency activation from \n`spring-cloud-aws-starter-secrets-manager` and should never be needed when running uttu in any of the available \nconfigurations.\n\n## Running locally\n\n### Local Environment through Docker Compose\n\nUttu has [docker-compose.yml](./docker-compose.yml) which contains all necessary dependent services for running uttu in\nvarious configurations. It is assumed this environment is always running when the service is being run locally \n(see below).\n\n\u003e **Note!** This uses the compose version included with modern versions of Docker, not the separately installable \n\u003e `docker-compose` command.\n\nAll Docker Compose commands run in relation to the `docker-compose.yml` file located in the same directory in which the \ncommand is executed.\n\n```shell\n# run with defaults - use ^C to shutdown containers\ndocker compose up\n# run with additional profiles, e.g. with LocalStack based AWS simulator\ndocker compose --profile aws up\n# run in background\ndocker compose up -d # or --detach\n# shutdown containers\ndocker compose down\n# shutdown containers included in specific profile\ndocker compose --profile aws down\n```\n\nSee [Docker Compose reference](https://docs.docker.com/compose/reference/) for official reference.\n\nSee [Supported Docker Compose Profiles](#supported-docker-compose-profiles) for more information on provided profiles.\n\n### Build\n\nTo build the project from source, you need Java 21 and Maven 3.\n\n### Database\n\n#### Via Docker Compose\n\nEnsure database is up with\n```shell\ndocker compose up -d\n```\n\nRun the [database initialization script](./src/main/resources/db_init.sh).\n\n```shell\n(cd src/main/resources \u0026\u0026 ./db_init.sh)\n```\n\n### Run\n\n**IntelliJ**: Right-click on `App.java` and choose Run (or Cmd+Shift+F10). Open Run -\u003e Edit configurations, choose the\ncorrect configuration (Spring Boot -\u003e App), and add `local` to Active profiles. Save the configuration.\n\n**Command line**: `mvn spring-boot:run`\n\nUttu web server will expose APIs on port 11701 by default.\n\n### GraphQL endpoints\n\nProvider-independent GraphQL endpoint:\n\n    /services/flexible-lines/providers/graphql\n\nProvider-specific GraphQL endpoint (replace {providerCode} with provider's codespace code):\n\n    /services/flexible-lines/{providerCode}/graphql\n\n## NeTEx Export\n\nUttu exports (via provider specific GraphQL API) generated NeTEx file to a blobstore repository.\nChoose one from the available implementations with matching profile:\n\n- `in-memory-blobstore` - stores exports in memory, exports are lost on restarts, suitable for development and testing\n- `disk-blobstore` - stores exports on disk\n- `gcp-blobstore` - stores exports in Google Cloud Storage, requires additional configuration\n- `s3-blobstore` - stores exports in Amazon Web Services Simple Storage Service (AWS S3), requires additional \n  configuration\n\nAlternatively, provide a\n[`BlobStoreRepository`](https://github.com/entur/rutebanken-helpers/blob/master/storage/src/main/java/org/rutebanken/helper/storage/repository/BlobStoreRepository.java)\nbean for custom behavior.\n\nThe following endpoint exposes exports for direct download:\n\n    /services/flexible-lines/{providerCode}/export/\n\n## Error code extension\n\nSome errors are augmented with a code extension. See [`ErrorCodeEnumeration`](src/main/java/no/entur/uttu/error/codes/ErrorCodeEnumeration.java) \nfor complete list of codes.\n\nThe code is optionally accompanied by a key-value metadata map under the `metadata` extension.\n\nThe extension appears in the response as follows (example is trimmed):\n\n```json\n{\n    \"errors\": [\n        {\n            \"extensions\": {\n                \"code\": \"ORGANISATION_NOT_VALID_OPERATOR\"\n            }\n        }\n    ]\n}\n```\n\nWith metadata: \n       \n```json\n{\n    \"errors\": [\n        {\n            \"extensions\": {\n                \"code\": \"ENTITY_IS_REFERENCED\",\n                \"metadata\": {\n                    \"numberOfReferences\": 1\n                 }\n            }\n        }\n    ]\n}\n``` \n\n## Supported Docker Compose Profiles\n\nUttu's [`docker-compose.yml`](./docker-compose.yml) comes with built-in profiles for various use cases. The profiles are\nmostly optional, default profile contains all mandatory configuration while the named profiles add features on top of \nthat. You can always active zero or more profiles at the same time, e.g.\n\n```shell\ndocker compose --profile aws --profile routing up\n# or\nCOMPOSE_PROFILES=aws,routing docker compose up\n```\n\n### Default profile (no activation key)\n\nStarts up PostGIS server with settings matching the ones in [`application-local.properties`](./src/main/resources/application-local.properties).\n\n### `aws` profile\n\nStarts up [LocalStack](https://www.localstack.cloud/) meant for developing AWS specific features.\n\nSee also [Disable AWS S3 Autoconfiguration](#disable-aws-s3-autoconfiguration), [NeTEx Export](#netex-export).\n\n### `routing` profile\n\nProvides pre-made configuration for running (presumably) [OSRM Server](https://project-osrm.org/) to be used for \nnavigation routing features. **However**, the image used is not the default, but instead named `osrm-routing` to allow \nthe use of custom internal/external image with precalculated data. As this is very dependent on how the image is \ncreated, we recommend that you use the provided `Dockerfile` below as base and adapt accordingly:\n\n```Dockerfile\nARG IMAGE_TAG=v5.27.1\nFROM ghcr.io/project-osrm/osrm-backend:$IMAGE_TAG AS build\n\nRUN apt-get -y update \\\n    \u0026\u0026 apt-get -y install curl \\\n    \u0026\u0026 apt-get clean\nRUN mkdir /data \\\n    \u0026\u0026 cd /data \\\n    \u0026\u0026 curl -O 'https://download.geofabrik.de/europe/norway-latest.osm.pbf'\nRUN ls -lah /data\nRUN osrm-extract -p /opt/car.lua /data/norway-latest.osm.pbf\nRUN osrm-partition /data/norway-latest.osrm\nRUN osrm-customize /data/norway-latest.osrm\n\nFROM ghcr.io/project-osrm/osrm-backend:$IMAGE_TAG\nCOPY --from=build /data /data\nENTRYPOINT osrm-routed --algorithm mld /data/norway-latest.osrm\n```\n\nSave the above into `Dockerfile-osrm-routing` and build the image with\n```shell\ndocker build --platform linux/amd64 -f Dockerfile-osrm-routing -t osrm-routing .\n\nSee also [Running locally](#running-locally).\n","funding_links":[],"categories":["Producing Data"],"sub_categories":["GTFS"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Futtu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fentur%2Futtu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fentur%2Futtu/lists"}