-
Notifications
You must be signed in to change notification settings - Fork 32
📝 services.md: autodocs openapi specs and images for each service
#6779
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
Merged
pcrespov
merged 15 commits into
ITISFoundation:master
from
pcrespov:is23/readmes-services
Nov 21, 2024
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
59547f1
script
pcrespov 12cec1a
table
pcrespov adbe546
rm badges
pcrespov aaf32f0
cleanup
pcrespov 13ed7a8
cleanup
pcrespov 3bd4523
rename
pcrespov 8dedfb4
cleanup
pcrespov 7457d84
more items
pcrespov 29fff2a
doc
pcrespov 56be134
two cols
pcrespov ae4f745
adds doc
pcrespov 18c2170
missing
pcrespov d395dff
@bisgaard-itis review: key fun and wording
pcrespov e0b4afe
@bisgaard-itis review: key fun and wording
pcrespov f3788ad
minor
pcrespov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| #!/bin/env python | ||
| """ Usage | ||
|
|
||
| cd osparc-simcore | ||
| ./scripts/echo_services_markdown.py >services.md | ||
| """ | ||
|
|
||
| import itertools | ||
| import sys | ||
| from collections.abc import Iterable | ||
| from datetime import datetime | ||
| from operator import attrgetter | ||
| from pathlib import Path | ||
| from typing import Final, NamedTuple | ||
|
|
||
| CURRENT_FILE = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve() | ||
| CURRENT_DIR = CURRENT_FILE.parent | ||
|
|
||
| _URL_PREFIX: Final[ | ||
| str | ||
| ] = "https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master" | ||
|
|
||
| _REDOC_URL_PREFIX: Final[str] = f"https://redocly.github.io/redoc/?url={_URL_PREFIX}" | ||
| _SWAGGER_URL_PREFIX: Final[str] = f"https://petstore.swagger.io/?url={_URL_PREFIX}" | ||
|
|
||
|
|
||
| def _to_row(values: Iterable): | ||
| return f"| {'|'.join(map(str, values))} |\n" | ||
|
|
||
|
|
||
| class CaptureTuple(NamedTuple): | ||
| service_name: str | ||
| file_path: Path | ||
|
|
||
|
|
||
| service_names_aliases: dict[str, str] = {"web": "webserver"} | ||
|
|
||
|
|
||
| def generate_markdown_table( | ||
| *captured_files: Iterable[CaptureTuple], | ||
| ) -> str: | ||
| title = ("Name", "Files", " ") | ||
| lines = ["-" * 10] * len(title) | ||
|
|
||
| table = _to_row(title) | ||
| table += _to_row(lines) | ||
|
|
||
| found = itertools.groupby( | ||
| sorted(itertools.chain(*captured_files), key=attrgetter("service_name")), | ||
| key=attrgetter("service_name"), | ||
| ) | ||
|
|
||
| for name, service_files in found: | ||
| table += _to_row( | ||
| ( | ||
| f"**{name.upper()}**", | ||
| "", | ||
| "", | ||
| ) | ||
| ) | ||
| for _, file_path in service_files: | ||
| linked_path = f"[{file_path}](./{file_path})" | ||
|
|
||
| # SEE https://shields.io/badges | ||
| badges = [] | ||
|
|
||
| if file_path.stem.lower() == "dockerfile": | ||
| repo = service_names_aliases.get(f"{name}") or name | ||
| badges = [ | ||
| f"[](https://hub.docker.com/r/itisfoundation/{repo}/tags)" | ||
| ] | ||
|
|
||
| elif file_path.stem.lower() == "openapi": | ||
| badges = [ | ||
| f"[]({_REDOC_URL_PREFIX}/{file_path}) " | ||
| f"[]({_SWAGGER_URL_PREFIX}/{file_path})", | ||
| ] | ||
|
|
||
| table += _to_row( | ||
| ( | ||
| "", | ||
| linked_path, | ||
| " ".join(badges), | ||
| ) | ||
| ) | ||
|
|
||
| table += _to_row(["" * 10] * len(title)) | ||
| return table | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
| repo_base_path = CURRENT_DIR.parent.resolve() | ||
| services_path = repo_base_path / "services" | ||
|
|
||
| def _to_tuple(file: Path): | ||
| return CaptureTuple( | ||
| f"{file.relative_to(services_path).parents[-2]}", | ||
| file.relative_to(repo_base_path), | ||
| ) | ||
|
|
||
| dockerfiles_found = (_to_tuple(file) for file in services_path.rglob("Dockerfile")) | ||
|
|
||
| openapi_files_found = ( | ||
| _to_tuple(file) | ||
| for file in services_path.rglob("openapi.*") | ||
| if file.suffix in {".json", ".yaml", ".yml"} | ||
| ) | ||
|
|
||
| markdown_table = generate_markdown_table( | ||
| openapi_files_found, | ||
| dockerfiles_found, | ||
| ) | ||
| now = datetime.now().strftime("%Y-%m-%d %H:%M:%S") | ||
|
|
||
| print("# services") | ||
| print(">") | ||
| print(f"> Auto generated on {now} by ") | ||
| print("```cmd") | ||
| print("cd osparc-simcore") | ||
| print(f"python ./{CURRENT_FILE.relative_to(repo_base_path)}") | ||
| print("```") | ||
| print(markdown_table) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # services | ||
| > | ||
| > Auto generated on 2024-11-20 21:36:46 by | ||
pcrespov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```cmd | ||
| cd osparc-simcore | ||
| python ./scripts/echo_services_markdown.py | ||
| ``` | ||
| | Name|Files| | | ||
| | ----------|----------|---------- | | ||
| | **AGENT**|| | | ||
| | |[services/agent/Dockerfile](./services/agent/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/agent/tags) | | ||
| | **API-SERVER**|| | | ||
| | |[services/api-server/openapi.json](./services/api-server/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/api-server/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/api-server/openapi.json) | | ||
| | |[services/api-server/Dockerfile](./services/api-server/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/api-server/tags) | | ||
| | **AUTOSCALING**|| | | ||
| | |[services/autoscaling/Dockerfile](./services/autoscaling/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/autoscaling/tags) | | ||
| | **CATALOG**|| | | ||
| | |[services/catalog/openapi.json](./services/catalog/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/catalog/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/catalog/openapi.json) | | ||
| | |[services/catalog/Dockerfile](./services/catalog/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/catalog/tags) | | ||
| | **CLUSTERS-KEEPER**|| | | ||
| | |[services/clusters-keeper/Dockerfile](./services/clusters-keeper/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/clusters-keeper/tags) | | ||
| | **DASK-SIDECAR**|| | | ||
| | |[services/dask-sidecar/Dockerfile](./services/dask-sidecar/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/dask-sidecar/tags) | | ||
| | **DATCORE-ADAPTER**|| | | ||
| | |[services/datcore-adapter/Dockerfile](./services/datcore-adapter/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/datcore-adapter/tags) | | ||
| | **DIRECTOR**|| | | ||
| | |[services/director/src/simcore_service_director/api/v0/openapi.yaml](./services/director/src/simcore_service_director/api/v0/openapi.yaml)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/director/src/simcore_service_director/api/v0/openapi.yaml) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/director/src/simcore_service_director/api/v0/openapi.yaml) | | ||
| | |[services/director/Dockerfile](./services/director/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/director/tags) | | ||
| | **DIRECTOR-V2**|| | | ||
| | |[services/director-v2/openapi.json](./services/director-v2/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/director-v2/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/director-v2/openapi.json) | | ||
| | |[services/director-v2/Dockerfile](./services/director-v2/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/director-v2/tags) | | ||
| | **DYNAMIC-SCHEDULER**|| | | ||
| | |[services/dynamic-scheduler/openapi.json](./services/dynamic-scheduler/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-scheduler/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-scheduler/openapi.json) | | ||
| | |[services/dynamic-scheduler/Dockerfile](./services/dynamic-scheduler/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/dynamic-scheduler/tags) | | ||
| | **DYNAMIC-SIDECAR**|| | | ||
| | |[services/dynamic-sidecar/openapi.json](./services/dynamic-sidecar/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-sidecar/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-sidecar/openapi.json) | | ||
| | |[services/dynamic-sidecar/Dockerfile](./services/dynamic-sidecar/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/dynamic-sidecar/tags) | | ||
| | **EFS-GUARDIAN**|| | | ||
| | |[services/efs-guardian/Dockerfile](./services/efs-guardian/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/efs-guardian/tags) | | ||
| | **INVITATIONS**|| | | ||
| | |[services/invitations/openapi.json](./services/invitations/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/invitations/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/invitations/openapi.json) | | ||
| | |[services/invitations/Dockerfile](./services/invitations/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/invitations/tags) | | ||
| | **MIGRATION**|| | | ||
| | |[services/migration/Dockerfile](./services/migration/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/migration/tags) | | ||
| | **OSPARC-GATEWAY-SERVER**|| | | ||
| | |[services/osparc-gateway-server/Dockerfile](./services/osparc-gateway-server/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/osparc-gateway-server/tags) | | ||
| | **PAYMENTS**|| | | ||
| | |[services/payments/openapi.json](./services/payments/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/openapi.json) | | ||
| | |[services/payments/gateway/openapi.json](./services/payments/gateway/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/gateway/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/gateway/openapi.json) | | ||
| | |[services/payments/Dockerfile](./services/payments/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/payments/tags) | | ||
| | **RESOURCE-USAGE-TRACKER**|| | | ||
| | |[services/resource-usage-tracker/openapi.json](./services/resource-usage-tracker/openapi.json)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/resource-usage-tracker/openapi.json) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/resource-usage-tracker/openapi.json) | | ||
| | |[services/resource-usage-tracker/Dockerfile](./services/resource-usage-tracker/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/resource-usage-tracker/tags) | | ||
| | **STATIC-WEBSERVER**|| | | ||
| | |[services/static-webserver/client/tools/qooxdoo-kit/builder/Dockerfile](./services/static-webserver/client/tools/qooxdoo-kit/builder/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/static-webserver/tags) | | ||
| | **STORAGE**|| | | ||
| | |[services/storage/src/simcore_service_storage/api/v0/openapi.yaml](./services/storage/src/simcore_service_storage/api/v0/openapi.yaml)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/storage/src/simcore_service_storage/api/v0/openapi.yaml) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/storage/src/simcore_service_storage/api/v0/openapi.yaml) | | ||
| | |[services/storage/Dockerfile](./services/storage/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/storage/tags) | | ||
| | **WEB**|| | | ||
| | |[services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml](./services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml)|[](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml) [](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml) | | ||
| | |[services/web/Dockerfile](./services/web/Dockerfile)|[](https://hub.docker.com/r/itisfoundation/webserver/tags) | | ||
| | || | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,4 @@ | ||
| # storage | ||
|
|
||
| [](https://hub.docker.com/r/itisfoundation/storage/tags) | ||
| [](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
| [](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
| [](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
|
|
||
| Service to manage data storage in simcore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.