更新部署

This commit is contained in:
ganweichong 2025-10-12 18:29:23 +08:00
parent 77313e837f
commit a97d1b4cac
7 changed files with 31 additions and 12 deletions

View File

@ -5,6 +5,7 @@ services:
selenium-redis-service: selenium-redis-service:
image: redis:7.0.5 image: redis:7.0.5
container_name: selenium-redis-container container_name: selenium-redis-container
restart: always
ports: ports:
- "6380:6379" - "6380:6379"
@ -13,8 +14,9 @@ services:
build: ./selenium build: ./selenium
image: selenium-crawl-image:1.0 image: selenium-crawl-image:1.0
container_name: selenium-crawl-container container_name: selenium-crawl-container
ports: restart: always
- "5001:5000" expose:
- "5000"
environment: environment:
API_MODEL: "glm-4.5" API_MODEL: "glm-4.5"
API_BASE_URL: "https://open.bigmodel.cn/api/paas/v4" API_BASE_URL: "https://open.bigmodel.cn/api/paas/v4"
@ -24,12 +26,13 @@ services:
build: ./selenium_django build: ./selenium_django
image: selenium-django-image:1.0 image: selenium-django-image:1.0
container_name: selenium-django-container container_name: selenium-django-container
restart: always
environment: environment:
PYTHONUNBUFFERED: 1 PYTHONUNBUFFERED: 1
CELERY_BROKER_URL: redis://selenium-redis-container:6379/0 CELERY_BROKER_URL: redis://selenium-redis-container:6379/0
CELERY_RESULT_BACKEND: redis://selenium-redis-container:6379/0 CELERY_RESULT_BACKEND: redis://selenium-redis-container:6379/0
# Django 调用爬虫服务的地址 # Django 调用爬虫服务的地址
CRAWL_API_URL: http://47.83.141.164:5001 CRAWL_API_URL: http://selenium-crawl-container:5000/crawl
# API 配置 # API 配置
API_MODEL: "glm-4-long" API_MODEL: "glm-4-long"
API_BASE_URL: "https://open.bigmodel.cn/api/paas/v4" API_BASE_URL: "https://open.bigmodel.cn/api/paas/v4"
@ -39,22 +42,26 @@ services:
depends_on: depends_on:
- selenium-redis-service - selenium-redis-service
- selenium-crawl-service - selenium-crawl-service
ports: expose:
- "8002:8000" - "8000"
# ---------- 前端 Vue ---------- # ---------- 前端 Vue ----------
selenium-vue-service: selenium-vue-service:
build: build:
context: ./selenium_vue # 上一级目录 context: ./selenium_vue
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
VITE_API_BASE_URL: http://47.83.141.164:8002 # 改为远程 IP VITE_BASE_URL: /selenium_web/
VITE_CRAWL_URL: http://47.83.141.164:5001 # 改为远程 IP VITE_API_BASE_URL: /selenium_api
VITE_CRAWL_URL: /selenium_crawl_api
image: selenium-vue-image:1.0 image: selenium-vue-image:1.0
container_name: selenium-vue-container container_name: selenium-vue-container
restart: always
environment: environment:
PORT: 80 PORT: 80
NGINX_SERVER_NAME: localhost NGINX_SERVER_NAME: localhost
volumes:
- "./nginx.conf:/etc/nginx/conf.d/default.conf"
depends_on: depends_on:
- selenium-crawl-service - selenium-crawl-service
- selenium-django-service - selenium-django-service

View File

@ -16,9 +16,9 @@ COPY . .
EXPOSE 8000 EXPOSE 8000
# 设置默认环境变量 # 设置默认环境变量
ENV CELERY_BROKER_URL=${CELERY_BROKER_URL:-redis://redis:6379/0} ENV CELERY_BROKER_URL=${CELERY_BROKER_URL:-redis://selenium-redis-container:6379/0}
ENV CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND:-redis://redis:6379/0} ENV CELERY_RESULT_BACKEND=${CELERY_RESULT_BACKEND:-redis://selenium-redis-container:6379/0}
ENV CRAWL_API_URL=${CRAWL_API_URL:-http://47.83.141.164:5001/crawl} ENV CRAWL_API_URL=${CRAWL_API_URL:-http://selenium-crawl-container:5000/crawl}
# 入口脚本 # 入口脚本
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh

View File

@ -24,7 +24,7 @@ CELERY_RESULT_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Shanghai' # 根据你本地时区调整 CELERY_TIMEZONE = 'Asia/Shanghai' # 根据你本地时区调整
# 爬虫api地址 # 爬虫api地址
CRAWL_API_URL = os.environ.get("CRAWL_API_URL", "http://selenium:5000/crawl") CRAWL_API_URL = os.environ.get("CRAWL_API_URL", "http://selenium-crawl-container:5000/crawl")
# 模型api配置 # 模型api配置
api_info = { api_info = {

View File

@ -4,10 +4,12 @@ FROM node:18-alpine as builder
# 设置工作目录 # 设置工作目录
WORKDIR /app WORKDIR /app
ARG VITE_BASE_URL
ARG VITE_API_BASE_URL ARG VITE_API_BASE_URL
ARG VITE_CRAWL_URL ARG VITE_CRAWL_URL
# 设置给构建时 Vite # 设置给构建时 Vite
ENV VITE_BASE_URL=${VITE_BASE_URL}
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
ENV VITE_CRAWL_URL=${VITE_CRAWL_URL} ENV VITE_CRAWL_URL=${VITE_CRAWL_URL}

View File

@ -4,6 +4,10 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>任务调度与知识问答</title> <title>任务调度与知识问答</title>
<!-- 设置 base 标签 -->
<base href="%BASE_URL%">
<!-- 引入 Website 项目的图标库 --> <!-- 引入 Website 项目的图标库 -->
<script src="/assets/iconfont.js"></script> <script src="/assets/iconfont.js"></script>
<link rel="stylesheet" href="/assets/iconfont.css"> <link rel="stylesheet" href="/assets/iconfont.css">

View File

@ -14,6 +14,8 @@
<span class="icon">📋</span> <span class="icon">📋</span>
Agent 任务管理 Agent 任务管理
</RouterLink> </RouterLink>
<!-- TODO: 暂不显示 -->
<!--
<RouterLink <RouterLink
class="menu-item" class="menu-item"
:class="{active: $route.name==='settings'}" :class="{active: $route.name==='settings'}"
@ -22,6 +24,7 @@
<span class="icon"></span> <span class="icon"></span>
系统设置 系统设置
</RouterLink> </RouterLink>
-->
</nav> </nav>
</aside> </aside>
<main class="content"> <main class="content">

View File

@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
export default defineConfig({ export default defineConfig({
base: process.env.VITE_BASE_URL || '/',
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
alias: { alias: {
@ -11,6 +12,7 @@ export default defineConfig({
server: { server: {
host: true, host: true,
port: 5173, port: 5173,
/*
proxy: { proxy: {
'/api/crawl': { '/api/crawl': {
target: process.env.VITE_CRAWL_API_URL || 'http://127.0.0.1:5000', target: process.env.VITE_CRAWL_API_URL || 'http://127.0.0.1:5000',
@ -18,5 +20,6 @@ export default defineConfig({
rewrite: (path) => path.replace(/^\/api/, '') rewrite: (path) => path.replace(/^\/api/, '')
} }
} }
*/
}, },
}) })