From 92baaccb4870fec4e09b66c129b84e28124d3d85 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 12 Sep 2023 15:41:09 -0400 Subject: [PATCH] Clean up and upgrades related to Python requirements, Flask, and FastAPI. --- aether_fastapi_gunicorn.Dockerfile | 12 +-- aether_flask_gunicorn.Dockerfile | 4 - conf/aether_fastapi_requirements.txt | 49 +++++---- conf/aether_fastapi_requirements_current.txt | 0 conf/aether_flask_requirements.txt | 100 +++++++----------- .../nginx/site-enabled_aether-phpmyadmin.conf | 4 +- ...nabled_aether_api_v5_fastapi_gunicorn.conf | 2 +- .../site-enabled_aether_fastapi_gunicorn.conf | 2 +- .../site-enabled_aether_flask_gunicorn.conf | 2 +- conf/nginx/site-enabled_oneskyit.conf | 4 +- conf/nginx/site.conf | 4 +- conf/requirements_current.txt | 0 12 files changed, 76 insertions(+), 107 deletions(-) delete mode 100644 conf/aether_fastapi_requirements_current.txt delete mode 100644 conf/requirements_current.txt diff --git a/aether_fastapi_gunicorn.Dockerfile b/aether_fastapi_gunicorn.Dockerfile index 0239834..72b6f8b 100644 --- a/aether_fastapi_gunicorn.Dockerfile +++ b/aether_fastapi_gunicorn.Dockerfile @@ -1,5 +1,5 @@ # FROM tiangolo/uvicorn-gunicorn-fastapi:latest -FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10 +FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11 LABEL maintainer="Scott Idem " @@ -26,13 +26,7 @@ COPY conf/aether_fastapi_requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt -# RUN pip freeze -# RUN mkdir /temp -RUN pip freeze > /requirements_current.txt -# COPY requirements_current.txt tmp/requirements_current.txt -# RUN pip freeze > /logs/requirements_current.txt - -# COPY conf/aether_fastapi_requirements.txt /tmp/requirements.txt - +RUN pip freeze > /aether_fastapi_requirements_current.txt +RUN pip freeze > /tmp/aether_fastapi_requirements_current.txt CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"] diff --git a/aether_flask_gunicorn.Dockerfile b/aether_flask_gunicorn.Dockerfile index f6c2ba4..a4e7797 100644 --- a/aether_flask_gunicorn.Dockerfile +++ b/aether_flask_gunicorn.Dockerfile @@ -8,10 +8,6 @@ COPY conf/aether_flask_requirements.txt /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt RUN pip freeze > /aether_flask_requirements_current.txt -# RUN pip freeze > /logs/aether_flask_requirements_current.txt RUN pip freeze > /tmp/aether_flask_requirements_current.txt -# CMD ["pip", "freeze > /logs/aether_flask_requirements_current.txt"] -# CMD ["pip", "freeze > /tmp/aether_flask_requirements_current.txt"] - CMD ["gunicorn", "--conf", "/conf/gunicorn_flask_conf.py"] diff --git a/conf/aether_fastapi_requirements.txt b/conf/aether_fastapi_requirements.txt index 83b178f..4968fcb 100644 --- a/conf/aether_fastapi_requirements.txt +++ b/conf/aether_fastapi_requirements.txt @@ -1,58 +1,63 @@ +# Updated manually 2023-09-12 with a lot of trial and error. +# A few are commented out even though they are actually used and required. Other packages already pull them in. +# SQLAlchemy needs to be upgraded to 2.x. There are issues with async IO or something related to that. +# https://docs.sqlalchemy.org/en/14/changelog/migration_20.html + # aioredis # BAD! Not maintained! aiofiles anyio argon2-cffi argon2-cffi-bindings -asgiref +# asgiref async-timeout baize # added 2023-08-17 -certifi -cffi +# certifi +# cffi charset-normalizer click Deprecated dnspython email-validator et-xmlfile -fastapi -greenlet -gunicorn +fastapi>=0.88.0 +greenlet>=2.0.2 +gunicorn>=20.1.0 h11 -html2text +html2text>=2020.1.16 httpcore httptools httpx idna itsdangerous -Jinja2 +# Jinja2>=3.1.2 MarkupSafe mysqlclient -numpy +numpy>=1.25.2 openpyxl orjson -packaging -pandas +# packaging +pandas>=2.1.0 passlib -pdf2image -Pillow +pdf2image>=1.16.3 +Pillow>=10.0.0 pycparser -pydantic -PyJWT +pydantic>=1.10.12 +PyJWT>=2.8.0 pyparsing python-dateutil python-dotenv python-multipart pytz -PyYAML -qrcode -redis[hiredis] +PyYAML>=6.0.1 +qrcode>=7.4.2 +redis[hiredis] # redis==5.0.0 hiredis==2.2.3 requests rfc3986 six sniffio -SQLAlchemy==1.4.47 # 1.4.47 is the newest I am working with -starlette -stripe +SQLAlchemy==1.4.49 # 1.4.47 is the newest (2.0.20) I am working with +starlette>=0.22.0 +stripe>=6.4.0 typing_extensions ujson urllib3 @@ -60,6 +65,6 @@ uvicorn uvloop watchfiles watchgod -websockets +websockets>=11.0.3 wrapt xlrd diff --git a/conf/aether_fastapi_requirements_current.txt b/conf/aether_fastapi_requirements_current.txt deleted file mode 100644 index e69de29..0000000 diff --git a/conf/aether_flask_requirements.txt b/conf/aether_flask_requirements.txt index 3df6352..0185bdf 100644 --- a/conf/aether_flask_requirements.txt +++ b/conf/aether_flask_requirements.txt @@ -1,66 +1,40 @@ -argon2-cffi>=21 -# async-timeout>=4 -# bidict>=0.21 -Brotli>=1 -# cachelib==0.9.0 -# certifi==2021.10.8 -# charset-normalizer>=2.0.9 -click==7.1.2 # Must keep??? -cssselect2==0.4.1 # Must keep??? -Deprecated==1.2.13 -eventlet==0.33.2 -Flask>=1.1.4 -Flask-Caching>=2.0.1 -Flask-Cors>=3.0.10 +# Updated manually 2023-09-12 with a lot of trial and error. +# A few are commented out even though they are actually used and required. Other packages already pull them in. + +argon2-cffi>=23.1.0 # Must keep +click>=8.1.7 # Must keep??? +Deprecated>=1.2.14 +Flask==2.0.3 # Must keep +Flask-Caching>=2.0.2 +Flask-Cors>=4.0.0 Flask-MySQLdb>=1.0.1 -Flask-SocketIO>=5.3.2 -Flask-SQLAlchemy==2.5.1 -Flask-WeasyPrint>=0.6 -# fonttools>=4.28.4 -gevent==22.10.2 -greenlet==2.0.1 -gunicorn>=20.1.0 -html2text==2020.1.16 -html5lib==1.1 -# idna==3.3 -itsdangerous>=1.1.0 -Jinja2>=2.11.3 -MarkupSafe>=2.0.1 -mypy==0.930 -mypy-extensions==0.4.3 -mysqlclient==2.1.0 +Flask-SocketIO>=5.3.6 +Flask-SQLAlchemy>=2.5.1 +gunicorn>=21.2.0 +html2text>=2020.1.16 +# itsdangerous>=2.1.2 +Jinja2>=3.1.2 +# MarkupSafe>=2.1.3 +# mysqlclient>=2.2.0 numpy>=1.25.2 -# packaging==21.3 -pandas>=1.5.2 +pandas>=2.1.0 passlib>=1.7.4 -Pillow==9.3.0 -pycparser==2.21 -pydantic>=1.10.2 -pydyf==0.1.2 -pyparsing==3.0.9 -pyphen==0.11.0 -python-dateutil==2.8.2 -python-engineio==4.3.0 -python-socketio==5.5.0 -pytz==2021.3 -qrcode==7.3.1 -redis>=4.3.5 -requests==2.28.1 -# six==1.16.0 -SQLAlchemy==1.4.28 -stripe==5.0.0 -suds-py3==1.4.5.0 -tinycss2>=1.1.1 -# tomli==2.0.0 -types-pytz>=2022.1.2 -types-requests>=2.28.10 -types-urllib3>=1.26.24 -typing_extensions>=4.4.0 -urllib3>=1.26.7 -uvicorn>=0.18.3 -weasyprint>=53.4 -webencodings>=0.5.1 -Werkzeug>=0.16.1 -wrapt>=1.13.3 -xlrd>=2.0.1 -xmltodict>=0.13.0 +Pillow>=10.0.0 +pydantic>=2.3.0 +python-dateutil>=2.8.2 +python-engineio>=4.3.0 +python-socketio>=5.5.0 +pytz>=2023.3.post1 +qrcode>=7.4.2 +redis>=5.0.0 +requests==2.28.1 # version 2.31.0 does not work? +# six>=1.16.0 +SQLAlchemy>=2.0.20 # Must keep +stripe==5.0.0 # version 6.4.0 exists 2023-09-12 +types-pytz>=2023.3.0.1 +types-requests>=2.31.0.2 +types-urllib3>=1.26.25.14 +typing_extensions>=4.7.1 +# urllib3>=1.26.16 +Werkzeug>=2.3.7 +xmltodict>=0.13.0 # Must keep diff --git a/conf/nginx/site-enabled_aether-phpmyadmin.conf b/conf/nginx/site-enabled_aether-phpmyadmin.conf index ac24c11..d1ea0b4 100644 --- a/conf/nginx/site-enabled_aether-phpmyadmin.conf +++ b/conf/nginx/site-enabled_aether-phpmyadmin.conf @@ -24,7 +24,7 @@ server { server { listen 443 ssl; - listen [::]:443 ssl http2; + listen [::]:443 ssl; # server_name ${DOCKER_PHPMYADMIN_SERVER_NAME}; server_name phpmyadmin-oneskyit.localhost phpmyadmin.oneskyit.com dev-phpmyadmin.oneskyit.com test-phpmyadmin.oneskyit.com; @@ -49,4 +49,4 @@ server { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; } -} \ No newline at end of file +} diff --git a/conf/nginx/site-enabled_aether_api_v5_fastapi_gunicorn.conf b/conf/nginx/site-enabled_aether_api_v5_fastapi_gunicorn.conf index c816daf..e9956fd 100644 --- a/conf/nginx/site-enabled_aether_api_v5_fastapi_gunicorn.conf +++ b/conf/nginx/site-enabled_aether_api_v5_fastapi_gunicorn.conf @@ -65,7 +65,7 @@ server { server { listen 443 ssl; - listen [::]:443 ssl http2; + listen [::]:443 ssl; server_name ${DOCKER_AE_API_V5_SERVER_NAME} v5-fastapi.localhost api-v5.localhost; # server_name diff --git a/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf b/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf index 7c9dc93..1ede886 100644 --- a/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf +++ b/conf/nginx/site-enabled_aether_fastapi_gunicorn.conf @@ -65,7 +65,7 @@ server { server { listen 443 ssl; - listen [::]:443 ssl http2; + listen [::]:443 ssl; server_name ${DOCKER_AE_API_SERVER_NAME} fastapi.localhost api.localhost; # server_name diff --git a/conf/nginx/site-enabled_aether_flask_gunicorn.conf b/conf/nginx/site-enabled_aether_flask_gunicorn.conf index 4bd2383..a09a05e 100644 --- a/conf/nginx/site-enabled_aether_flask_gunicorn.conf +++ b/conf/nginx/site-enabled_aether_flask_gunicorn.conf @@ -57,7 +57,7 @@ server { server { listen 443 ssl; - listen [::]:443 ssl http2; + listen [::]:443 ssl; # The Docker nginx envsubst with templates does not work for multiple server names. # server_name diff --git a/conf/nginx/site-enabled_oneskyit.conf b/conf/nginx/site-enabled_oneskyit.conf index 714aae5..94edbba 100644 --- a/conf/nginx/site-enabled_oneskyit.conf +++ b/conf/nginx/site-enabled_oneskyit.conf @@ -44,8 +44,8 @@ server { server { - listen 443 ssl http2; - listen [::]:443 ssl http2; + listen 443 ssl; + listen [::]:443 ssl; # server_name docker.oneskyit.com ${DOCKER_OSIT_SERVER_NAME}; server_name docker.oneskyit.com dev-docker.oneskyit.com test-docker.oneskyit.com prod-docker.oneskyit.com ${DOCKER_OSIT_SERVER_NAME}; diff --git a/conf/nginx/site.conf b/conf/nginx/site.conf index a807df6..a0bb4c0 100644 --- a/conf/nginx/site.conf +++ b/conf/nginx/site.conf @@ -66,8 +66,8 @@ server { # } server { - listen 443 ssl http2; - listen [::]:443 ssl http2; + listen 443 ssl; + listen [::]:443 ssl; server_name _; diff --git a/conf/requirements_current.txt b/conf/requirements_current.txt deleted file mode 100644 index e69de29..0000000