dev : 合并提交 #41
							
								
								
									
										128
									
								
								.gitea/workflow/deploy.test.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										128
									
								
								.gitea/workflow/deploy.test.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,128 @@ | |||||||
|  | name: CI/CD Pipeline | ||||||
|  | 
 | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - test  # 触发构建的分支 | ||||||
|  | 
 | ||||||
|  | env: | ||||||
|  |   # ========== 环境变量配置 ========== | ||||||
|  |   REGISTRY_URL: ${{vars.REGISTRY_URL}}          # 私有Docker镜像仓库地址 | ||||||
|  |   PROJECT_NAME: llmx            # 项目名称 | ||||||
|  |   COMPOSE_FILE: docker-compose.test.yml   # Docker compose文件路径 | ||||||
|  |   LUKE_SERVER_DOCKER_REGISTRY_PASSWORD: ${{ secrets.SERVER_PASSWORD }}  # 仓库密码 | ||||||
|  |   JCNC_GITEA_URL: ${{vars.SERVER_GITEA_URL}} # Gitea地址 | ||||||
|  |   RUNNER_TOOL_CACHE: /opt/tools-cache       # 工具缓存目录 | ||||||
|  |   GRADLE_CACHE_KEY: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||
|  |   SPRING_PROFILES_ACTIVE: test | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   build-and-deploy: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     container: | ||||||
|  |       image: jcnc/act-runner:latest         # 使用自定义Runner镜像 | ||||||
|  |       options: --user root                  # 以root用户运行(需要docker权限) | ||||||
|  | 
 | ||||||
|  |     steps: | ||||||
|  |       # ========== 1. 代码检出 ========== | ||||||
|  |       - name: 🛒 Checkout source code | ||||||
|  |         uses: ${{env.JCNC_GITEA_URL}}/actions/checkout@v4 | ||||||
|  |         with: | ||||||
|  |           fetch-depth: 0                    # 获取完整git历史(某些插件需要) | ||||||
|  | 
 | ||||||
|  |       # ========== 2. Docker环境准备 ========== | ||||||
|  |       - name: 🐳 Install Docker Environment | ||||||
|  |         run: | | ||||||
|  |           echo "=== 检查Docker安装状态 ===" | ||||||
|  |           if ! command -v docker >/dev/null; then | ||||||
|  |             echo "❌ Docker未安装,开始安装..." | ||||||
|  |             curl -fsSL https://get.docker.com | sh | tee docker-install.log | ||||||
|  |             echo "✅ Docker安装完成" | ||||||
|  |             echo "✅ Docker Compose安装完成" | ||||||
|  |           else | ||||||
|  |             echo "ℹ️ Docker已安装,版本: $(docker -v)" | ||||||
|  |             echo "ℹ️ Docker Compose已安装,版本: $(docker compose version)" | ||||||
|  |           fi | ||||||
|  | 
 | ||||||
|  |       # ========== 3. Gradle环境准备 ========== | ||||||
|  |       - name: 🔧 Prepare Gradle Environment | ||||||
|  |         run: | | ||||||
|  |           echo "赋予gradlew执行权限..." | ||||||
|  |           chmod +x gradlew | ||||||
|  |           echo "当前目录结构:" | ||||||
|  |           ls -al | ||||||
|  |       # ========== 4. 恢复缓存 ========== | ||||||
|  |       - name: 📦 Use Cache | ||||||
|  |         id: cache | ||||||
|  |         uses: ${{env.JCNC_GITEA_URL}}/actions/cache/restore@v4 | ||||||
|  |         with: | ||||||
|  |           path: | | ||||||
|  |             ~/.gradle/caches | ||||||
|  |             ~/.gradle/wrapper | ||||||
|  |             ~/.cache | ||||||
|  |           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||
|  |           restore-keys: | | ||||||
|  |             ${{ runner.os }}-gradle- | ||||||
|  |             ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||
|  |         env: | ||||||
|  |           ACTIONS_RUNNER_DEBUG: true       # 启用缓存调试输出 | ||||||
|  | 
 | ||||||
|  |       - name: ⚙️ Setup Gradle | ||||||
|  |         uses: ${{env.JCNC_GITEA_URL}}/gradle/actions/setup-gradle@v4 | ||||||
|  |         with: | ||||||
|  |           gradle-version: wrapper           # 使用项目自带的gradle-wrapper | ||||||
|  | 
 | ||||||
|  |       # ========== 5. 构建阶段 ========== | ||||||
|  |       - name: 🏗️ Build with Jib | ||||||
|  |         run: | | ||||||
|  |           echo "开始构建Docker镜像..." | ||||||
|  |           ./gradlew jib --stacktrace --build-cache --info -Dorg.gradle.caching=true -Dorg.gradle.jvmargs="-Xmx2g -Xms2g -XX:MaxMetaspaceSize=1g" | tee build.log | ||||||
|  |            | ||||||
|  |           echo "=== 镜像构建结果 ===" | ||||||
|  |           docker images | grep ${{env.PROJECT_NAME}} | ||||||
|  |       - name: 🛑 Stop Gradle Daemon | ||||||
|  |         run: | | ||||||
|  |           echo "停止Gradle守护进程..." | ||||||
|  |           ./gradlew --stop | ||||||
|  |           echo "剩余Java进程:" | ||||||
|  |           ps aux | grep java || true | ||||||
|  |       # ========== 6. 保存缓存 ========== | ||||||
|  |       - name: 📦 Save Cache | ||||||
|  |         id: cache | ||||||
|  |         uses: ${{env.JCNC_GITEA_URL}}/actions/cache/save@v4 | ||||||
|  |         with: | ||||||
|  |           path: | | ||||||
|  |             ~/.gradle/caches | ||||||
|  |             ~/.gradle/wrapper | ||||||
|  |             ~/.cache | ||||||
|  |           key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||
|  |           restore-keys: | | ||||||
|  |             ${{ runner.os }}-gradle- | ||||||
|  |             ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||||||
|  |         env: | ||||||
|  |           ACTIONS_RUNNER_DEBUG: true       # 启用缓存调试输出 | ||||||
|  |       # ========== 7. 部署阶段 ========== | ||||||
|  |       - name: 🔧 Prepare Deployment | ||||||
|  |         run: | | ||||||
|  |           echo "准备部署环境..." | ||||||
|  |           chmod +x ${COMPOSE_FILE} | ||||||
|  |           echo "当前Docker状态:" | ||||||
|  |           docker ps -a | ||||||
|  | 
 | ||||||
|  |       - name: 🧹 Clean Old Containers | ||||||
|  |         run: | | ||||||
|  |           echo "清理旧容器..." | ||||||
|  |           docker compose -f ${COMPOSE_FILE} down --remove-orphans | ||||||
|  |           echo "清理后Docker状态:" | ||||||
|  |           docker ps -a | ||||||
|  | 
 | ||||||
|  |       - name: 🚀 Deploy New Version | ||||||
|  |         run: | | ||||||
|  |           echo "拉取最新镜像..." | ||||||
|  |           docker compose -f ${COMPOSE_FILE} pull | ||||||
|  |            | ||||||
|  |           echo "启动新服务..." | ||||||
|  |           docker compose -f ${COMPOSE_FILE} up -d | ||||||
|  |            | ||||||
|  |           echo "=== 服务状态检查 ===" | ||||||
|  |           docker compose -f ${COMPOSE_FILE} ps | ||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -27,7 +27,6 @@ out/ | |||||||
| !**/src/main/**/out/ | !**/src/main/**/out/ | ||||||
| !**/src/test/**/out/ | !**/src/test/**/out/ | ||||||
| gradle.properties | gradle.properties | ||||||
| docker/.env.dev |  | ||||||
| ### NetBeans ### | ### NetBeans ### | ||||||
| /nbproject/private/ | /nbproject/private/ | ||||||
| /nbbuild/ | /nbbuild/ | ||||||
|  | |||||||
| @ -1,3 +0,0 @@ | |||||||
| Docker_REGISTRY_URL=49.235.96.75:5000 |  | ||||||
| SERVER_PASSWORD=L4s6f9y3 |  | ||||||
| SPRING_PROFILES_ACTIVE=prod |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| Docker_REGISTRY_URL=49.235.96.75:5000 |  | ||||||
| SERVER_PASSWORD=L4s6f9y3 |  | ||||||
| SPRING_PROFILES_ACTIVE=test |  | ||||||
| @ -1,25 +1,27 @@ | |||||||
| services: | services: | ||||||
|   llmx-core-database: |   llmx-nacos: | ||||||
|     image: postgres:16-alpine  # 长期支持版本推荐用 16 |     image: nacos/nacos-server:v2.3.2 | ||||||
|     container_name: llmx-core-database |     container_name: llmx-nacos | ||||||
|     restart: always |     restart: always | ||||||
|     ports: |     ports: | ||||||
|       - "5432:9052" |       - "8848:9001" | ||||||
|  |       - "9848:9053" | ||||||
|  |       - "9849:9054" | ||||||
|     networks: |     networks: | ||||||
|       - llmx-net |       - llmx-net-test | ||||||
|     environment: |     environment: | ||||||
|       POSTGRES_DB: llmx_core |       MODE: standalone  # 显式指定为单体模式 | ||||||
|       POSTGRES_USER: llmx |  | ||||||
|       POSTGRES_PASSWORD: L4s6f9y3, |  | ||||||
|     volumes: |     volumes: | ||||||
|       - llmx-core-db-volume:/var/lib/postgresql/data |       - llmx-nacos-volume:/nacos/data | ||||||
|   llmx-core-service: |   llmx-core-service: | ||||||
|     image: ${Docker_REGISTRY_URL}/llmx-core-service |     image: ${Docker_REGISTRY_URL}/llmx-core-service | ||||||
|     container_name: llmx-core-service |     container_name: llmx-core-service | ||||||
|     ports: |     ports: | ||||||
|       - "9002:9002" |       - "9002:9002" | ||||||
|     networks: |     networks: | ||||||
|       - llmx-net |       - llmx-net-test | ||||||
|  |     environment: | ||||||
|  |       SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} | ||||||
|     volumes: |     volumes: | ||||||
|       - llmx-core-service-volume:/app/volume |       - llmx-core-service-volume:/app/volume | ||||||
|     restart: always |     restart: always | ||||||
| @ -29,14 +31,32 @@ services: | |||||||
|     ports: |     ports: | ||||||
|       - "9003:9003" |       - "9003:9003" | ||||||
|     networks: |     networks: | ||||||
|       - llmx-net |       - llmx-net-test | ||||||
|  |     environment: | ||||||
|  |       SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} | ||||||
|     volumes: |     volumes: | ||||||
|       - llmx-impl-baiLian-volume:/app/volume |       - llmx-impl-baiLian-volume:/app/volume | ||||||
|     restart: always |     restart: always | ||||||
|  |   llmx-core-database: | ||||||
|  |     image: postgres:16-alpine  # 长期支持版本推荐用 16 | ||||||
|  |     container_name: llmx-core-database | ||||||
|  |     restart: always | ||||||
|  |     ports: | ||||||
|  |       - "5432:9052" | ||||||
|  |     networks: | ||||||
|  |       - llmx-net-test | ||||||
|  |     environment: | ||||||
|  |       POSTGRES_DB: llmx_core | ||||||
|  |       POSTGRES_USER: llmx | ||||||
|  |       POSTGRES_PASSWORD: L4s6f9y3, | ||||||
|  |     volumes: | ||||||
|  |       - llmx-core-db-volume:/var/lib/postgresql/data | ||||||
|  | 
 | ||||||
| networks: | networks: | ||||||
|   llmx-net-dev: |   llmx-net-test: | ||||||
|     driver: bridge |     driver: bridge | ||||||
| volumes: | volumes: | ||||||
|   llmx-core-service-volume: |   llmx-core-service-volume: | ||||||
|   llmx-impl-baiLian-volume: |   llmx-impl-baiLian-volume: | ||||||
|   llmx-core-db-volume: |   llmx-core-db-volume: | ||||||
|  |   llmx-nacos-volume: | ||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| distributionBase=GRADLE_USER_HOME | distributionBase=GRADLE_USER_HOME | ||||||
| distributionPath=wrapper/dists | distributionPath=wrapper/dists | ||||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip | distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.12-bin.zip | ||||||
| networkTimeout=10000 | networkTimeout=10000 | ||||||
| validateDistributionUrl=true | validateDistributionUrl=true | ||||||
| zipStoreBase=GRADLE_USER_HOME | zipStoreBase=GRADLE_USER_HOME | ||||||
|  | |||||||
| @ -0,0 +1,13 @@ | |||||||
|  | server: | ||||||
|  |   port: 9002 | ||||||
|  | spring: | ||||||
|  |   config: | ||||||
|  |     import: classpath:bootstrap-test.yml | ||||||
|  | llmx: | ||||||
|  |   model-route: | ||||||
|  |     modelServiceMap: | ||||||
|  |       qwen-turbo: llmx-impl-baiLian | ||||||
|  |       qwen-max: llmx-impl-baiLian | ||||||
|  |       qwen-plus: llmx-impl-baiLian | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,10 @@ | |||||||
|  | spring: | ||||||
|  |   cloud: | ||||||
|  |     nacos: | ||||||
|  |       username: nacos | ||||||
|  |       password: L4s6f9y3 | ||||||
|  |       server-addr: 49.235.96.75:9001 | ||||||
|  |       discovery: | ||||||
|  |         server-addr: ${spring.cloud.nacos.server-addr} | ||||||
|  |         username: ${spring.cloud.nacos.username} | ||||||
|  |         password: ${spring.cloud.nacos.password} | ||||||
| @ -47,7 +47,7 @@ class BaiLianModelServiceImpl( | |||||||
|         // 构造输入参数,主要包括用户的prompt |         // 构造输入参数,主要包括用户的prompt | ||||||
|         val inputMap = mutableMapOf("prompt" to request.prompt) |         val inputMap = mutableMapOf("prompt" to request.prompt) | ||||||
|         // 获取会话ID,如果存在,则添加到输入参数中 |         // 获取会话ID,如果存在,则添加到输入参数中 | ||||||
|         val sessionId = (request.options["session_id"] ?: "").toString() |         val sessionId = (request.options["session_id"] ?: "") | ||||||
|         if (StringUtils.hasText(sessionId)) { |         if (StringUtils.hasText(sessionId)) { | ||||||
|             inputMap["session_id"] = sessionId |             inputMap["session_id"] = sessionId | ||||||
|         } |         } | ||||||
| @ -0,0 +1,20 @@ | |||||||
|  | server: | ||||||
|  |   port: 8082 | ||||||
|  | spring: | ||||||
|  |   config: | ||||||
|  |     import: classpath:bootstrap-test.yml | ||||||
|  |   application: | ||||||
|  |     name: llmx-impl-bailian | ||||||
|  | # 阿里云配置 | ||||||
|  | aliyun: | ||||||
|  |   # DashScope服务配置 | ||||||
|  |   dash: | ||||||
|  |     # 访问凭证配置 | ||||||
|  |     scope: | ||||||
|  |       access-key-id: LTAI5tHiA2Ry3XTAfoSEJW6z  # 阿里云访问密钥ID | ||||||
|  |       access-key-secret: K5sf4FxZZuUgLEFnyfepBfMqFGmDcD  # 阿里云访问密钥密钥 | ||||||
|  |       endpoint: bailian.cn-beijing.aliyuncs.com  # 阿里云服务端点 | ||||||
|  |       workspace-id: llm-axfkuqft05uzbjpi  # 工作区ID | ||||||
|  |       api-key: sk-78af4dd964a94f4cb373851064dbdc12  # API密钥 | ||||||
|  |       app-id: 3fae0bbab2e54a90a37aa02cd12dd62c  # 应用ID | ||||||
|  |       base-url: https://dashscope.aliyuncs.com/api/v1/apps/  # 基础API URL | ||||||
| @ -0,0 +1,10 @@ | |||||||
|  | spring: | ||||||
|  |   cloud: | ||||||
|  |     nacos: | ||||||
|  |       username: nacos | ||||||
|  |       password: L4s6f9y3 | ||||||
|  |       server-addr: 49.235.96.75:9001 | ||||||
|  |       discovery: | ||||||
|  |         server-addr: ${spring.cloud.nacos.server-addr} | ||||||
|  |         username: ${spring.cloud.nacos.username} | ||||||
|  |         password: ${spring.cloud.nacos.password} | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user