From e8aaeefe8505752770ffcda7f4fce0a1afc8b89f Mon Sep 17 00:00:00 2001 From: Liujian <824010343@qq.com> Date: Fri, 17 Oct 2025 10:13:19 +0800 Subject: [PATCH] update mcp param key --- scripts/.gitignore | 1 + scripts/Dockerfile | 5 +- scripts/frontend_build.sh | 1 - scripts/resource/default.conf | 79 ++++++++++++++++++++++++++ scripts/resource/sql/version-1.1.0.sql | 8 +-- scripts/resource/start.sh | 6 +- 6 files changed, 91 insertions(+), 9 deletions(-) create mode 100644 scripts/.gitignore create mode 100644 scripts/resource/default.conf diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 0000000..1fa1d52 --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1 @@ +/mysql/ diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 5cb9406..80e8901 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -3,7 +3,7 @@ # Description: Dockerfile for XPack FROM python:3.12.11-alpine3.22 -RUN apk add nodejs=~22 npm uv +RUN apk add nodejs=~22 npm uv nginx ENV TZ=Asia/Shanghai RUN ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ && echo "Asia/Shanghai" > /etc/timezone @@ -18,10 +18,11 @@ COPY requirements.txt /$APP/requirements.txt RUN uv venv && source .venv/bin/activate && uv pip install -r requirements.txt RUN echo $VERSION > .version + +COPY scripts/resource/default.conf /etc/nginx/http.d/default.conf COPY frontend/out/ /$APP/frontend COPY scripts/resource/ /$APP COPY pyproject.toml /$APP/pyproject.toml COPY services/ /$APP/services - CMD [ "./start.sh" ] \ No newline at end of file diff --git a/scripts/frontend_build.sh b/scripts/frontend_build.sh index 29237ac..e4035f8 100755 --- a/scripts/frontend_build.sh +++ b/scripts/frontend_build.sh @@ -72,7 +72,6 @@ clean_build_cache() { frontend_build() { echo_info "Begin frontend build..." cd "${FRONTEND_DIR}" || exit 1 - export NEXT_PUBLIC_API_URL=http://127.0.0.1:8001 echo_debug "Running command: pnpm install --frozen-lockfile" pnpm install --frozen-lockfile || exit 1 diff --git a/scripts/resource/default.conf b/scripts/resource/default.conf new file mode 100644 index 0000000..3ae8a06 --- /dev/null +++ b/scripts/resource/default.conf @@ -0,0 +1,79 @@ +# This is a default site configuration which will simply return 404, preventing +# chance access to any other virtualhost. + +server { + listen 80 default_server; + listen [::]:80 default_server; + location ^~ / { + proxy_pass http://127.0.0.1:3000; + 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_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + add_header Cache-Control no-cache; + proxy_ssl_server_name off; + proxy_ssl_name $proxy_host; + } + + location ^~ /uploads { + proxy_pass http://127.0.0.1:8001; + 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_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + add_header Cache-Control no-cache; + proxy_ssl_server_name off; + proxy_ssl_name $proxy_host; + } + + location ^~ /mcp { + proxy_pass http://127.0.0.1:8002; + 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_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + add_header Cache-Control no-cache; + proxy_ssl_server_name off; + proxy_ssl_name $proxy_host; + } + + location ^~ /api { + proxy_pass http://127.0.0.1:8001; + 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_set_header REMOTE-HOST $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_http_version 1.1; + add_header X-Cache $upstream_cache_status; + add_header Cache-Control no-cache; + proxy_ssl_server_name off; + proxy_ssl_name $proxy_host; + } + + # You may need this to prevent return 404 recursion. + location = /404.html { + internal; + } +} \ No newline at end of file diff --git a/scripts/resource/sql/version-1.1.0.sql b/scripts/resource/sql/version-1.1.0.sql index 3590b94..3aa0850 100644 --- a/scripts/resource/sql/version-1.1.0.sql +++ b/scripts/resource/sql/version-1.1.0.sql @@ -32,9 +32,9 @@ SET headers = CASE ELSE JSON_ARRAY() END; -ALTER TABLE `mcp_service` DROP COLUMN `auth_method`; -ALTER TABLE `mcp_service` DROP COLUMN `auth_header`; -ALTER TABLE `mcp_service` DROP COLUMN `auth_token`; +-- ALTER TABLE `mcp_service` DROP COLUMN `auth_method`; +-- ALTER TABLE `mcp_service` DROP COLUMN `auth_header`; +-- ALTER TABLE `mcp_service` DROP COLUMN `auth_token`; CREATE TABLE `onboarding_task` ( @@ -73,7 +73,7 @@ ALTER TABLE `temp_mcp_service` MODIFY COLUMN `output_token_price` decimal(10, 2) ALTER TABLE `user` MODIFY COLUMN `role_id` int NOT NULL COMMENT '角色 ID:0:未确定、1(租户)、2(租户下的普通用户)' AFTER `register_type`; -DELETE FROM sys_config WHERE `key` = "mcp_server_prefix" +DELETE FROM sys_config WHERE `key` = "mcp_server_prefix"; INSERT INTO `sys_config` (`id`,`key`, `value`,`description`,`created_at`,`updated_at`) VALUES ('xpack-version','version', '1.1.0', 'User wallet history max count', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) diff --git a/scripts/resource/start.sh b/scripts/resource/start.sh index 15ee38f..1ec8445 100755 --- a/scripts/resource/start.sh +++ b/scripts/resource/start.sh @@ -39,9 +39,11 @@ nohup uvicorn services.admin_service.main:app --host 0.0.0.0 --port 8001 --reloa sleep 5s nohup uvicorn services.api_service.main:app --host 0.0.0.0 --port 8002 --reload > ${LOG_DIR}/api_service.log 2>&1 & - -cd frontend/ && nohup node server.js > ${LOG_DIR}//frontend.log 2>&1 & +HOSTNAME="" +cd frontend/ && nohup node server.js> ${LOG_DIR}//frontend.log 2>&1 & sleep 2s +nginx + tail -F ${LOG_DIR}/*.log \ No newline at end of file