-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝
services.md
: autodocs openapi specs and images for each service (#…
- Loading branch information
Showing
7 changed files
with
202 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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 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,134 @@ | ||
#!/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}" | ||
|
||
|
||
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", " ") | ||
num_cols = len(title) | ||
lines = ["-" * 10] * num_cols | ||
|
||
def _to_row_data(values: Iterable) -> list[str]: | ||
row = list(map(str, values)) | ||
assert len(row) == num_cols, f"len({row=}) != {num_cols=}" | ||
return row | ||
|
||
rows = [ | ||
_to_row_data(title), | ||
_to_row_data(lines), | ||
] | ||
|
||
found = itertools.groupby( | ||
sorted(itertools.chain(*captured_files), key=attrgetter("service_name")), | ||
key=attrgetter("service_name"), | ||
) | ||
|
||
for name, service_files in found: | ||
rows.append( | ||
_to_row_data( | ||
( | ||
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"[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/{repo})](https://hub.docker.com/r/itisfoundation/{repo}/tags)" | ||
] | ||
|
||
elif file_path.stem.lower() == "openapi": | ||
badges = [ | ||
f"[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)]({_REDOC_URL_PREFIX}/{file_path}) " | ||
f"[![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)]({_SWAGGER_URL_PREFIX}/{file_path})", | ||
] | ||
|
||
rows.append( | ||
_to_row_data( | ||
( | ||
"", | ||
linked_path, | ||
" ".join(badges), | ||
) | ||
) | ||
) | ||
rows.append(_to_row_data(["" * 10] * num_cols)) | ||
|
||
# converts to markdown table | ||
return "\n".join(f"| {'|'.join(r)} |" for r in rows) | ||
|
||
|
||
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}` using ") | ||
print("```cmd") | ||
print("cd osparc-simcore") | ||
print(f"python ./{CURRENT_FILE.relative_to(repo_base_path)}") | ||
print("```") | ||
print(markdown_table) |
This file contains 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-21 10:29:41` using | ||
```cmd | ||
cd osparc-simcore | ||
python ./scripts/echo_services_markdown.py | ||
``` | ||
| Name|Files| | | ||
| ----------|----------|---------- | | ||
| **AGENT**|| | | ||
| |[services/agent/Dockerfile](./services/agent/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/agent)](https://hub.docker.com/r/itisfoundation/agent/tags) | | ||
| **API-SERVER**|| | | ||
| |[services/api-server/openapi.json](./services/api-server/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/api-server/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/api-server)](https://hub.docker.com/r/itisfoundation/api-server/tags) | | ||
| **AUTOSCALING**|| | | ||
| |[services/autoscaling/Dockerfile](./services/autoscaling/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/autoscaling)](https://hub.docker.com/r/itisfoundation/autoscaling/tags) | | ||
| **CATALOG**|| | | ||
| |[services/catalog/openapi.json](./services/catalog/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/catalog/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/catalog)](https://hub.docker.com/r/itisfoundation/catalog/tags) | | ||
| **CLUSTERS-KEEPER**|| | | ||
| |[services/clusters-keeper/Dockerfile](./services/clusters-keeper/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/clusters-keeper)](https://hub.docker.com/r/itisfoundation/clusters-keeper/tags) | | ||
| **DASK-SIDECAR**|| | | ||
| |[services/dask-sidecar/Dockerfile](./services/dask-sidecar/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/dask-sidecar)](https://hub.docker.com/r/itisfoundation/dask-sidecar/tags) | | ||
| **DATCORE-ADAPTER**|| | | ||
| |[services/datcore-adapter/Dockerfile](./services/datcore-adapter/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/datcore-adapter)](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)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](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) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/director)](https://hub.docker.com/r/itisfoundation/director/tags) | | ||
| **DIRECTOR-V2**|| | | ||
| |[services/director-v2/openapi.json](./services/director-v2/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/director-v2/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/director-v2)](https://hub.docker.com/r/itisfoundation/director-v2/tags) | | ||
| **DYNAMIC-SCHEDULER**|| | | ||
| |[services/dynamic-scheduler/openapi.json](./services/dynamic-scheduler/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-scheduler/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/dynamic-scheduler)](https://hub.docker.com/r/itisfoundation/dynamic-scheduler/tags) | | ||
| **DYNAMIC-SIDECAR**|| | | ||
| |[services/dynamic-sidecar/openapi.json](./services/dynamic-sidecar/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/dynamic-sidecar/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/dynamic-sidecar)](https://hub.docker.com/r/itisfoundation/dynamic-sidecar/tags) | | ||
| **EFS-GUARDIAN**|| | | ||
| |[services/efs-guardian/Dockerfile](./services/efs-guardian/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/efs-guardian)](https://hub.docker.com/r/itisfoundation/efs-guardian/tags) | | ||
| **INVITATIONS**|| | | ||
| |[services/invitations/openapi.json](./services/invitations/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/invitations/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/invitations)](https://hub.docker.com/r/itisfoundation/invitations/tags) | | ||
| **MIGRATION**|| | | ||
| |[services/migration/Dockerfile](./services/migration/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/migration)](https://hub.docker.com/r/itisfoundation/migration/tags) | | ||
| **OSPARC-GATEWAY-SERVER**|| | | ||
| |[services/osparc-gateway-server/Dockerfile](./services/osparc-gateway-server/Dockerfile)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/osparc-gateway-server)](https://hub.docker.com/r/itisfoundation/osparc-gateway-server/tags) | | ||
| **PAYMENTS**|| | | ||
| |[services/payments/openapi.json](./services/payments/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/payments/gateway/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/payments)](https://hub.docker.com/r/itisfoundation/payments/tags) | | ||
| **RESOURCE-USAGE-TRACKER**|| | | ||
| |[services/resource-usage-tracker/openapi.json](./services/resource-usage-tracker/openapi.json)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/ITISFoundation/osparc-simcore/refs/heads/master/services/resource-usage-tracker/openapi.json) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/resource-usage-tracker)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/static-webserver)](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)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](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) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/storage)](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)|[![ReDoc](https://img.shields.io/badge/OpenAPI-ReDoc-85ea2d?logo=openapiinitiative)](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) [![Swagger UI](https://img.shields.io/badge/OpenAPI-Swagger_UI-85ea2d?logo=swagger)](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)|[![Docker Image Size](https://img.shields.io/docker/image-size/itisfoundation/webserver)](https://hub.docker.com/r/itisfoundation/webserver/tags) | | ||
| || | |
This file contains 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 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 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 | ||
|
||
[![Docker Pulls](https://img.shields.io/docker/pulls/itisfoundation/storage.svg)](https://hub.docker.com/r/itisfoundation/storage/tags) | ||
[![](https://images.microbadger.com/badges/image/itisfoundation/storage.svg)](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
[![](https://images.microbadger.com/badges/version/itisfoundation/storage.svg)](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
[![](https://images.microbadger.com/badges/commit/itisfoundation/storage.svg)](https://microbadger.com/images/itisfoundation/storage "More on service image in registry") | ||
|
||
Service to manage data storage in simcore |
Oops, something went wrong.