同步
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
bash -c '
|
||||
set -e
|
||||
|
||||
echo "[1] 准备目录"
|
||||
mkdir -p /data/webapps/yunxiao_download
|
||||
mkdir -p /data/webapps/test_influencer_search_agent/log
|
||||
|
||||
echo "[2] 杀掉进程"
|
||||
sh /data/sh/kill_influencer_search_agent.sh
|
||||
|
||||
echo "[3] 解压"
|
||||
tar zxvf /data/webapps/yunxiao_download/influencer-search-agent.tgz -C /data/webapps/test_influencer_search_agent/
|
||||
|
||||
echo "[4] 激活 Conda 环境"
|
||||
cd /data/webapps/test_influencer_search_agent/
|
||||
source ~/.bashrc
|
||||
conda activate search
|
||||
echo "当前路径: $(pwd)"
|
||||
echo "当前Python路径: $(which python)"
|
||||
echo "当前Python版本: $(python --version)"
|
||||
|
||||
echo "[5] 安装依赖"
|
||||
pip install -r requirements.txt
|
||||
echo "依赖检查结束"
|
||||
|
||||
echo "[6] 启动进程"
|
||||
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
|
||||
nohup env PYTHONPATH=/data/webapps/test_influencer_search_agent APP_ENV=im python -m dialogue.influencer_search > /data/webapps/test_influencer_search_agent/log/influencer-search_${TIMESTAMP}.log 2>&1 &
|
||||
|
||||
echo "[7] 检查进程是否启动..."
|
||||
sleep 3
|
||||
ps aux | grep -v grep | grep "dialogue.influencer_search"
|
||||
'
|
||||
@@ -1,27 +0,0 @@
|
||||
bash -c '
|
||||
set -e
|
||||
|
||||
echo "[1] 进入项目目录"
|
||||
cd /data/webapps/fly-moon-agent/
|
||||
echo "当前路径: $(pwd)"
|
||||
echo "当前路径内容: $(ls -lh)"
|
||||
|
||||
echo "[2] 杀掉进程"
|
||||
sh /data/sh/kill_fly_moon_jenniefy.sh
|
||||
|
||||
echo "[3] 解压到目标为止"
|
||||
tar zxvf ./tmp/package.tgz -C ./tmp
|
||||
cp ./tmp/flymoon-agent/target/flymoon-agent.jar ./
|
||||
cp ./tmp/flymoon-common/target/flymoon-common.jar ./
|
||||
cp ./tmp/flymoon-framework/target/flymoon-framework.jar ./
|
||||
cp ./tmp/flymoon-system/target/flymoon-system.jar ./
|
||||
echo "当前路径内容: $(ls -lh)"
|
||||
|
||||
echo "[4] 启动jar包"
|
||||
cd ~
|
||||
nohup /data/jdk1.8.0_181/bin/java -jar /data/webapps/fly-moon-agent/flymoon-agent.jar --spring.profiles.active=test > /data/webapps/fly-moon-agent/nohup.out 2>&1 &
|
||||
|
||||
echo "[5] 进程详情:"
|
||||
sleep 3
|
||||
ps aux | grep -v grep | grep "flymoon-agent.jar"
|
||||
'
|
||||
@@ -1,29 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('拉取镜像') {
|
||||
steps {
|
||||
// 登录镜像仓库
|
||||
withCredentials([usernamePassword(credentialsId: 'dxin_img_hub_auth', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh '''
|
||||
echo "$REGISTRY_PWD" | docker login ${REGISTRY} -u ${REGISTRY_USER} --password-stdin
|
||||
'''
|
||||
}
|
||||
// 拉取镜像
|
||||
sh "docker pull uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:${IMAGE_TAG}"
|
||||
}
|
||||
}
|
||||
stage('展示镜像Label信息') {
|
||||
steps {
|
||||
sh "docker inspect --format='{{json .Config.Labels}}' uswccr.ccs.tencentyun.com/lessie.s2/lessie-sourcing-agents:${IMAGE_TAG}"
|
||||
}
|
||||
}
|
||||
stage('部署镜像') {
|
||||
steps {
|
||||
// 这里可以添加具体的部署逻辑,例如使用docker-compose或kubectl进行部署
|
||||
echo "这是部署步骤"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
REGISTRY = "uswccr.ccs.tencentyun.com" // 镜像仓库地址
|
||||
NAMESPACE = "lessietest" // 命名空间
|
||||
IMAGE_NAME = "lessie-sourcing-agents" // 镜像名(固定前缀)
|
||||
CREDENTIALS_ID = "dxin_img_hub_auth" // 容器仓库凭证ID
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('拉取代码') {
|
||||
steps {
|
||||
// 拉取指定分支代码(通过参数 params.Code_branch 动态指定)
|
||||
git branch: "${params.Code_branch}",
|
||||
credentialsId: 'fly_gitlab_auth',
|
||||
url: 'http://106.53.194.199/python/lessie-sourcing-agents.git'
|
||||
}
|
||||
}
|
||||
|
||||
stage('获取提交信息') {
|
||||
steps {
|
||||
script {
|
||||
// 获取最近一次提交的哈希值(短格式,前8位)
|
||||
env.GIT_COMMIT_SHORT = sh(
|
||||
script: 'git rev-parse --short HEAD',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
// 获取最近一次提交的作者
|
||||
env.GIT_AUTHOR = sh(
|
||||
script: 'git log -1 --pretty=format:%an',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
// 获取最近一次提交的时间(格式化)
|
||||
env.GIT_COMMIT_TIME = sh(
|
||||
script: 'git log -1 --pretty=format:%ct | xargs -I {} date -d @{} +%Y%m%d-%H%M%S',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
// 获取最近一次提交的备注信息(转义特殊字符,避免构建失败)
|
||||
env.GIT_COMMIT_MSG = sh(
|
||||
script: 'git log -1 --pretty=format:%s', // 转义双引号
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
||||
// 生成唯一 Tag:时间戳 + 短哈希(确保唯一性)
|
||||
env.IMAGE_TAG = "${GIT_COMMIT_TIME}-${GIT_COMMIT_SHORT}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('登录容器仓库') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: env.CREDENTIALS_ID,
|
||||
usernameVariable: 'REGISTRY_USER',
|
||||
passwordVariable: 'REGISTRY_PWD'
|
||||
)]) {
|
||||
sh '''
|
||||
echo "$REGISTRY_PWD" | docker login ${REGISTRY} -u ${REGISTRY_USER} --password-stdin
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('构建容器镜像') {
|
||||
steps {
|
||||
script {
|
||||
// 构建镜像,添加标签信息
|
||||
sh """
|
||||
docker build -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} \
|
||||
--label "git-branch='${params.Code_branch}'" \
|
||||
--label "git-commit='${GIT_COMMIT_SHORT}'" \
|
||||
--label "git-author='${GIT_AUTHOR}'" \
|
||||
--label "git-message='${GIT_COMMIT_MSG}'" \
|
||||
--label "build-time='${GIT_COMMIT_TIME}'" \
|
||||
.
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('推送镜像到仓库') {
|
||||
steps {
|
||||
script {
|
||||
// 推送主镜像(带唯一 Tag)
|
||||
sh "docker push ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
|
||||
// 推送 latest 标签(修正路径,包含命名空间)
|
||||
sh "docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG} ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
sh "docker push ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
|
||||
// 登出仓库
|
||||
sh "docker logout ${REGISTRY}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// 无论成败都登出,清理凭证
|
||||
sh "docker logout ${REGISTRY}"
|
||||
echo "容器仓库已登出,本地凭证已清理"
|
||||
|
||||
// 清理工作(可选,避免节点磁盘占用过高)
|
||||
//sh "docker system prune -f"
|
||||
}
|
||||
success {
|
||||
// 输出构建结果
|
||||
echo "镜像构建成功!"
|
||||
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
|
||||
echo "latest 标签地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest"
|
||||
echo "对应代码提交:${GIT_COMMIT_SHORT}(${GIT_COMMIT_MSG})"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,11 @@ upstream new_official_backend {
|
||||
server 10.0.0.15:3003;
|
||||
}
|
||||
|
||||
upstream java_agent_usercase {
|
||||
server 10.0.0.10:8070 weight=10 max_fails=3 fail_timeout=30s;
|
||||
server 10.0.0.8:8070 weight=10 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
log_format official_log '$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $body_bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
@@ -201,6 +206,56 @@ server {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 前端请求java usercase 1
|
||||
location /prod-api/agent/ {
|
||||
proxy_pass http://java_agent_usercase;
|
||||
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_intercept_errors off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_set_header Connection keep-alive;
|
||||
|
||||
client_max_body_size 300M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
add_header 'X-Content-Type-Options' 'nosniff' always;
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 前端请求java usercase 2
|
||||
location /prod-api/system/ {
|
||||
proxy_pass http://java_agent_usercase;
|
||||
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_intercept_errors off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_set_header Connection keep-alive;
|
||||
|
||||
client_max_body_size 300M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
add_header 'X-Content-Type-Options' 'nosniff' always;
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +275,12 @@ upstream new_official_backend {
|
||||
server 10.0.0.15:3003;
|
||||
}
|
||||
|
||||
upstream java_agent_usercase {
|
||||
server 10.0.0.10:8070 weight=10 max_fails=3 fail_timeout=30s;
|
||||
server 10.0.0.8:8070 weight=10 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
|
||||
log_format official_log '$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $body_bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
@@ -370,6 +431,56 @@ server {
|
||||
}
|
||||
}
|
||||
|
||||
# 前端请求java usercase 1
|
||||
location /prod-api/agent/ {
|
||||
proxy_pass http://java_agent_usercase;
|
||||
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_intercept_errors off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_set_header Connection keep-alive;
|
||||
|
||||
client_max_body_size 300M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
add_header 'X-Content-Type-Options' 'nosniff' always;
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 前端请求java usercase 2
|
||||
location /prod-api/system/ {
|
||||
proxy_pass http://java_agent_usercase;
|
||||
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_intercept_errors off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_set_header Connection keep-alive;
|
||||
|
||||
client_max_body_size 300M;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'true' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,X-Requested-With,Accept,Origin' always;
|
||||
add_header 'X-Content-Type-Options' 'nosniff' always;
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
# 第三方邮件SendGrid平台调用
|
||||
location /prod-api/webhook/us {
|
||||
proxy_pass http://10.0.0.10:4997/webhook/us;
|
||||
|
||||
Reference in New Issue
Block a user