diff --git a/Dockerfile.lite b/Dockerfile.lite deleted file mode 100644 index cafdac3d..00000000 --- a/Dockerfile.lite +++ /dev/null @@ -1,92 +0,0 @@ -FROM python:3.12.8-slim-bookworm -ENV LANG="C.UTF-8" \ - TZ="Asia/Shanghai" \ - HOME="/moviepilot" \ - CONFIG_DIR="/config" \ - TERM="xterm" \ - DISPLAY=:987 \ - PUID=0 \ - PGID=0 \ - UMASK=000 \ - PORT=3001 \ - NGINX_PORT=3000 \ - MOVIEPILOT_AUTO_UPDATE=release -WORKDIR "/app" -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get -y install \ - musl-dev \ - nginx \ - gettext-base \ - locales \ - procps \ - gosu \ - bash \ - wget \ - curl \ - busybox \ - dumb-init \ - jq \ - fuse3 \ - rsync \ - ffmpeg \ - nano \ - && \ - if [ "$(uname -m)" = "x86_64" ]; \ - then ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1; \ - elif [ "$(uname -m)" = "aarch64" ]; \ - then ln -s /usr/lib/aarch64-linux-musl/libc.so /lib/libc.musl-aarch64.so.1; \ - fi \ - && curl https://rclone.org/install.sh | bash \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf \ - /tmp/* \ - /moviepilot/.cache \ - /var/lib/apt/lists/* \ - /var/tmp/* -COPY requirements.in requirements.in -RUN apt-get update -y \ - && apt-get install -y build-essential \ - && pip install --upgrade pip \ - && pip install Cython pip-tools \ - && pip-compile requirements.in \ - && pip install -r requirements.txt \ - && playwright install-deps chromium \ - && apt-get remove -y build-essential \ - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf \ - /tmp/* \ - /moviepilot/.cache \ - /var/lib/apt/lists/* \ - /var/tmp/* -COPY . . -RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ - && cp -f /app/update /usr/local/bin/mp_update \ - && cp -f /app/entrypoint /entrypoint \ - && cp -f /app/docker_http_proxy.conf /etc/nginx/docker_http_proxy.conf \ - && chmod +x /entrypoint /usr/local/bin/mp_update \ - && mkdir -p ${HOME} \ - && groupadd -r moviepilot -g 918 \ - && useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 918 \ - && python_ver=$(python3 -V | awk '{print $2}') \ - && echo "/app/" > /usr/local/lib/python${python_ver%.*}/site-packages/app.pth \ - && echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ - && echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ - && locale-gen zh_CN.UTF-8 \ - && python3 /app/setup.py \ - && find /app/app -type f -name "*.py" ! -path "/app/app/main.py" -exec rm -f {} \; \ - && FRONTEND_VERSION=$(sed -n "s/^FRONTEND_VERSION\s*=\s*'\([^']*\)'/\1/p" /app/version.py) \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/${FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \ - && mv /dist /public \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Plugins/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ - && mv -f /tmp/MoviePilot-Plugins-main/plugins.v2/* /app/app/plugins/ \ - && cat /tmp/MoviePilot-Plugins-main/package.json | jq -r 'to_entries[] | select(.value.v2 == true) | .key' | awk '{print tolower($0)}' | \ - while read -r i; do if [ ! -d "/app/app/plugins/$i" ]; then mv "/tmp/MoviePilot-Plugins-main/plugins/$i" "/app/app/plugins/"; else echo "跳过 $i"; fi; done \ - && curl -sL "https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" | busybox unzip -d /tmp - \ - && mv -f /tmp/MoviePilot-Resources-main/resources/* /app/app/helper/ \ - && rm -rf /tmp/* /app/build -EXPOSE 3000 -VOLUME [ "/config" ] -ENTRYPOINT [ "/entrypoint" ] \ No newline at end of file diff --git a/Dockerfile b/docker/Dockerfile similarity index 86% rename from Dockerfile rename to docker/Dockerfile index e6314f41..6197ab8d 100644 --- a/Dockerfile +++ b/docker/Dockerfile @@ -45,7 +45,7 @@ RUN apt-get update -y \ /moviepilot/.cache \ /var/lib/apt/lists/* \ /var/tmp/* -COPY requirements.in requirements.in +COPY ../requirements.in requirements.in RUN apt-get update -y \ && apt-get install -y build-essential \ && pip install --upgrade pip \ @@ -61,12 +61,13 @@ RUN apt-get update -y \ /moviepilot/.cache \ /var/lib/apt/lists/* \ /var/tmp/* -COPY . . -RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ - && cp -f /app/update /usr/local/bin/mp_update \ - && cp -f /app/entrypoint /entrypoint \ - && cp -f /app/docker_http_proxy.conf /etc/nginx/docker_http_proxy.conf \ - && chmod +x /entrypoint /usr/local/bin/mp_update \ +COPY .. . +RUN cp -f /app/docker/nginx.common.conf /etc/nginx/common.conf \ + && cp -f /app/docker/nginx.template.conf /etc/nginx/nginx.template.conf \ + && cp -f /app/docker/update.sh /usr/local/bin/mp_update.sh \ + && cp -f /app/docker/entrypoint.sh /entrypoint.sh \ + && cp -f /app/docker/docker_http_proxy.conf /etc/nginx/docker_http_proxy.conf \ + && chmod +x /entrypoint.sh /usr/local/bin/mp_update.sh \ && mkdir -p ${HOME} \ && groupadd -r moviepilot -g 918 \ && useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 918 \ @@ -87,4 +88,4 @@ RUN cp -f /app/nginx.conf /etc/nginx/nginx.template.conf \ && rm -rf /tmp/* EXPOSE 3000 VOLUME [ "/config" ] -ENTRYPOINT [ "/entrypoint" ] \ No newline at end of file +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/docker/cert.sh b/docker/cert.sh new file mode 100644 index 00000000..185a9b7f --- /dev/null +++ b/docker/cert.sh @@ -0,0 +1,77 @@ +#!/bin/bash +set -e + +Green="\033[32m" +Red="\033[31m" +Yellow='\033[33m' +Font="\033[0m" +INFO="[${Green}INFO${Font}]" +ERROR="[${Red}ERROR${Font}]" +WARN="[${Yellow}WARN${Font}]" +function INFO() { + echo -e "${INFO} ${1}" +} +function ERROR() { + echo -e "${ERROR} ${1}" +} +function WARN() { + echo -e "${WARN} ${1}" +} + +# 仅当启用HTTPS且需要自动签发时执行 +if [ "$ENABLE_SSL" = "true" ] && [ "$AUTO_ISSUE_CERT" = "true" ]; then + INFO "▄■▀▄■▀▄■▀▄■▀▄■▀ 证书管理开始 ▀■▄▀■▄▀■▄▀■▄▀■▄" + + # 创建证书目录 + mkdir -p /config/certs/"${SSL_DOMAIN}" + chown moviepilot:moviepilot /config/certs -R + + # 安装acme.sh + if [ ! -d "/config/acme.sh" ]; then + INFO "→ 安装acme.sh..." + git clone https://github.com/acmesh-official/acme.sh.git /config/acme.sh + cd /config/acme.sh + ./acme.sh --install --home /config/acme.sh \ + --config-home /config/acme.sh/data \ + --cert-home /config/certs \ + --accountemail "${SSL_EMAIL}" + fi + + # 签发证书(仅当证书不存在时) + if [ ! -f "/config/certs/${SSL_DOMAIN}/fullchain.pem" ]; then + # 检查必要参数 + [ -z "${DNS_PROVIDER}" ] && { ERROR "必须指定DNS_PROVIDER环境变量"; exit 1; } + [ -z "${SSL_DOMAIN}" ] && { ERROR "必须指定SSL_DOMAIN环境变量"; exit 1; } + + INFO "→ 签发证书: ${SSL_DOMAIN} (DNS验证方式: ${DNS_PROVIDER})" + + # 导出所有ACME_ENV_开头的环境变量(自动去除前缀) + INFO "正在加载ACME环境变量..." + for acme_var in $(env | grep '^ACME_ENV_'); do + key="${acme_var#ACME_ENV_}" + key="${key%%=*}" + value="${acme_var#ACME_ENV_${key}=}" + export "${key}=${value}" + INFO "已加载环境变量: ${key}=******" + done + + # 签发证书 + /config/acme.sh/acme.sh --issue \ + --dns "${DNS_PROVIDER}" \ + --domain "${SSL_DOMAIN}" \ + --key-file /config/certs/"${SSL_DOMAIN}"/privkey.pem \ + --fullchain-file /config/certs/"${SSL_DOMAIN}"/fullchain.pem \ + --force + + # 创建稳定符号链接 + ln -sf /config/certs/"${SSL_DOMAIN}" /config/certs/latest + fi + + # 配置自动更新任务 + INFO "→ 配置cron自动更新..." + echo "0 3 * * * /config/acme.sh/acme.sh --cron --home /config/acme.sh && nginx -s reload" > /etc/cron.d/acme + chmod 644 /etc/cron.d/acme + service cron start + + INFO "▄■▀▄■▀▄■▀▄■▀▄■▀ 证书管理完成 ▀■▄▀■▄▀■▄▀■▄▀■▄" +fi \ No newline at end of file diff --git a/docker_http_proxy.conf b/docker/docker_http_proxy.conf similarity index 100% rename from docker_http_proxy.conf rename to docker/docker_http_proxy.conf diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 00000000..0b389101 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# shellcheck shell=bash +# shellcheck disable=SC2016 +# shellcheck disable=SC2155 + +Green="\033[32m" +Red="\033[31m" +Yellow='\033[33m' +Font="\033[0m" +INFO="[${Green}INFO${Font}]" +ERROR="[${Red}ERROR${Font}]" +WARN="[${Yellow}WARN${Font}]" +function INFO() { + echo -e "${INFO} ${1}" +} +function ERROR() { + echo -e "${ERROR} ${1}" +} +function WARN() { + echo -e "${WARN} ${1}" +} + +# 生成HTTPS配置块 +if [ "$ENABLE_SSL" = "true" ]; then + export HTTPS_SERVER_CONF=$(cat < /etc/nginx/nginx.conf +# 自动更新 +cd / +source /usr/local/bin/mp_update.sh +cd /app || exit +# 更改 moviepilot userid 和 groupid +groupmod -o -g "${PGID}" moviepilot +usermod -o -u "${PUID}" moviepilot +# 更改文件权限 +chown -R moviepilot:moviepilot \ + "${HOME}" \ + /app \ + /public \ + /config \ + /var/lib/nginx \ + /var/log/nginx +chown moviepilot:moviepilot /etc/hosts /tmp +# 下载浏览器内核 +if [[ "$HTTPS_PROXY" =~ ^https?:// ]] || [[ "$HTTPS_PROXY" =~ ^https?:// ]] || [[ "$PROXY_HOST" =~ ^https?:// ]]; then + HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-$PROXY_HOST}}" gosu moviepilot:moviepilot playwright install chromium +else + gosu moviepilot:moviepilot playwright install chromium +fi +# 证书管理 +source /app/docker/cert.sh +# 启动前端nginx服务 +INFO "→ 启动前端nginx服务..." +nginx +# 启动docker http proxy nginx +if [ -S "/var/run/docker.sock" ]; then + INFO "→ 启动 Docker Proxy..." + nginx -c /etc/nginx/docker_http_proxy.conf + # 上面nginx是通过root启动的,会将目录权限改成root,所以需要重新再设置一遍权限 + chown -R moviepilot:moviepilot \ + /var/lib/nginx \ + /var/log/nginx +fi +# 设置后端服务权限掩码 +umask "${UMASK}" +# 启动后端服务 +INFO "→ 启动后端服务..." +exec dumb-init gosu moviepilot:moviepilot python3 app/main.py diff --git a/docker/nginx.common.conf b/docker/nginx.common.conf new file mode 100644 index 00000000..04b54431 --- /dev/null +++ b/docker/nginx.common.conf @@ -0,0 +1,100 @@ + +# 公共根目录 +root /public; + +# 主应用路由 +location / { + expires off; + add_header Cache-Control "no-cache, no-store, must-revalidate"; + try_files $uri $uri/ /index.html; +} + +# 图片类静态资源 +location ~* \.(png|jpg|jpeg|gif|ico|svg)$ { + expires 1y; + add_header Cache-Control "public, immutable"; +} + +# assets目录 +location /assets { + expires 1y; + add_header Cache-Control "public, immutable"; +} + +# 站点图标 +location /api/v1/site/icon/ { + # 站点图标缓存 + proxy_cache my_cache; + # 缓存响应码为200和302的请求1小时 + proxy_cache_valid 200 302 1h; + # 缓存其他响应码的请求5分钟 + proxy_cache_valid any 5m; + # 缓存键的生成规则 + proxy_cache_key "$scheme$request_method$host$request_uri"; + proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; + + # 向后端API转发请求 + proxy_pass http://backend_api; +} + + +# 本地CookieCloud +location /cookiecloud { + proxy_pass http://backend_api; + rewrite ^.+mock-server/?(.*)$ /$1 break; + proxy_http_version 1.1; + proxy_buffering off; + proxy_cache off; + proxy_redirect off; + proxy_set_header Connection ""; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Nginx-Proxy true; + + # 超时设置 + proxy_read_timeout 600s; +} + +# SSE特殊配置 +location ~ ^/api/v1/system/(message|progress/) { + # SSE MIME类型设置 + default_type text/event-stream; + + # 禁用缓存 + add_header Cache-Control no-cache; + add_header X-Accel-Buffering no; + proxy_buffering off; + proxy_cache off; + + # 代理设置 + proxy_pass http://backend_api; + proxy_http_version 1.1; + proxy_set_header Connection ""; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # 超时设置 + proxy_read_timeout 3600s; +} + +# API代理配置 +location /api { + proxy_pass http://backend_api; + rewrite ^.+mock-server/?(.*)$ /$1 break; + proxy_http_version 1.1; + proxy_buffering off; + proxy_cache off; + proxy_redirect off; + proxy_set_header Connection ""; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Nginx-Proxy true; + + # 超时设置 + proxy_read_timeout 600s; +} \ No newline at end of file diff --git a/docker/nginx.template.conf b/docker/nginx.template.conf new file mode 100644 index 00000000..b318ec15 --- /dev/null +++ b/docker/nginx.template.conf @@ -0,0 +1,50 @@ +user moviepilot; +worker_processes auto; +worker_cpu_affinity auto; + + +events { + worker_connections 1024; +} + + +http { + # 设置缓存路径和缓存区大小 + proxy_cache_path /tmp levels=1:2 keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off; + + sendfile on; + + keepalive_timeout 3600; + + client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE}; + + gzip on; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + gzip_proxied any; + gzip_min_length 256; + gzip_vary on; + gzip_comp_level 6; + + # HTTP + server { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + listen ${NGINX_PORT}; + listen [::]:${NGINX_PORT}; + server_name moviepilot; + + # 公共配置 + include common.conf; + } + + # HTTPS + ${HTTPS_SERVER_CONF} + + upstream backend_api { + # 后端API的地址和端口 + server 127.0.0.1:${PORT}; + # 可以添加更多后端服务器作为负载均衡 + } + +} diff --git a/update b/docker/update.sh similarity index 94% rename from update rename to docker/update.sh index a4664aa0..c4af7e35 100644 --- a/update +++ b/docker/update.sh @@ -26,7 +26,7 @@ function download_and_unzip() { local max_retries=3 local url="$1" local target_dir="$2" - INFO "正在下载 ${url}..." + INFO "→ 正在下载 ${url}..." while [ $retries -lt $max_retries ]; do if curl ${CURL_OPTIONS} "${url}" ${CURL_HEADERS} | busybox unzip -d ${TMP_PATH} - > /dev/null; then if [ -e ${TMP_PATH}/MoviePilot-* ]; then @@ -54,19 +54,19 @@ function install_backend_and_download_resources() { return 1 fi INFO "后端程序下载成功" - INFO "依赖安装中..." + INFO "→ 正在安装依赖..." if ! pip install ${PIP_OPTIONS} --upgrade --root-user-action=ignore pip > /dev/null; then ERROR "pip 更新失败,请重新拉取镜像" return 1 fi if ! pip install ${PIP_OPTIONS} --root-user-action=ignore -r ${TMP_PATH}/App/requirements.txt > /dev/null; then - ERROR "安装依赖失败,请重新拉取镜像" + ERROR "依赖安装失败,请重新拉取镜像" return 1 fi - INFO "安装依赖成功" + INFO "依赖安装成功" # 如果是"heads/v2.zip",则查找v2开头的最新版本号 if [[ "${1}" == "heads/v2.zip" ]]; then - INFO "正在获取前端最新版本号..." + INFO "→ 正在获取前端最新版本号..." # 获取所有发布的版本列表,并筛选出以v2开头的版本号 releases=$(curl ${CURL_OPTIONS} "https://api.github.com/repos/jxxghp/MoviePilot-Frontend/releases" ${CURL_HEADERS} | jq -r '.[].tag_name' | grep "^v2\.") if [ -z "$releases" ]; then @@ -78,7 +78,7 @@ function install_backend_and_download_resources() { fi INFO "前端最新版本号:${frontend_version}" else - INFO "正在获取前端版本号..." + INFO "→ 正在获取前端版本号..." # 从后端文件中读取前端版本号 frontend_version=$(sed -n "s/^FRONTEND_VERSION\s*=\s*'\([^']*\)'/\1/p" ${TMP_PATH}/App/version.py) if [[ "${frontend_version}" != *v* ]]; then @@ -94,13 +94,13 @@ function install_backend_and_download_resources() { fi INFO "前端程序下载成功" # 备份插件目录 - INFO "备份插件目录中..." + INFO "→ 正在备份插件目录..." rm -rf /plugins mkdir -p /plugins cp -a /app/app/plugins/* /plugins/ rm -f /plugins/__init__.py # 备份站点资源 - INFO "备份站点资源目录中..." + INFO "→ 正在备份站点资源目录..." rm -rf /resources_bakcup mkdir /resources_bakcup cp -a /app/app/helper/user.sites.bin /resources_bakcup @@ -118,14 +118,13 @@ function install_backend_and_download_resources() { # 恢复插件目录 cp -a /plugins/* /app/app/plugins/ # 更新站点资源 - INFO "开始更新站点资源..." + INFO "→ 开始更新站点资源..." if ! download_and_unzip "${GITHUB_PROXY}https://github.com/jxxghp/MoviePilot-Resources/archive/refs/heads/main.zip" "Resources"; then cp -a /resources_bakcup/* /app/app/helper/ rm -rf /resources_bakcup WARN "站点资源下载失败,继续使用旧的资源来启动..." return 1 fi - INFO "站点资源下载成功" # 复制新站点资源 cp -a ${TMP_PATH}/Resources/resources/* /app/app/helper/ INFO "站点资源更新成功" @@ -265,6 +264,7 @@ function get_priority() { } if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" = "release" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" = "dev" ]]; then + INFO "▄■▀▄■▀▄■▀▄■▀▄■▀ 自动更新开始 ▀■▄▀■▄▀■▄▀■▄▀■▄" TMP_PATH=$(mktemp -d) if [ ! -d "${TMP_PATH}" ]; then # 如果自动生成 tmp 文件夹失败则手动指定,避免出现数据丢失等情况 @@ -326,6 +326,7 @@ if [[ "${MOVIEPILOT_AUTO_UPDATE}" = "true" ]] || [[ "${MOVIEPILOT_AUTO_UPDATE}" if [ -d "${TMP_PATH}" ]; then rm -rf "${TMP_PATH}" fi + INFO "▄■▀▄■▀▄■▀▄■▀▄■▀ 自动更新完成 ▀■▄▀■▄▀■▄▀■▄▀■▄" elif [[ "${MOVIEPILOT_AUTO_UPDATE}" = "false" ]]; then INFO "程序自动升级已关闭,如需自动升级请在创建容器时设置环境变量:MOVIEPILOT_AUTO_UPDATE=release" else diff --git a/entrypoint b/entrypoint deleted file mode 100644 index 7296b016..00000000 --- a/entrypoint +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# shellcheck shell=bash -# shellcheck disable=SC2016 - -# 使用 `envsubst` 将模板文件中的 ${NGINX_PORT} 替换为实际的环境变量值 -export NGINX_CLIENT_MAX_BODY_SIZE=${NGINX_CLIENT_MAX_BODY_SIZE:-10m} -envsubst '${NGINX_PORT}${PORT}${NGINX_CLIENT_MAX_BODY_SIZE}' < /etc/nginx/nginx.template.conf > /etc/nginx/nginx.conf -# 自动更新 -cd / -/usr/local/bin/mp_update -cd /app || exit -# 更改 moviepilot userid 和 groupid -groupmod -o -g "${PGID}" moviepilot -usermod -o -u "${PUID}" moviepilot -# 更改文件权限 -chown -R moviepilot:moviepilot \ - "${HOME}" \ - /app \ - /public \ - /config \ - /var/lib/nginx \ - /var/log/nginx -chown moviepilot:moviepilot /etc/hosts /tmp -# 下载浏览器内核 -if [[ "$HTTPS_PROXY" =~ ^https?:// ]] || [[ "$https_proxy" =~ ^https?:// ]] || [[ "$PROXY_HOST" =~ ^https?:// ]]; then - HTTPS_PROXY="${HTTPS_PROXY:-${https_proxy:-$PROXY_HOST}}" gosu moviepilot:moviepilot playwright install chromium -else - gosu moviepilot:moviepilot playwright install chromium -fi -# 启动前端nginx服务 -nginx -# 启动docker http proxy nginx -if [ -S "/var/run/docker.sock" ]; then - nginx -c /etc/nginx/docker_http_proxy.conf - # 上面nginx是通过root启动的,会将目录权限改成root,所以需要重新再设置一遍权限 - chown -R moviepilot:moviepilot \ - /var/lib/nginx \ - /var/log/nginx -fi -# 设置后端服务权限掩码 -umask "${UMASK}" -# 启动后端服务 -exec dumb-init gosu moviepilot:moviepilot python3 app/main.py diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index 99158f84..00000000 --- a/nginx.conf +++ /dev/null @@ -1,142 +0,0 @@ -user moviepilot; -worker_processes auto; -worker_cpu_affinity auto; - - -events { - worker_connections 1024; -} - - -http { - - # 设置缓存路径和缓存区大小 - proxy_cache_path /tmp levels=1:2 keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off; - - sendfile on; - - keepalive_timeout 3600; - - client_max_body_size ${NGINX_CLIENT_MAX_BODY_SIZE}; - - gzip on; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; - gzip_proxied any; - gzip_min_length 256; - gzip_vary on; - gzip_comp_level 6; - - server { - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - listen ${NGINX_PORT}; - listen [::]:${NGINX_PORT}; - server_name moviepilot; - - location / { - # 主目录 - expires off; - add_header Cache-Control "no-cache, no-store, must-revalidate"; - root /public; - try_files $uri $uri/ /index.html; - } - - location ~* \.(png|jpg|jpeg|gif|ico|svg)$ { - # 静态资源 - expires 1y; - add_header Cache-Control "public, immutable"; - root /public; - } - - location /assets { - # 静态资源 - expires 1y; - add_header Cache-Control "public, immutable"; - root /public; - } - - location /api/v1/site/icon/ { - # 站点图标缓存 - proxy_cache my_cache; - # 缓存响应码为200和302的请求1小时 - proxy_cache_valid 200 302 1h; - # 缓存其他响应码的请求5分钟 - proxy_cache_valid any 5m; - # 缓存键的生成规则 - proxy_cache_key "$scheme$request_method$host$request_uri"; - proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; - - # 向后端API转发请求 - proxy_pass http://backend_api; - } - - location /cookiecloud { - # 后端cookiecloud地址 - proxy_pass http://backend_api; - rewrite ^.+mock-server/?(.*)$ /$1 break; - proxy_http_version 1.1; - proxy_buffering off; - proxy_cache off; - proxy_redirect off; - proxy_set_header Connection ""; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-Nginx-Proxy true; - - # 超时设置 - proxy_read_timeout 600s; - } - - location ~ ^/api/v1/system/(message|progress/) { - # SSE MIME类型设置 - default_type text/event-stream; - - # 禁用缓存 - add_header Cache-Control no-cache; - add_header X-Accel-Buffering no; - proxy_buffering off; - proxy_cache off; - - # 代理设置 - proxy_pass http://backend_api; - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # 超时设置 - proxy_read_timeout 3600s; - } - - location /api { - # 后端API - proxy_pass http://backend_api; - rewrite ^.+mock-server/?(.*)$ /$1 break; - proxy_http_version 1.1; - proxy_buffering off; - proxy_cache off; - proxy_redirect off; - proxy_set_header Connection ""; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $http_host; - proxy_set_header X-Nginx-Proxy true; - - # 超时设置 - proxy_read_timeout 600s; - } - } - - upstream backend_api { - # 后端API的地址和端口 - server 127.0.0.1:${PORT}; - # 可以添加更多后端服务器作为负载均衡 - } - -} diff --git a/version.py b/version.py index e76cf306..417b1486 100644 --- a/version.py +++ b/version.py @@ -1,2 +1,2 @@ -APP_VERSION = 'v2.4.0' +APP_VERSION = 'beta' FRONTEND_VERSION = 'v2.4.0'