diff --git a/Dockerfile b/Dockerfile index f73f5c93e..8fd4097d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM python:3.6-slim-buster +FROM python:3.13-slim # ensure unoconv can locate the uno library -ENV PYTHONPATH /usr/lib/python3/dist-packages +ENV PYTHONPATH=/usr/lib/python3/dist-packages RUN usermod -d /home www-data \ && chown www-data:www-data /home \ @@ -43,9 +43,9 @@ RUN usermod -d /home www-data \ RUN mkdir -p /code WORKDIR /code -RUN pip install -U pip==18.1 -RUN pip install setuptools==37.0.0 -RUN pip install unoconv==0.8.2 +RUN pip install -U pip==24.0 +RUN pip install setuptools==69.5.1 +RUN pip install unoconv==0.9.0 COPY ./requirements.txt /code/ @@ -55,7 +55,7 @@ RUN pip install --no-cache-dir -r ./requirements.txt COPY ./ /code/ ARG GIT_COMMIT= -ENV GIT_COMMIT ${GIT_COMMIT} +ENV GIT_COMMIT=${GIT_COMMIT} RUN python setup.py develop diff --git a/dev-requirements.txt b/dev-requirements.txt index 37036c257..c0757f842 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -9,8 +9,8 @@ coveralls flake8==3.0.4 ipdb mccabe -pydevd==0.0.6 +pydevd==3.3.0 pyflakes pytest==2.8.2 pytest-cov==2.2.0 -pyzmq==14.4.1 +pyzmq==26.1.0 diff --git a/mfr/server/app.py b/mfr/server/app.py index d7f4b2abc..b8b1297ef 100644 --- a/mfr/server/app.py +++ b/mfr/server/app.py @@ -7,7 +7,10 @@ import tornado.web import tornado.httpserver import tornado.platform.asyncio -from raven.contrib.tornado import AsyncSentryClient + +import sentry_sdk +from sentry_sdk.integrations.tornado import TornadoIntegration +from sentry_sdk.integrations.logging import LoggingIntegration from mfr import settings from mfr.server import settings as server_settings @@ -46,6 +49,15 @@ def almost_apache_style_log(handler): def make_app(debug): + sentry_logging = LoggingIntegration( + level=logging.INFO, # Capture INFO level and above as breadcrumbs + event_level=None, # Do not send logs of any level as events + ) + sentry_sdk.init( + dsn=settings.SENTRY_DSN, + release=__version__, + integrations=[TornadoIntegration(), sentry_logging, ], + ) app = tornado.web.Application( [ (r'/static/(.*)', tornado.web.StaticFileHandler, {'path': server_settings.STATIC_PATH}), @@ -59,7 +71,6 @@ def make_app(debug): debug=debug, log_function=almost_apache_style_log, ) - app.sentry_client = AsyncSentryClient(settings.SENTRY_DSN, release=__version__) return app diff --git a/mfr/server/handlers/core.py b/mfr/server/handlers/core.py index 4c2bd067f..e9afbd00e 100644 --- a/mfr/server/handlers/core.py +++ b/mfr/server/handlers/core.py @@ -7,7 +7,7 @@ import tornado.web import tornado.iostream -from raven.contrib.tornado import SentryMixin +import sentry_sdk import waterbutler.core.utils import waterbutler.server.utils @@ -76,7 +76,7 @@ def options(self): self.set_header('Access-Control-Allow-Methods', 'GET, PUT, POST, DELETE'), -class BaseHandler(CorsMixin, tornado.web.RequestHandler, SentryMixin): +class BaseHandler(CorsMixin, tornado.web.RequestHandler): """Base class for the Render and Export handlers. Fetches the file metadata for the file indicated by the ``url`` query parameter and builds the provider caches. Also handles writing output and errors. @@ -159,8 +159,11 @@ async def write_stream(self, stream): return def write_error(self, status_code, exc_info): - self.captureException(exc_info) # Log all non 2XX codes to sentry etype, exc, _ = exc_info + scope = sentry_sdk.get_current_scope() + scope.set_tag('class', etype.__name_) + scope.set_tag('status_code', status_code) + sentry_sdk.capture_exception(exc) # Log all non 2XX codes to sentry if issubclass(etype, exceptions.PluginError): try: # clever errors shouldn't break other things diff --git a/requirements.txt b/requirements.txt index 575639416..a3f9207a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,16 @@ -aiohttp==0.18.4 +aiohttp==3.10.6 chardet==2.3.0 furl==0.4.2 humanfriendly==2.1 -invoke==0.13.0 +invoke==2.2.0 mako==1.0.1 -raven==5.27.0 -setuptools==37.0.0 +sentry-sdk==2.22.0 +setuptools==78.1.0 stevedore==1.2.0 -tornado==4.3 +tornado==6.4.2 # WaterButler -git+https://github.com/CenterForOpenScience/waterbutler.git@0.38.6#egg=waterbutler +git+https://github.com/CenterForOpenScience/waterbutler.git@feature/buff-worms agent==0.1.2 google-auth==1.4.1 @@ -23,7 +23,7 @@ pydocx==0.7.0 # Image olefile==0.44 -Pillow==4.3.0 +Pillow==11.0.0 psd-tools==1.4 # IPython @@ -36,7 +36,7 @@ jinja2==2.10.1 mistune==0.8.1 # Pdf -reportlab==3.6.5 +reportlab==4.2.4 # Pptx # python-pptx==0.5.7 @@ -45,10 +45,10 @@ reportlab==3.6.5 docutils==0.12 # Tabular -pandas==0.25.1 +pandas==2.2.3 xlrd==1.0.0 -h5py==2.7.0 -scipy==0.19.1 +h5py==3.13 +scipy==1.14.1 # Md markdown==2.6.2