master
jinql 2025-09-03 22:56:30 +08:00
parent e54e69b940
commit ae73b2cd4a
6 changed files with 12 additions and 12 deletions

View File

@ -31,7 +31,7 @@ EXPOSE 8000
VOLUME ["/app/data", "/app/conf", "/app/logs"]
ENTRYPOINT ["entrypoint.sh"]
ENTRYPOINT ["/app/entrypoint.sh"]
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["gunicorn", "-c", "conf/gunicorn.conf.py", "main:app"]

View File

@ -2,7 +2,7 @@ version: 1
disable_existing_loggers: false
formatters:
default:
format: "[%(levelname)-7s] %(asctime)s [%(process)d] -[%(name)s:%(lineno)d] %(message)s"
format: "[%(levelname)-7s] %(asctime)s [%(process)d] -[%(filename)s:%(lineno)d] %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
handlers:

View File

@ -8,7 +8,7 @@ import yaml
bind = "0.0.0.0:8000"
# Worker 进程数(推荐 CPU 核心数 * 2 + 1
workers = 1
workers = 4
# 工作模式sync、gevent、uvicorn.workers.UvicornWorker
worker_class = "uvicorn.workers.UvicornWorker"

View File

@ -2,7 +2,7 @@ version: 1
disable_existing_loggers: false
formatters:
default:
format: "[%(levelname)-7s] %(asctime)s [%(process)d] -[%(name)s:%(lineno)d] %(message)s"
format: "[%(levelname)-7s] %(asctime)s [%(process)d] -[%(filename)s:%(lineno)d] %(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
handlers:

View File

@ -4,29 +4,29 @@ set -e
mkdir -p /app/conf
default_conf_dir="/app/conf.default/"
default_conf_dir="/app/conf.default"
gunicorn_conf="/app/conf/gunicorn.conf.py"
logging_conf="/app/conf/logging.yaml"
if [ ! -f "$gunicorn_conf" ]; then
echo "复制默认的gunicorn.conf.py配置文件..."
if [ -f "$default_conf_dir/gunicorn.conf.py" ]; then
cp "$default_conf_dir/gunicorn.conf.py" "$gunicorn_conf"
echo "复制gunicorn.conf.py..."
if [ -f "$default_conf_dir/gunicorn_conf_py" ]; then
cp "$default_conf_dir/gunicorn_conf_py" "$gunicorn_conf"
chmod 644 "$gunicorn_conf"
echo "成功复制gunicorn.conf.py"
echo "成功复制gunicorn.conf.py"
else
echo "警告:默认配置文件 $default_conf_dir/gunicorn.conf.py 不存在,创建空文件"
echo "警告:默认配置文件 $default_conf_dir/gunicorn_conf_py 不存在,创建空文件"
touch "$gunicorn_conf"
chmod 644 "$gunicorn_conf"
fi
fi
if [ ! -f "$logging_conf" ]; then
echo "复制默认的logging.yaml配置文件..."
echo "复制logging.yaml..."
if [ -f "$default_conf_dir/logging.yaml" ]; then
cp "$default_conf_dir/logging.yaml" "$logging_conf"
chmod 644 "$logging_conf"
echo "成功复制logging.yaml"
echo "成功复制logging.yaml"
else
echo "警告:默认配置文件 $default_conf_dir/logging.yaml 不存在,创建空文件"
touch "$logging_conf"