Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
customer-recall
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tools
customer-recall
Commits
85d670b7
Commit
85d670b7
authored
Aug 12, 2025
by
yiling.shen
Browse files
Options
Browse Files
Download
Plain Diff
完成合并
parents
35b42130
d39b59cc
Pipeline
#3157
passed with stage
in 31 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
.circleci/.gitkeep
+0
-0
.circleci/config.yml
+65
-0
.gitlab-ci.yml
+34
-0
No files found.
.circleci/.gitkeep
0 → 100644
View file @
85d670b7
.circleci/config.yml
0 → 100644
View file @
85d670b7
# 使用 CircleCI 2.1 版本的配置语法
version
:
2.1
# "Jobs" 定义了要执行的具体任务
jobs
:
# 将这个任务命名为 "deploy"
deploy
:
# 指定运行此任务的环境。我们选择一个预装了常用工具(如 git, ssh)的基础 Docker 镜像
docker
:
-
image
:
cimg/base:stable
# "steps" 定义了任务中要按顺序执行的具体步骤
steps
:
# 第一步:添加 SSH 密钥,用于连接你的部署服务器
# CircleCI 会从你的项目设置中,加载你预先存好的那个 SSH 私钥
-
add_ssh_keys
:
fingerprints
:
-
"
SHA256:VsEKAt0iuZUz4zVUWBSmFm1qS/CvL8goIsNDK8zN0VQ"
# 第二步:执行连接服务器并部署的命令
-
run
:
name
:
Connect and Deploy to Server
# 这里的 command 就是您提供的部署脚本
command
:
|
echo "准备连接到部署服务器..."
# 使用 ssh 命令连接你的服务器
# -p $SSH_PORT 指定了你修改后的端口
# -o StrictHostKeyChecking=no 避免了首次连接时需要手动确认主机的提示,这在自动化脚本中是必需的
# $SSH_USER 和 $SSH_HOST 是你需要在 CircleCI 网站上设置的环境变量
ssh -p 19822 -o StrictHostKeyChecking=no root@47.251.104.47 << 'EOF'
# --- 以下是在你的部署服务器上执行的命令 ---
echo "✅ 连接服务器成功,开始执行部署脚本..."
# 1. 进入你的项目工作目录
# 请确保这个目录在服务器上已经存在,并且已经从 GitLab 克隆过一次
echo "进入项目目录: customer-recall"
cd customer-recall
# 2. 从 master 分支拉取最新的代码
echo "正在从 GitLab (origin) 拉取最新代码..."
git pull origin master
# 3. 使用 Docker Compose 重新构建并启动服务
echo "正在使用 Docker Compose 部署..."
docker compose up -d --build
echo "🚀 部署流程执行完毕!"
# --- 远程服务器上的命令结束 ---
EOF
# "Workflows" 用来编排和组织 Jobs 的执行流程和触发条件
workflows
:
# 将这个工作流命名为 "build-and-deploy"
build-and-deploy
:
jobs
:
-
deploy
:
# "filters" 是过滤器,用来定义触发此 Job 的条件
filters
:
branches
:
# "only" 表示只有当代码被推送到指定分支时,才执行这个 Job
only
:
-
master
.gitlab-ci.yml
0 → 100644
View file @
85d670b7
# .gitlab-ci.yml
deploy_to_production
:
stage
:
deploy
image
:
alpine:latest
# --- 在这里添加 tags 部分 ---
tags
:
-
jarvis
# 指定使用带有 "jarvis" 标签的 Runner
# ---------------------------
# before_script, script, only 这些部分保持不变
before_script
:
-
'
which
ssh-agent
||
(
apk
add
--update
--no-cache
openssh-client
)'
-
eval $(ssh-agent -s)
-
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
script
:
-
|
ssh -p $SSH_PORT $SSH_USER@$SSH_HOST "
echo '✅ 连接服务器成功,开始执行部署脚本...'
cd customer-recall
git pull origin master
docker compose up -d --build
echo '🚀 部署流程执行完毕!'
"
only
:
-
master
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment