Compare commits

...

2 Commits

Author SHA1 Message Date
dxin
e37e8dc9f2 1 2025-11-03 09:25:08 +08:00
dxin
e1618828e4 增加apex的流水线配置 2025-11-01 15:04:37 +08:00
2 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
pipeline {
agent any
parameters {
gitParameter(
branchFilter: 'origin/(.*)',
defaultValue: 'main',
name: 'Code_branch',
type: 'PT_BRANCH',
selectedValue: 'DEFAULT',
sortMode: 'NONE',
description: '选择代码分支: ',
quickFilterEnabled: true,
tagFilter: '*',
listSize: "1"
)
}
environment {
REMOTE_HOST = "43.159.145.241" // 远程服务器 {params.REMOTE_HOST}
REMOTE_PROJECT_PATH = "/data/tengine/html/apex_web" // 远程 Python 项目路径
}
stages {
stage('拉取代码') {
steps {
git branch: "${params.Code_branch}", credentialsId: 'fly_gitlab_auth', url: 'http://172.24.16.20/web/apex-platform-fe.git'
}
}
stage('pnpm install') {
steps {
script {
sh """
export PATH="/data/node-v20.15.0/bin:$PATH"
echo "开始安装依赖包"
cd ${WORKSPACE}/ && rm -rf node_modules && pnpm install
echo "依赖包安装完成"
"""
}
}
}
stage('pnpm build') {
steps {
script {
sh """
export PATH="/data/node-v20.15.0/bin:$PATH"
echo "开始构建"
cd ${WORKSPACE}/ && rm -rf dist && pnpm build
mv dist/main/index.html dist/
chmod -R 755 dist/
"""
}
}
}
stage('工程同步') {
steps {
sh """
ssh ${REMOTE_HOST} 'mkdir -p ${REMOTE_PROJECT_PATH}'
rsync -avz ${WORKSPACE}/dist ${REMOTE_HOST}:${REMOTE_PROJECT_PATH}/
"""
}
}
}
post {
success {
echo '✅ 部署成功!'
}
failure {
echo '❌ 部署失败,请检查日志!'
}
}
}

38
nginx/apex_web.conf Normal file
View File

@@ -0,0 +1,38 @@
log_format apex_log '客户端IP: $remote_addr | 用户: $remote_user | 时间: $time_local | '
'请求方法和路径: "$request" | 状态码: $status | 响应大小: $body_bytes_sent | '
'来源页面: "$http_referer" | 客户端UA: "$http_user_agent" | '
'上游服务器: $upstream_addr | 上游响应耗时: $upstream_response_time | '
'请求总耗时: $request_time | Host: $host';
server {
listen 443 ssl;
server_name 127.0.0.1;
ssl_certificate /data/tengine/conf/certificate/apex.deeplink.media_bundle.crt;
ssl_certificate_key /data/tengine/conf/certificate/apex.deeplink.media.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# 单独日志文件
access_log /data/tengine/logs/apex_access.log apex_log;
error_log /data/tengine/logs/apex_error.log;
# 前端静态文件
location / {
root /data/tengine/html/apex_web/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
# 缓存控制,确保 JS 文件不缓存老内容
location ~* \.(js|css|woff2|json|svg)$ {
root /data/tengine/html/apex_web/dist;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
# 错误页面
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /data/tengine/html/apex_web/dist;
}
}