Compare commits

..

No commits in common. "47be0781acf46360f202edefc72ed6015fdfe74a" and "ebe555216b7255753bc77307a2b1717c91b9bafd" have entirely different histories.

8 changed files with 10 additions and 87 deletions

View File

@ -1,24 +0,0 @@
.git
.gitignore
.env
.env.example
.vscode
.idea
venv/
.venv/
__pycache__/
*.pyc
*.pyo
*.egg-info/
dist/
build/
*.log
*.sqlite3
media/
staticfiles/
.DS_Store
k8s/
.gitea/
docs/
CLAUDE.md
README.md

View File

@ -30,17 +30,17 @@ jobs:
- name: Build and Push Backend - name: Build and Push Backend
id: build id: build
run: | run: |
set -o pipefail
docker buildx build \ docker buildx build \
--push \ --push \
--provenance=false \ --provenance=false \
--tag ${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest \ --tag ${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest \
. 2>&1 | tee /tmp/build.log . 2>&1 | tee /tmp/build.log
echo "build_exit_code=${PIPESTATUS[0]}" >> $GITHUB_OUTPUT
exit ${PIPESTATUS[0]}
- name: Setup Kubectl - name: Setup Kubectl
run: | run: |
curl -LO "https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl" || \ curl -LO "https://files.m.daocloud.io/dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl"
curl -LO "https://cdn.dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl"
chmod +x kubectl chmod +x kubectl
mv kubectl /usr/local/bin/ mv kubectl /usr/local/bin/
@ -70,7 +70,6 @@ jobs:
sed -i "s|\${CI_REGISTRY_IMAGE}/backend:latest|${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest|g" $DEPLOY_FILE sed -i "s|\${CI_REGISTRY_IMAGE}/backend:latest|${{ secrets.SWR_SERVER }}/${{ secrets.SWR_ORG }}/rtc-backend:latest|g" $DEPLOY_FILE
# 3. 应用配置并捕获输出 # 3. 应用配置并捕获输出
set -o pipefail
{ {
kubectl apply -f $DEPLOY_FILE kubectl apply -f $DEPLOY_FILE
kubectl apply -f $INGRESS_FILE kubectl apply -f $INGRESS_FILE
@ -119,12 +118,11 @@ jobs:
\"stack_trace\": [\"${ERROR_LOG}\"] \"stack_trace\": [\"${ERROR_LOG}\"]
}, },
\"context\": { \"context\": {
\"job_name\": \"build-and-deploy\",
\"step_name\": \"${FAILED_STEP}\",
\"workflow\": \"${{ github.workflow }}\", \"workflow\": \"${{ github.workflow }}\",
\"run_id\": \"${{ github.run_id }}\", \"run_id\": \"${{ github.run_id }}\",
\"branch\": \"${{ github.ref_name }}\", \"branch\": \"${{ github.ref_name }}\",
\"actor\": \"${{ github.actor }}\", \"actor\": \"${{ github.actor }}\",
\"failed_step\": \"${FAILED_STEP}\",
\"commit\": \"${{ github.sha }}\" \"commit\": \"${{ github.sha }}\"
} }
}" || true }" || true

View File

@ -28,4 +28,4 @@ COPY . /app/
EXPOSE 8000 EXPOSE 8000
# Run entrypoint # Run entrypoint
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "config.wsgi:application"] CMD ["gunicorn", "--bind", "0.0.0.0:8000", "config.wsgi:application"]

View File

@ -7,13 +7,8 @@ URL configuration for RTC_DEMO project.
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import path, include
from django.http import JsonResponse
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView, SpectacularRedocView
def health_check(request):
return JsonResponse({"status": "ok"})
# ============ App端路由 (普通用户,手机一键登录) ============ # ============ App端路由 (普通用户,手机一键登录) ============
app_api_patterns = [ app_api_patterns = [
path('', include('apps.users.urls')), path('', include('apps.users.urls')),
@ -42,9 +37,6 @@ admin_api_patterns = [
] ]
urlpatterns = [ urlpatterns = [
# Health check (no auth, for K8s probes)
path('healthz/', health_check),
# Django Admin # Django Admin
path('django-admin/', admin.site.urls), path('django-admin/', admin.site.urls),

View File

@ -68,22 +68,6 @@ spec:
value: "https://qiyuan-log-center-api.airlabs.art" value: "https://qiyuan-log-center-api.airlabs.art"
- name: LOG_CENTER_ENABLED - name: LOG_CENTER_ENABLED
value: "true" value: "true"
livenessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources: resources:
requests: requests:
memory: "256Mi" memory: "256Mi"

View File

@ -76,22 +76,6 @@ spec:
value: "https://qiyuan-log-center-api.airlabs.art" value: "https://qiyuan-log-center-api.airlabs.art"
- name: LOG_CENTER_ENABLED - name: LOG_CENTER_ENABLED
value: "true" value: "true"
livenessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /healthz/
port: 8000
initialDelaySeconds: 15
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources: resources:
requests: requests:
memory: "256Mi" memory: "256Mi"

View File

@ -5,7 +5,7 @@ certifi==2026.1.4
cffi==2.0.0 cffi==2.0.0
charset-normalizer==3.4.4 charset-normalizer==3.4.4
crcmod==1.7 crcmod==1.7
cryptography==44.0.3 cryptography==46.0.4
Django==6.0.1 Django==6.0.1
django-cors-headers==4.9.0 django-cors-headers==4.9.0
djangorestframework==3.16.1 djangorestframework==3.16.1
@ -26,16 +26,8 @@ requests==2.32.5
six==1.17.0 six==1.17.0
sqlparse==0.5.5 sqlparse==0.5.5
urllib3==2.6.3 urllib3==2.6.3
python-dotenv==1.0.0
drf-spectacular==0.27.1 drf-spectacular==0.27.1
alibabacloud_dysmsapi20170525==4.4.0 alibabacloud_dysmsapi20170525>=4.4.0
alibabacloud_dypnsapi20170525==2.0.0 alibabacloud_dypnsapi20170525>=3.0.0
alibabacloud-tea-openapi==0.4.3
alibabacloud-tea-util==0.3.14
alibabacloud-credentials==1.0.2
alibabacloud-openapi-util==0.2.2
alibabacloud-gateway-spi==0.0.3
alibabacloud-endpoint-util==0.0.4
darabonba-core==1.0.5
volcengine-python-sdk[ark]>=5.0.9 volcengine-python-sdk[ark]>=5.0.9
edge-tts>=6.1.0 edge-tts>=6.1.0

View File

@ -6,10 +6,7 @@ import traceback
import threading import threading
import requests import requests
from rest_framework.views import exception_handler from rest_framework.views import exception_handler
from rest_framework.exceptions import AuthenticationFailed as DRFAuthenticationFailed
from rest_framework.exceptions import NotAuthenticated
from rest_framework import status from rest_framework import status
from rest_framework_simplejwt.exceptions import InvalidToken, AuthenticationFailed as JWTAuthenticationFailed
from utils.response import APIResponse from utils.response import APIResponse
@ -139,8 +136,8 @@ class ErrorCode:
def custom_exception_handler(exc, context): def custom_exception_handler(exc, context):
"""自定义异常处理器""" """自定义异常处理器"""
# 上报到 Log Center (排除业务异常和认证异常,这些是正常业务流程) # 上报到 Log Center (仅上报非业务异常)
if not isinstance(exc, (BusinessException, DRFAuthenticationFailed, NotAuthenticated, InvalidToken, JWTAuthenticationFailed)): if not isinstance(exc, BusinessException):
report_to_log_center(exc, context) report_to_log_center(exc, context)
# 处理业务异常 # 处理业务异常