Everything seems to be working with FastAPI 110 now!! Need to work on SQLAlchemy upgrade to 2.0.29 soon.

This commit is contained in:
Scott Idem
2024-04-26 17:58:17 -04:00
parent f43f13b9e1
commit 341f5ccbee
6 changed files with 140 additions and 36 deletions

View File

@@ -22,7 +22,24 @@ RUN apt-get update; \
COPY conf/aether_fastapi_requirements.txt /tmp/requirements.txt COPY conf/aether_fastapi_requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt RUN pip install --no-cache-dir -r /tmp/requirements.txt
RUN pip freeze > /aether_fastapi_requirements_current.txt # Freeze the requirements and then export them to a file that is accessible to the host
RUN pip freeze > /tmp/aether_fastapi_requirements_current.txt RUN pip freeze >> /tmp/aether_fastapi_requirements_current.txt
# docker cp ae_api_dev:/tmp/aether_fastapi_requirements_current.txt /home/scott/tmp/docker
# RUN pip freeze > /tmp/aether_fastapi_requirements_new.txt
# RUN cp /tmp/aether_fastapi_requirements_new.txt /tmp/aether_fastapi_requirements_new_copy.txt
# RUN pip freeze > /tmp/aether_fastapi_requirements_current.txt
# RUN cp /aether_fastapi_requirements_current.txt /var/aether_fastapi_requirements_current.txt
# RUN pip freeze >> /var/aether_fastapi_requirements_current.txt
# VOLUME ["/export"]
# RUN pip freeze > /logs/aether_fastapi_requirements_current.txt
# RUN pip freeze > /temp/aether_fastapi_requirements_current.txt
# RUN pip freeze > /tmp/aether_fastapi_requirements_current.txt
# RUN pip freeze > /var/aether_fastapi_requirements_current.txt
# RUN pip freeze
CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"] CMD ["gunicorn", "--conf", "/conf/gunicorn_fastapi_conf.py"]

View File

@@ -1,4 +1,4 @@
# Updated manually 2023-09-12 with a lot of trial and error. # Updated manually 2024-04-26 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. # 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. # 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 # https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
@@ -20,12 +20,12 @@ Deprecated
dnspython dnspython
email-validator email-validator
et-xmlfile et-xmlfile
fastapi>=0.88.0 fastapi==0.110.2 # working 0.95.1 0.94.1, 0.88.0; testing 0.108.0 0.99.1; not working >= 0.95.0
# greenlet>=2.0.2 # greenlet>=2.0.2
# gevent # gevent
gunicorn>=22.0.0 gunicorn # working >=21.2.0
h11 h11
html2text>=2020.1.16 html2text
httpcore httpcore
httptools httptools
httpx httpx
@@ -34,40 +34,40 @@ itsdangerous
# Jinja2>=3.1.2 # Jinja2>=3.1.2
MarkupSafe MarkupSafe
mysqlclient mysqlclient
numpy>=1.25.2 numpy
openpyxl openpyxl
orjson orjson
# packaging # packaging
pandas>=2.1.0 pandas
passlib passlib
pdf2image>=1.16.3 pdf2image
Pillow>=10.0.0 Pillow
pycparser pycparser
pydantic>=1.10.12 pydantic
PyJWT>=2.8.0 PyJWT
pyparsing pyparsing
python-dateutil python-dateutil
python-dotenv python-dotenv
python-multipart python-multipart
pytz pytz
PyYAML>=6.0.1 PyYAML
qrcode>=7.4.2 qrcode
redis[hiredis] # redis==5.0.0 hiredis==2.2.3 redis[hiredis] # redis==5.0.0 hiredis==2.2.3
requests requests
rfc3986 rfc3986
six six
sniffio sniffio
SQLAlchemy==1.4.49 # 1.4.47 is the newest (2.0.20) I am working with SQLAlchemy==1.4.52 # working 1.4.52; (2.0.29) I am working with
starlette>=0.22.0 starlette # working ==0.26.1, 0.22.0; not working newest 0.37.2
stripe>=6.4.0 stripe
typing_extensions typing_extensions
ujson ujson
urllib3 urllib3
uvicorn uvicorn # working ==0.20.0
uvloop uvloop
Wand Wand
watchfiles watchfiles
watchgod watchgod
websockets>=11.0.3 websockets
wrapt wrapt
xlrd xlrd

View File

@@ -0,0 +1,67 @@
aiofiles==23.2.1
anyio==3.7.1
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
async-timeout==4.0.3
baize==0.20.8
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
Deprecated==1.2.14
dnspython==2.6.1
email_validator==2.1.1
et-xmlfile==1.1.0
fastapi==0.110.2
greenlet==3.0.3
gunicorn==21.2.0
h11==0.14.0
hiredis==2.3.2
html2text==2024.2.26
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
idna==3.7
itsdangerous==2.2.0
Jinja2==3.1.3
MarkupSafe==2.1.5
mysqlclient==2.2.4
numpy==1.26.4
openpyxl==3.1.2
orjson==3.10.1
packaging==24.0
pandas==2.2.2
passlib==1.7.4
pdf2image==1.17.0
pillow==10.3.0
pycparser==2.22
pydantic==1.10.15
PyJWT==2.8.0
pyparsing==3.1.2
pypng==0.20220715.0
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-multipart==0.0.9
pytz==2024.1
PyYAML==6.0.1
qrcode==7.4.2
redis==5.0.4
requests==2.31.0
rfc3986==2.0.0
six==1.16.0
sniffio==1.3.1
SQLAlchemy==1.4.52
starlette==0.37.2
stripe==9.4.0
typing_extensions==4.11.0
tzdata==2024.1
ujson==5.9.0
urllib3==2.2.1
uvicorn==0.20.0
uvloop==0.19.0
Wand==0.6.13
watchfiles==0.21.0
watchgod==0.8.2
websockets==12.0
wrapt==1.16.0
xlrd==2.0.1

View File

@@ -1,4 +1,4 @@
# Updated manually 2023-09-12 with a lot of trial and error. # Updated manually 2024-04-26 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. # 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. # 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 # https://docs.sqlalchemy.org/en/14/changelog/migration_20.html
@@ -19,9 +19,9 @@ Deprecated
dnspython dnspython
email-validator email-validator
et-xmlfile et-xmlfile
fastapi>=0.88.0 fastapi==0.94.1 # working 0.94.1, 0.88.0; not working >= 0.95.0
greenlet>=2.0.2 greenlet>=2.0.2
gunicorn>=20.1.0 gunicorn>=22.0.0
h11 h11
html2text>=2020.1.16 html2text>=2020.1.16
httpcore httpcore
@@ -55,7 +55,7 @@ requests
rfc3986 rfc3986
six six
sniffio sniffio
SQLAlchemy==1.4.49 # 1.4.47 is the newest (2.0.20) I am working with SQLAlchemy==1.4.49 # 1.4.49 is the newest (2.0.20) I am working with
starlette>=0.22.0 starlette>=0.22.0
stripe>=6.4.0 stripe>=6.4.0
typing_extensions typing_extensions

View File

@@ -1,3 +1,8 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
@@ -21,21 +26,26 @@ server {
client_max_body_size ${OSIT_WEB_MAX_BODY_SIZE}; # 5120M; #4096M or 4G; 5120M or 5G; client_max_body_size ${OSIT_WEB_MAX_BODY_SIZE}; # 5120M; #4096M or 4G; 5120M or 5G;
location / { location / {
# Based on recommendations here: https://www.uvicorn.org/deployment/#running-behind-nginx
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off; proxy_redirect off;
proxy_buffering off; proxy_buffering off;
# I think "X-Real-IP" might be needed for some things?
proxy_set_header X-Real-IP $remote_addr;
# This is needed for long running Python code. Default is 60 seconds # This is needed for long running Python code. Default is 60 seconds
# Increased from 1200 to 1500 on 2022-04-17 # Increased from 1200 to 1500 on 2022-04-17
# Increased from 1500 to 2000 on 2023-03-15 # Increased from 1500 to 2000 on 2023-03-15
# Increased proxy read timeout to 2100 and decreased fastcgi options to 35s on 2023-03-16 # Increased proxy read timeout to 2100 and decreased fastcgi options to 35s on 2023-03-16
fastcgi_connect_timeout 4s; # fastcgi_connect_timeout 4s;
fastcgi_send_timeout 5s; # fastcgi_send_timeout 5s;
fastcgi_read_timeout 5s; # fastcgi_read_timeout 5s;
# proxy read timeout being too low will cause 504 Gateway Time-out on the client browser # proxy read timeout being too low will cause 504 Gateway Time-out on the client browser
proxy_read_timeout 2100s; proxy_read_timeout 2100s;
@@ -101,21 +111,26 @@ server {
client_max_body_size ${OSIT_WEB_MAX_BODY_SIZE}; # 5120M; #4096M or 4G; 5120M or 5G; client_max_body_size ${OSIT_WEB_MAX_BODY_SIZE}; # 5120M; #4096M or 4G; 5120M or 5G;
location / { location / {
# Based on recommendations here: https://www.uvicorn.org/deployment/#running-behind-nginx
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_redirect off; proxy_redirect off;
proxy_buffering off; proxy_buffering off;
# This is needed for long running Python code. Default is 60 seconds # I think "X-Real-IP" might be needed for some things?
# Increased from 1200 to 1500 on 2022-04-17 proxy_set_header X-Real-IP $remote_addr;
# Increased from 1500 to 2000 on 2023-03-15
# Increased proxy read timeout to 2100 and decreased fastcgi options to 35s on 2023-03-16 # # This is needed for long running Python code. Default is 60 seconds
fastcgi_connect_timeout 35s; # # Increased from 1200 to 1500 on 2022-04-17
fastcgi_send_timeout 35s; # # Increased from 1500 to 2000 on 2023-03-15
fastcgi_read_timeout 35s; # # Increased proxy read timeout to 2100 and decreased fastcgi options to 35s on 2023-03-16
# fastcgi_connect_timeout 35s;
# fastcgi_send_timeout 35s;
# fastcgi_read_timeout 35s;
# proxy read timeout being too low will cause 504 Gateway Time-out on the client browser # proxy read timeout being too low will cause 504 Gateway Time-out on the client browser
proxy_read_timeout 2100s; proxy_read_timeout 2100s;

View File

@@ -139,6 +139,9 @@ services:
dockerfile: aether_fastapi_gunicorn.Dockerfile dockerfile: aether_fastapi_gunicorn.Dockerfile
env_file: env_file:
- ./.env - ./.env
environment:
- PUID=1000
- PGID=1000
ports: ports:
- "${AE_API_GUNICORN_PORT}:5005" - "${AE_API_GUNICORN_PORT}:5005"
extra_hosts: extra_hosts:
@@ -165,7 +168,9 @@ services:
- ./srv/hosted_tmp_ln:/srv/hosted_tmp - ./srv/hosted_tmp_ln:/srv/hosted_tmp
# - ./tmp/ae_api:/tmp # - ./tmp/ae_api:/tmp
- ./temp/ae_api:/temp # - ./tmp/root/aether_fastapi_requirements_current.txt:/aether_fastapi_requirements_current.txt
# - ./temp/ae_api/aether_fastapi_requirements_current.txt:/temp/aether_fastapi_requirements_current.txt
# - ./tmp/test:/var
# links: # links:
# - redis # - redis
depends_on: depends_on: