Major dependency upgrades: Python 3.14, FastAPI, SQLAlchemy 2.1, PyJWT, MySQL 8.4
- Python base image 3.12-slim -> 3.14-slim - fastapi 0.136.3 -> 0.162.0, sqlalchemy 2.0.50 -> 2.1.6 - Replace unmaintained python-jose with PyJWT 2.15.1; tokens issued by python-jose remain valid, so existing sessions are not logged out - MySQL 8.0.46 (EOL) -> 8.4.13 LTS; in-place data dictionary upgrade runs automatically on first start Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8f32a395a1
commit
2382289484
5 files changed
+10
-9
No files matched your search
@@ -21,7 +21,7 @@ A self-hosted, multi-user web app for backyard chicken keepers to track egg prod
|
|||||||
|----------|-------------------------|
|
|----------|-------------------------|
|
||||||
| Frontend | Vanilla HTML/CSS/JS |
|
| Frontend | Vanilla HTML/CSS/JS |
|
||||||
| Backend | FastAPI (Python) |
|
| Backend | FastAPI (Python) |
|
||||||
| Database | MySQL 8.0 |
|
| Database | MySQL 8.4 LTS |
|
||||||
| Server | Nginx (static + proxy) |
|
| Server | Nginx (static + proxy) |
|
||||||
| Runtime | Docker Compose |
|
| Runtime | Docker Compose |
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.12-slim
|
FROM python:3.14-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -3,7 +3,8 @@ from datetime import datetime, timedelta, timezone
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
import bcrypt
|
import bcrypt
|
||||||
from jose import JWTError, jwt
|
import jwt
|
||||||
|
from jwt import InvalidTokenError
|
||||||
from fastapi import Cookie, Depends, HTTPException, Response, status
|
from fastapi import Cookie, Depends, HTTPException, Response, status
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ async def get_current_user(
|
|||||||
if user_id_str is None:
|
if user_id_str is None:
|
||||||
raise credentials_exception
|
raise credentials_exception
|
||||||
user_id = int(user_id_str)
|
user_id = int(user_id_str)
|
||||||
except (JWTError, ValueError):
|
except (InvalidTokenError, ValueError):
|
||||||
raise credentials_exception
|
raise credentials_exception
|
||||||
|
|
||||||
user = db.get(User, user_id)
|
user = db.get(User, user_id)
|
||||||
@@ -110,7 +111,7 @@ async def get_token_payload(
|
|||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
return jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
|
return jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
|
||||||
except JWTError:
|
except InvalidTokenError:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="Could not validate credentials",
|
detail="Could not validate credentials",
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
fastapi==0.136.3
|
fastapi==0.162.0
|
||||||
uvicorn==0.54.0
|
uvicorn==0.54.0
|
||||||
sqlalchemy==2.0.50
|
sqlalchemy==2.1.6
|
||||||
pymysql==1.2.3
|
pymysql==1.2.3
|
||||||
cryptography==50.0.2
|
cryptography==50.0.2
|
||||||
pydantic==2.14.1
|
pydantic==2.14.1
|
||||||
python-jose[cryptography]==3.5.0
|
pyjwt==2.15.1
|
||||||
bcrypt==5.0.0
|
bcrypt==5.0.0
|
||||||
httpx==0.28.1
|
httpx==0.28.1
|
||||||
+1
-1
@@ -4,7 +4,7 @@ services:
|
|||||||
# MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD should each be 20+ random characters.
|
# MYSQL_ROOT_PASSWORD and MYSQL_PASSWORD should each be 20+ random characters.
|
||||||
# Generate with: openssl rand -hex 16
|
# Generate with: openssl rand -hex 16
|
||||||
db:
|
db:
|
||||||
image: mysql:8.0.46
|
image: mysql:8.4.13
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
Reference in new issue
Block a user