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

Option to enable swagger UI in release build publishers. (OPCPublisher:latest API Server not working) #2009

Closed
sa1sen opened this issue Jul 4, 2023 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@sa1sen
Copy link

sa1sen commented Jul 4, 2023

Hello,

I am trying to follow this example below:

Calling the API over HTTP
(This feature is in preview)

You can now send HTTP requests to the publisher module http server at https://localhost:8081. The unsecure endpoint is mounted at https://localhost:8080 for testing purpuses. E.g. to get the swagger definition run:
curl http://localhost:8080/swagger/v2/openapi.json"

However, I get 'Failed to connect to localhost port 8080' error message. I have tried using the 'netstat -an' command to list out all ports available on localhost and I cannot find 8080 / 8081

.

What I have done:

  1. Made sure all local ports connection are enabled for UDP + TCP in Windows Firewall for both inbound and outbound rules
  2. Tried Adding '--DisableHttpServer=disabled' , "--httpserverport", "--unsecurehttp" to the OPC Publisher Module as part of Container Create Options

But still no luck

@marcschier
Copy link
Collaborator

If you want to access the server on the localhost you need to create a port binding from 80 to 8080 and 443 to 8081 like in the deployment.json in the same folder. No other command line arguments should be needed. You do not need to export the ports if you use a module in the same Azure IoT Edge docker network to access the server. (But then you use just https://) since 443 port is secured using a IoT Edge module SSL certificate which should be in the module trust list.

@marcschier
Copy link
Collaborator

You can follow the instructions to run the module in iotedgehubdev using the deployment.json file in the repo. If the http api is then not accessible, please reopen and add repro steps, and the deployment manifest you used.

@marcschier marcschier reopened this Jul 4, 2023
@marcschier
Copy link
Collaborator

I noticed that swagger is off in release builds. Will add a command line option to turn it on or off for both release and debug.

@marcschier
Copy link
Collaborator

Also, the title says ":latest", the tag for 2.9.0 is "2.9.0-preview4" if that makes a difference. It is possible that the deployment.json refers to latest, but latest is still 2.8.6 at this point.

@marcschier marcschier changed the title OPCPublisher:latest API Server not working Option to enable swagger UI in release build publishers. (OPCPublisher:latest API Server not working) Jul 4, 2023
@marcschier marcschier added this to the 2.9.0 milestone Jul 4, 2023
@marcschier marcschier added the bug Something isn't working label Jul 4, 2023
@marcschier marcschier self-assigned this Jul 4, 2023
@marcschier
Copy link
Collaborator

Swagger UI will be always on in 2.9, you can disable using --doa, --disableopenapi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants