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

Add swagger-ui into docker network to allow viewing Canton JSON API V2 Open API spec in browser #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

judywu-da
Copy link
Contributor

Purpose as titled
The PR is aimed to address the issue proposed here

@judywu-da judywu-da requested a review from a team as a code owner February 26, 2025 07:40
server_name swagger.localhost;
location /docs/openapi {
proxy_pass http://participant-app-provider:7575/docs/openapi;
add_header Access-Control-Allow-Origin *;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added headers here to allow CORS, avoiding the issue mentioned here

swagger-ui:
image: swaggerapi/swagger-ui
ports:
- "9080:8080"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port to 9080 as 8080 is used for backend service already

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it's necessary to make this port configurable in .env file 🤔 , lemme know if you think that's better. 🙏

Comment on lines +185 to +186
start-swagger-ui:
docker compose -f docker/swagger/compose.yaml $(DOCKER_COMPOSE_ENVFILE) up -d || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to remove the -d flag and start the service in the foreground rather than having start/stop/restart/clean lifecycle targets (I would remove the other ones). It can then be terminated conventionally with ctrl-c. I think this is enough because the UI doesn't interact directly with the application as a service.

In that case it would make sense to log/@echo out the URL to open the UI before startup from the make target.

If instead you prefer the existing lifecycle targets, please also add a clean-target and depend on it from clean-docker.

In either case please also add the ## docstrings so that the targets show up in make help 🙏

@filmackay filmackay linked an issue Mar 8, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Swagger UI docker service to export JSON API V2 OpenAPI docs
2 participants