How to deploy on OpenShift a Swagger UI to access the Swagger Doc

1,903 views
Skip to first unread message

Charles Moulliard

unread,
Nov 4, 2016, 1:23:56 PM11/4/16
to fabric8
Hi,

How can we deploy on OpenShift a Swagger UI to access the Swagger Doc exposed by a Camel Rest endpoint of a POD ?

Address to access : http $(minishift service spring-boot-camel-rest-s --url=true)/camel-rest-sql/api-doc

Regards,

Charles

Antonin Stefanutti

unread,
Nov 4, 2016, 1:34:08 PM11/4/16
to Charles Moulliard, fabric8
Hi Charles,

In case your need is just to consume / test some Swagger doc API, you can have the Swagger UI run locally by following the instructions in https://github.com/swagger-api/swagger-ui. I’ve done that for the development of the SB Camel REST SQL quickstart and that works fine.

That being said, that’d be great to have a one-click way to have the Swagger doc API hosted on OpenShift. There are a couple of Docker images out there that gets the Swagger UI dist package and starts a HTTP server:

...

That may be a start.

Antonin

--
You received this message because you are subscribed to the Google Groups "fabric8" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Charles Moulliard

unread,
Nov 4, 2016, 2:22:05 PM11/4/16
to Antonin Stefanutti, fabric8
Do you know if we can get the correct IP address as by default with sb-camel-rest-sql, 0.0.0.0 will be used ?


To unsubscribe from this group and stop receiving emails from it, send an email to fabric8+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.




--
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Charles Moulliard

unread,
Nov 5, 2016, 5:48:38 AM11/5/16
to Antonin Stefanutti, fabric8
To make it works with local swagger-ui (= available from a local node http-server at the address http://localhost:8082/dist), 2 modifications will be required within the SB-camel-rest-sql project

1) Enable CORS at the level of the endpoint

rest("/books").description("Books REST service").enableCORS(true)

2) Specifiy the host and/or port for the api

                    .host("spring-boot-camel-rest-s-default.192.168.64.56.xip.io/camel-rest-sql") // IF WE EXPOSE THE SERVICE AS A ROUTE
                    .apiContextRouteId("doc-api")
                .component("servlet")
                .bindingMode(RestBindingMode.json);

   
Reply all
Reply to author
Forward
0 new messages