diff --git a/Makefile b/Makefile index be522660..434d9fcd 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,6 @@ GIT_PASSWORD ?= password # Preferred RDP port on your host system RDP_PORT ?= 3390 -# Preferred fileservice port on your host system -FILESYSTEM_PORT ?= 8081 - # Preferred metrics port on your host system METRICS_PORT ?= 9118 @@ -266,7 +263,6 @@ run-t4c/client/remote-legacy: t4c/client/remote -e T4C_SERVER_PORT=$(T4C_SERVER_PORT) \ -e T4C_REPOSITORIES=$(T4C_REPOSITORIES) \ -e RMT_PASSWORD=$(RMT_PASSWORD) \ - -e FILESERVICE_PASSWORD=$(RMT_PASSWORD) \ -e T4C_USERNAME=$(T4C_USERNAME) \ -p $(RDP_PORT):3389 \ -p $(FILESYSTEM_PORT):8000 \ @@ -280,7 +276,6 @@ run-t4c/client/remote-json: t4c/client/remote -e T4C_LICENCE_SECRET=$(T4C_LICENCE_SECRET) \ -e T4C_JSON=$(T4C_JSON) \ -e RMT_PASSWORD=$(RMT_PASSWORD) \ - -e FILESERVICE_PASSWORD=$(RMT_PASSWORD) \ -e T4C_USERNAME=$(T4C_USERNAME) \ -p $(RDP_PORT):3389 \ -p $(FILESYSTEM_PORT):8000 \ @@ -293,7 +288,6 @@ run-t4c/client/remote/pure-variants: t4c/client/remote/pure-variants -e T4C_LICENCE_SECRET=$(T4C_LICENCE_SECRET) \ -e T4C_JSON=$(T4C_JSON) \ -e RMT_PASSWORD=$(RMT_PASSWORD) \ - -e FILESERVICE_PASSWORD=$(RMT_PASSWORD) \ -e T4C_USERNAME=$(T4C_USERNAME) \ -e PURE_VARIANTS_LICENSE_SERVER=$(PURE_VARIANTS_LICENSE_SERVER) \ -v $$(pwd)/volumes/pure-variants:/inputs/pure-variants \ diff --git a/README.md b/README.md index 3784237c..eff8e767 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,7 @@ The remote images allow to extend the - Capella base image (`capella/base`) or - the T4C base image (`t4c/client/base`) -with an RDP server, a metrics endpoint to measure the container activity and a fileservice that serves the current workspace structure. +with an RDP server, a metrics endpoint to measure the container activity. It is a basic Linux server with an [Openbox](http://openbox.org/) installation. @@ -470,7 +470,6 @@ docker run -d \ -e T4C_SERVER_PORT=$T4C_SERVER_PORT \ -e T4C_REPOSITORIES=$T4C_REPOSITORIES \ -e RMT_PASSWORD=$RMT_PASSWORD \ - -e FILESERVICE_PASSWORD=$FILESERVICE_PASSWORD \ -e T4C_USERNAME=$T4C_USERNAME \ -e AUTOSTART_CAPELLA=$AUTOSTART_CAPELLA \ -e RESTART_CAPELLA=$RESTART_CAPELLA \ @@ -483,7 +482,6 @@ Please replace the followings variables: - `$RMT_PASSWORD` is the password for remote connections (for the login via RDP). - `$T4C_LICENCE_SECRET` to your TeamForCapella licence secret. - `$T4C_USERNAME` is the username that is suggested when connecting to t4c. -- `$FILESERVICE_PASSWORD` with the password for the fileservice, which is used as basic authentication password. - `AUTOSTART_CAPELLA` defines the auto-start behaviour of Capella. When set to 1 (default), Capella will be started as soon as an RDP connection has been established to the running container. - `RESTART_CAPELLA` defines the restart behaviour of Capella. When set to 1 (default) and when `AUTOSTART_CAPELLA=1`, diff --git a/remote/Dockerfile b/remote/Dockerfile index 007d0a7f..9443031d 100644 --- a/remote/Dockerfile +++ b/remote/Dockerfile @@ -56,10 +56,6 @@ RUN pip install prometheus-client COPY metrics.py .metrics.py -# Run fileservice endpoint -COPY fastapi /opt/fastapi -RUN pip install /opt/fastapi - ENV AUTOSTART_CAPELLA=1 ENV RESTART_CAPELLA=1 diff --git a/remote/fastapi/.dockerignore b/remote/fastapi/.dockerignore deleted file mode 100644 index ce677551..00000000 --- a/remote/fastapi/.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# -# SPDX-License-Identifier: CC0-1.0 - -*.egg-info diff --git a/remote/fastapi/.gitignore b/remote/fastapi/.gitignore deleted file mode 100644 index 925b821c..00000000 --- a/remote/fastapi/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# -# SPDX-License-Identifier: CC0-1.0 - -build -*.egg-info diff --git a/remote/fastapi/fileservice/__init__.py b/remote/fastapi/fileservice/__init__.py deleted file mode 100644 index c9bcac9d..00000000 --- a/remote/fastapi/fileservice/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# SPDX-License-Identifier: Apache-2.0 - -from importlib import metadata - -from fastapi import FastAPI - -from . import routes - -try: - __version__ = metadata.version("fastapi") -except metadata.PackageNotFoundError: - __version__ = "0.0.0+unknown" -del metadata - -app = FastAPI() - -app.include_router(routes.router, prefix="/api/v1") diff --git a/remote/fastapi/fileservice/core.py b/remote/fastapi/fileservice/core.py deleted file mode 100644 index 72c269cb..00000000 --- a/remote/fastapi/fileservice/core.py +++ /dev/null @@ -1,41 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# SPDX-License-Identifier: Apache-2.0 - -import logging -import pathlib - -from .models import FileTree, FileType - -logger = logging.getLogger("core") - - -def get_files(dir: pathlib.PosixPath, show_hidden: bool) -> FileTree: - file = FileTree( - path=str(dir.absolute()), - name=dir.name, - type=FileType.DIRECTORY, - children=[], - ) - - assert isinstance(file.children, list) - - for item in dir.iterdir(): - if not show_hidden and item.name.startswith("."): - continue - if item.is_dir(): - file.children.append(get_files(item, show_hidden)) - elif item.is_file(): - file.children.append( - FileTree( - name=item.name, - path=str(item.absolute()), - type=FileType.FILE, - ) - ) - else: - logger.info( - "There is no supported file type (file or directory) for file: %s.", - str(item), - ) - - return file diff --git a/remote/fastapi/fileservice/models.py b/remote/fastapi/fileservice/models.py deleted file mode 100644 index e723b8ea..00000000 --- a/remote/fastapi/fileservice/models.py +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# SPDX-License-Identifier: Apache-2.0 - -from __future__ import annotations - -import enum -import typing as t - -from pydantic import BaseModel - - -class FileType(enum.Enum): - FILE = "file" - DIRECTORY = "directory" - - -class FileTree(BaseModel): - path: str - name: str - type: FileType - children: t.Optional[list[FileTree]] - - class Config: - orm_mode = True diff --git a/remote/fastapi/fileservice/routes.py b/remote/fastapi/fileservice/routes.py deleted file mode 100644 index 3f109d7f..00000000 --- a/remote/fastapi/fileservice/routes.py +++ /dev/null @@ -1,33 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# SPDX-License-Identifier: Apache-2.0 - -import os -import pathlib -import secrets - -from fastapi import APIRouter, Depends, HTTPException, status -from fastapi.security import HTTPBasic, HTTPBasicCredentials - -from . import core -from .models import FileTree - -router = APIRouter() -security = HTTPBasic() - - -@router.get("/workspaces/files", response_model=FileTree) -async def get_files( - show_hidden: bool, credentials: HTTPBasicCredentials = Depends(security) -): - if not secrets.compare_digest( - credentials.password, os.environ["FILESERVICE_PASSWORD"] - ): - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Incorrect password", - headers={"WWW-Authenticate": "Basic"}, - ) - - return core.get_files( - dir=pathlib.PosixPath("/workspace"), show_hidden=show_hidden - ) diff --git a/remote/fastapi/pyproject.toml b/remote/fastapi/pyproject.toml deleted file mode 100644 index ff090d39..00000000 --- a/remote/fastapi/pyproject.toml +++ /dev/null @@ -1,167 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors -# SPDX-License-Identifier: Apache-2.0 - -[build-system] -requires = ["setuptools>=61", "wheel"] -build-backend = "setuptools.build_meta" - -[project] -dynamic = ["version"] - -name = "fileservice" -description = "Serves workspace file structure" -readme = "README.rst" -requires-python = ">=3.9, <3.12" -license = { text = "Apache-2.0" } -authors = [ - { name = "DB Netz AG" }, -] -keywords = [] -classifiers = [ - "Development Status :: 1 - Planning", - "License :: OSI Approved :: Apache Software License", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", -] -dependencies = [ - "uvicorn[standard]", - "fastapi" -] - -[project.urls] -Homepage = "https://github.com/DSD-DBS/capella-dockerimages" - -[tool.black] -line-length = 79 -target-version = ["py39"] - -[tool.isort] -profile = 'black' -line_length = 79 - -[tool.mypy] -check_untyped_defs = true -no_implicit_optional = true -show_error_codes = true -warn_redundant_casts = true -warn_unreachable = true -python_version = "3.9" - -[[tool.mypy.overrides]] -module = ["tests.*"] -allow_incomplete_defs = true -allow_untyped_defs = true - -[[tool.mypy.overrides]] -# Untyped third party libraries -module = [ - # ... -] -ignore_missing_imports = true - -[tool.pydocstyle] -convention = "numpy" -add-select = [ - "D212", # Multi-line docstring summary should start at the first line - "D402", # First line should not be the function’s “signature” - "D417", # Missing argument descriptions in the docstring -] -add-ignore = [ - "D201", # No blank lines allowed before function docstring # auto-formatting - "D202", # No blank lines allowed after function docstring # auto-formatting - "D203", # 1 blank line required before class docstring # auto-formatting - "D204", # 1 blank line required after class docstring # auto-formatting - "D211", # No blank lines allowed before class docstring # auto-formatting - "D213", # Multi-line docstring summary should start at the second line -] - -[tool.pylint.messages_control] -disable = [ - "broad-except", - "consider-using-f-string", - "cyclic-import", - "global-statement", - "import-outside-toplevel", - "invalid-name", - "missing-class-docstring", - "missing-function-docstring", - "missing-module-docstring", - "no-else-break", - "no-else-continue", - "no-else-raise", - "no-else-return", - "protected-access", - "redefined-builtin", - "too-few-public-methods", - "too-many-ancestors", - "too-many-arguments", - "too-many-boolean-expressions", - "too-many-branches", - "too-many-instance-attributes", - "too-many-lines", - "too-many-locals", - "too-many-public-methods", - "too-many-return-statements", - "too-many-statements", - - # Auto-formatting - "bad-indentation", - "inconsistent-quotes", - "line-too-long", - "missing-final-newline", - "mixed-line-endings", - "multiple-imports", - "multiple-statements", - "trailing-newlines", - "trailing-whitespace", - "unexpected-line-ending-format", - "ungrouped-imports", - "wrong-import-order", - "wrong-import-position", - - # Handled by mypy - "arguments-differ", - "assignment-from-no-return", - "import-error", - "missing-kwoa", - "no-member", - "no-value-for-parameter", - "redundant-keyword-arg", - "signature-differs", - "syntax-error", - "too-many-function-args", - "unbalanced-tuple-unpacking", - "undefined-variable", - "unexpected-keyword-arg", -] -enable = [ - "c-extension-no-member", - "deprecated-pragma", - "use-symbolic-message-instead", - "useless-suppression", -] - -[tool.pytest.ini_options] -addopts = """ - --strict-config - --strict-markers -""" -testpaths = ["tests"] -xfail_strict = true - -[tool.setuptools] -platforms = ["any"] -zip-safe = false - -[tool.setuptools.package-data] -"*" = ["py.typed"] - -[tool.setuptools.packages.find] -exclude = ["LICENSES"] - -[tool.setuptools_scm] -# This section must exist for setuptools_scm to work diff --git a/remote/fastapi/setup.cfg b/remote/fastapi/setup.cfg deleted file mode 100644 index fc5b53a5..00000000 --- a/remote/fastapi/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-dockerimages contributors -# SPDX-License-Identifier: CC0-1.0 - -# This file triggers pip's legacy mode to allow editable installs. -# Related setuptools issue: diff --git a/remote/supervisord.conf b/remote/supervisord.conf index b26956ad..a1e1e37e 100644 --- a/remote/supervisord.conf +++ b/remote/supervisord.conf @@ -19,12 +19,6 @@ user=techuser autorestart=true environment=DISPLAY=":10" -[program:fileservice] -; Serves the workspace structure -command=uvicorn fileservice:app --host 0.0.0.0 -user=techuser -autorestart=true - [supervisord] nodaemon=true childlogdir=/var/log diff --git a/tests/test_t4c_repository_injection.py b/tests/test_t4c_repository_injection.py index 554cecaf..6e45cc77 100644 --- a/tests/test_t4c_repository_injection.py +++ b/tests/test_t4c_repository_injection.py @@ -16,7 +16,6 @@ default_env = { "T4C_LICENCE_SECRET": "", "RMT_PASSWORD": "my_long_password", - "FILESERVICE_PASSWORD": "password", "T4C_USERNAME": "techuser", }