Skip to content

Update the granian env to command params #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,6 @@ RUN mkdir -p /var/log/fastapi_server

EXPOSE 8001

# Granian env
ENV GRANIAN_HOST=0.0.0.0 \
GRANIAN_PORT=8001 \
# 并行工作进程数
GRANIAN_WORKERS=1 \
# 监听队列
GRANIAN_BACKLOG=1024 \
# 每个工作进程处理超时时间
GRANIAN_WORKERS_KILL_TIMEOUT=120 \
# 每个工作进程最大并发量
GRANIAN_BACKPRESSURE=2000 \
# PID 文件
GRANIAN_PID_FILE='/var/run/granian.pid' \
# 日志
GRANIAN_LOG_ENABLED=true \
GRANIAN_LOG_LEVEL='debug'

CMD ["/usr/local/bin/granian", "main:app", "--interface", "asgi", "--host", "0.0.0.0", "--port","8000"]

# === Celery server image ===
Expand Down
2 changes: 1 addition & 1 deletion deploy/backend/fastapi_server.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[program:fastapi_server]
directory=/fba/backend
command=/usr/local/bin/granian main:app --interface asgi
command=/usr/local/bin/granian main:app --interface asgi --host 0.0.0.0 --port 8001 --workers 1 --backlog 1024 --workers-kill-timeout 120 --backpressure 2000 --pid-file /var/run/granian.pid --log --log-level debug
user=root
autostart=true
autorestart=true
Expand Down