Serving Swagger-UI in JHipster servers and microservices - swagger

JHipster servers and microservices don't serve their own Swagger UI. Instead the microservice gateway aggregates all api-docs and serves them in one place, using a custom Swagger UI within the Angular Frontend.
But when using standalone JHipster servers or microservices, there is no frontend and thus no Swagger-UI at all.
In those instances, how can you force the server or microservice to serve its own Swagger-UI?

Related

How to properly setup Keycloak redirects behind reverse proxy with SpringSecurity

I have a Spring based application, which uses keycloak-spring-security-adapter to handle the Keycloak specific stuff. This server is deployed on same machine as the Keycloak server, and both of them are running behind Nginx reverse proxy.
The Spring app has in its keycloak.json configuration the correct proxy-url. The Keycloak server has the the frontendUrl set to the correct proxy-url. When testing on localhost without the reverse proxy everything works as expected.
The issue is when deployed with the reverse-proxy in front. The Spring application runs the OIDC service discovery during startup. But to do this, is uses the public URL. This fails, because the on the backend side, the reverse proxy is not in DNS record.
How to setup the keycloak-spring-security-adapter in such a way, that for the backend requests it uses local URL. But for the logins that are done through the JSP pages in the browser, it uses the proxied URL?

Swagger UI and REST API on different servers

I have my services running in kubernetes cluster and swagger UI deployed in different K8 cluster. Now when I start the swagger UI application it tries to look for the APIs in the same cluster and gives 404. I am using swagger2. How can tell swagger UI about the host for all the APIs?
All paths are relative to the API server URL. The full request URL is constructed as /path. Global servers can also be overridden on the path level or operation level.
More:
https://swagger.io/docs/specification/paths-and-operations/
Please see this documentation for the correct kubernetes nodes and cluster addresses:
https://kubernetes.io/docs/concepts/architecture/nodes/

Authorization server behind kubernetes ingress?

I want to deploy a few Spring Boot microservices on Kubernetes cluster. One of them is authorization server serving OAuth 2.0 tokens. With current deployment (no k8s) only two services are visible to the outer world: api-gateway (Zuul) and authorization-server (Spring OAuth). The rest is hidden behind the api-gateway. During k8s deployment Zuul proxy probably will be substituted by Kubernetes Ingress.
Now the questions:
Should I put authorization-server behind the Ingress or not?
What are pros and cons concerning these two solutions?
What are best practices?
Maybe I shouldn't get rid of Zuul at all?
Getting rid of Zuul is perfectly reasonable. Ingress should be the only outer-cluster accessible component that provides access to the cluster through ingress rules.
So yes, authorization-server and microservices should be accessible through ingress.

Can micronaut work with gateways like zuul or spring cloud gateway?

The main issue is the compatibility of the registry.
If not, how to deal with gateway issues?
Depends what you mean. You can use Zuul or Spring Cloud Gateway as your gateway solution in front of a Micronaut application.
Ultimately a Micronaut application will register itself with Eureka or Consul and then Zuul or SCG will discovery the service via service discovery and route requests to the Micronaut app over HTTP.

Combining/Integrating Swagger & Slate with Spring Microservices

I have a set of dockerized microservices (spring boot with jersey application) deployed on EC2 instances. Each service exposes rest apis which i need to create a spec for.
As a first step, i have included swagger-core in all the spring boot apps which generates a .json/.yaml file and serves it on http as a rest resource when the service is up.
I want to use slate to serve the api specification for all the services as a single resource (aggregated from individual json/yaml files) over http/s.
Slate (https://github.com/lord/slate) uses markdown format to serve the static content.
Library Swagger2Markup can be used to generate the markdown file by aggregating the api specs (json/yaml files) from each services (each have their own json/yaml file generated).
Using this markdown file, i can use slate default middleman to build the static content and serve it over http.
Question: what can be considered a best practice for seamlessly integrating this process to the jenkins build.

Resources