Skip to content

Commit

Permalink
Configure Static Web Host Meta
Browse files Browse the repository at this point in the history
For services that are outside of the control of the team that uses
PREvant and where is no possibility to create a resource route for
.well-known/host-meta.json it is now possible to configure a static URL
to the OpenAPI documentation that will be then integrated into the
PREvant dashboard. This file will be massaged so that it points to the
service service URL.

Also, this commit makes sure that Kubernetes Ingresses with path prefix
will be mapped correctly. Without this you won't be able to expose
multiple prefixes in a bootstrapped environment.

Additionally, PREVant provide a new CLI option to debug new config from
the outside and reduces some network calls.
  • Loading branch information
schrieveslaach committed Feb 4, 2025
1 parent c1128d1 commit f37e905
Show file tree
Hide file tree
Showing 28 changed files with 1,387 additions and 450 deletions.
44 changes: 5 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,44 +109,11 @@ In this section, you'll find examples of deploying PREvant in container environm

To customize the behavior of PREvant, you can mount a TOML file into the container at `/app/config.toml`. More details about the configuration can be found [here](docs/configuration.md).

# Requirements for Your Services

PREvant is able to show the version of your service (build time, version string, and git commit hash) and also to integrate your API specification into the frontend through [Swagger UI](https://swagger.io/tools/swagger-ui/). In order to show the information, PREvant tries to resolve it by using the web-based protocol proposed by [RFC 6415](https://tools.ietf.org/html/rfc6415).

When you request the list of apps and services running through the frontend, PREvant makes a request for each service to the URL `.well-known/host-meta.json` and expects that the resource provides a [host-meta document](http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html) serialized as JSON:

```json
{
"properties": {
"https://schema.org/softwareVersion": "0.9",
"https://schema.org/dateModified": "2019-04-09T15:31:01.363+0200",
"https://git-scm.com/docs/git-commit": "43de4c6edf3c7ed93cdf8983f1ea7d73115176cc"
},
"links": [
{
"rel": "https://github.com/OAI/OpenAPI-Specification",
"href": "https://example.com/master/service-name/swagger.json"
},
{
"rel": "https://github.com/asyncapi/spec",
"href": "https://github.com/asyncapi/spec/blob/master/examples/streetlights-kafka-asyncapi.yml"
}
]
}
```

This sample document contains the relevant information displayed in the frontend (each information is optional):

- The software version of the service (see `https://schema.org/softwareVersion`)
- The build time of the service (see `https://schema.org/dateModified`)
- The git commit id of the service (see `https://git-scm.com/docs/git-commit`)
- The link to the OpenAPI specification (see `https://github.com/OAI/OpenAPI-Specification`)
- The link to the AsyncAPI specification (see `https://github.com/asyncapi/spec`)

In order to generate the correct link to the API specification, PREvant adds following headers to each of these requests:

- [`Forwarded` header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded) with `host` and `proto`.
- `X-Forwarded-Prefix` (used by some reverse proxies, cf. [Traefik](https://docs.traefik.io/basics/) and [Zuul](https://cloud.spring.io/spring-cloud-static/Finchley.SR1/multi/multi__router_and_filter_zuul.html)).
# Integration of Your Services into the dashboard

As shown above in the screenshot, PREvant offers some integration into its
dashboard. How the integration can be achieved is documented
[here](docs/web-host-meta.md).

# Development

Expand All @@ -158,7 +125,6 @@ addressing issues, enhancing documentation, and submitting pull requests. The
project's open-source nature encourages collaboration and innovation from the
developer community.


# Further Readings

PREvant's concept has been published in the [Joint Post-proceedings of the First and Second International Conference on Microservices (Microservices 2017/2019): PREvant (Preview Servant): Composing Microservices into Reviewable and Testable Applications](http://dx.doi.org/10.4230/OASIcs.Microservices.2017-2019.5).
Expand Down
59 changes: 30 additions & 29 deletions api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pest = "2.7"
pest_derive = "2.7"
regex = "1.11"
regex-syntax = "0.8"
reqwest = "0.12"
rocket = { version = "0.5", features = ["json"] }
schemars = "0.8"
secstr = { version = "0.5", features = ["serde"] }
Expand Down
Loading

0 comments on commit f37e905

Please sign in to comment.