Git Product home page Git Product logo

teapot's Introduction

Teapot

This application provides a WebDAV that supports multi-tenancy. It is based on StoRM-WebDAV. We have added a manager level that accepts requests, authenticates the user, identifies the local username of the user, starts a StoRM-WebDAV server for that local user with a randomly assigned port to listen on, and forwards the user's request to that port. The StoRM-WebDAV server will then handle the request in the usual way. If the StoRM-WebDAV server is inactive for 10 minutes, it will be shut down by the manager. If another request comes in for a different user, the manager will start another StoRM-WebDAV server for that user in the same way.

Getting Started

Requirements

Software requirements for installing Teapot can be found in requirements.txt.

Installation & Configuration

To install Teapot, first build the rpm package from source by running ./rpm/teapot-rpm.sh, then install it.

Please refer to CONFIGURATION.md for information on how to configure Teapot.

Starting

To start Teapot, run python3 /usr/share/teapot/teapot.py.

Automated testing

Functional tests can be found in /robot. To execute them, run e.g. robot teapot-tests.robot.

Version

The current version of Teapot is 0.5.0.

Authors

Paul Millar, Dijana Vrbanec, Tim Wetzel

Acknowledgements

Teapot is a WebDAV solution that supports multi-tenancy. It is based on StoRM-WebDAV.

teapot's People

Contributors

vrbanecd avatar wetzel-desy avatar paulmillar avatar dependabot[bot] avatar

Watchers

 avatar Andrea Manzi avatar  avatar

Forkers

wetzel-desy

teapot's Issues

directory logs is not created by teapot

Short Description of the issue

When starting teapot for the first time, it throws an exception if the logs directory does not exist because it can't store the log files and teapot_sessions.json

Environment

irrelevant.

  • Operating System: all
  • Other related components versions: irrelevant

Steps to reproduce

start teapot without /home/teapot//logs being created

Logs, stacktrace, or other symptoms

ERROR:    Traceback (most recent call last):
  File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 677, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/share/teapot/teapot.py", line 44, in lifespan
    await load_session_state()
  File "/usr/share/teapot/teapot.py", line 482, in load_session_state
    with open(SESSION_STORE_PATH, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/teapot/logs/teapot_sessions.json'

ERROR:    Application startup failed. Exiting.

Summary of proposed changes

check if directory exists in lifespan function and create it if not.

externalize teapot config

all configuration in teapot should be externalized into a .config file.

  • use a config parser
  • find all config options within teapot for teapot itself, user-config and storm-config
  • write a default config file with all options
  • make sure that default options are set for everything
  • document the config.

Closed resource error

ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line 34, in read
return await self._stream.receive(max_bytes=max_bytes)
File "/home/teapot/.local/lib/python3.10/site-packages/anyio/streams/tls.py", line 196, in receive
data = await self._call_sslobject_method(self._ssl_object.read, max_bytes)
File "/home/teapot/.local/lib/python3.10/site-packages/anyio/streams/tls.py", line 138, in _call_sslobject_method
data = await self.transport_stream.receive()
File "/home/teapot/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1210, in receive
raise ClosedResourceError from None
anyio.ClosedResourceError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
yield
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 249, in aiter
async for part in self._httpcore_stream:
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 361, in aiter
async for part in self._stream:
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 337, in aiter
raise exc
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 329, in aiter
async for chunk in self._connection._receive_response_body(**kwargs):
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 198, in _receive_response_body
event = await self._receive_event(timeout=timeout)
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_async/http11.py", line 212, in _receive_event
data = await self._network_stream.read(
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line 31, in read
with map_exceptions(exc_map):
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/home/teapot/.local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ReadError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/teapot/.local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/home/teapot/.local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/fastapi/applications.py", line 1106, in call
await super().call(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in call
raise exc
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in call
await self.app(scope, receive, _send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in call
raise exc
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "/home/teapot/.local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in call
raise e
File "/home/teapot/.local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in call
await self.app(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 718, in call
await route.handle(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/routing.py", line 69, in app
await response(scope, receive, send)
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/responses.py", line 270, in call
async with anyio.create_task_group() as task_group:
File "/home/teapot/.local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 597, in aexit
raise exceptions[0]
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/responses.py", line 273, in wrap
await func()
File "/home/teapot/.local/lib/python3.10/site-packages/starlette/responses.py", line 262, in stream_response
async for chunk in self.body_iterator:
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_models.py", line 990, in aiter_raw
async for raw_stream_bytes in self.stream:
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_client.py", line 146, in aiter
async for chunk in self._stream:
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 248, in aiter
with map_httpcore_exceptions():
File "/usr/local/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/home/teapot/.local/lib/python3.10/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ReadError

Error when shutting teapot down

When teapot is shutting down it gives the following error message:

ERROR:    Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 738, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/usr/local/lib/python3.10/contextlib.py", line 206, in __aexit__
    await anext(self.gen)
  File "/usr/share/teapot/teapot.py", line 62, in lifespan
    pathlib.Path.unlink(SESSION_STORE_PATH)
  File "/usr/local/lib/python3.10/pathlib.py", line 1206, in unlink
    self._accessor.unlink(self)
AttributeError: 'str' object has no attribute '_accessor'

ERROR:    Application shutdown failed. Exiting.

Adding date to logs

It would be easier to find issues in the log if the log entries had dates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.