clouddreamai-cicd-setup 1.5.13 → 1.5.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# CloudDreamAI CI/CD Setup
|
|
2
2
|
|
|
3
|
-
🚀 GitLab CI/CD 自动配置工具 - 支持 NestJS/Vue/React 项目的一键 CI/CD 配置
|
|
3
|
+
🚀 云梦智联 GitLab CI/CD 自动配置工具 - 支持 NestJS/Vue/React 项目的一键 CI/CD 配置
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- 📦 **多项目支持** - 支持 NestJS、Vue、React 等多种项目类型
|
|
11
11
|
- 🐳 **Docker 化** - 基于 Docker 的完整部署流程
|
|
12
12
|
- 🌍 **多环境** - 支持开发/生产环境分离或单服务器多环境
|
|
13
|
-
- 📝 **GitLab Registry** -
|
|
13
|
+
- 📝 **GitLab Registry** - 使用 GitLab Container Registry,无需额外配置
|
|
14
14
|
|
|
15
15
|
## 安装使用
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -160,6 +160,8 @@ deploy_dev:
|
|
|
160
160
|
script:
|
|
161
161
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
162
162
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
163
|
+
# 将环境变量文件写入本地,rsync 会同步到服务器
|
|
164
|
+
- echo "$ENV_FILE_CONTENT" > .env
|
|
163
165
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$TEST_SERVER_HOST:$DEPLOY_DIR/
|
|
164
166
|
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
165
167
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
@@ -191,6 +193,8 @@ deploy_prod:
|
|
|
191
193
|
script:
|
|
192
194
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
193
195
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
196
|
+
# 将环境变量文件写入本地,rsync 会同步到服务器
|
|
197
|
+
- echo "$ENV_FILE_CONTENT" > .env
|
|
194
198
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$PROD_SERVER_HOST:$DEPLOY_DIR/
|
|
195
199
|
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
196
200
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
@@ -160,6 +160,8 @@ deploy_dev:
|
|
|
160
160
|
script:
|
|
161
161
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
162
162
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
163
|
+
# 将环境变量文件写入本地,rsync 会同步到服务器
|
|
164
|
+
- echo "$ENV_FILE_CONTENT" > .env
|
|
163
165
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$TEST_SERVER_HOST:$DEPLOY_DIR/
|
|
164
166
|
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
165
167
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
@@ -191,6 +193,8 @@ deploy_prod:
|
|
|
191
193
|
script:
|
|
192
194
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
193
195
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
196
|
+
# 将环境变量文件写入本地,rsync 会同步到服务器
|
|
197
|
+
- echo "$ENV_FILE_CONTENT" > .env
|
|
194
198
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$PROD_SERVER_HOST:$DEPLOY_DIR/
|
|
195
199
|
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
196
200
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
@@ -109,12 +109,7 @@ configure_ssl() {
|
|
|
109
109
|
# 安装 acme.sh(如果没有)
|
|
110
110
|
if [ ! -f ~/.acme.sh/acme.sh ]; then
|
|
111
111
|
echo "安装 acme.sh..."
|
|
112
|
-
|
|
113
|
-
git clone --depth 1 https://gitee.com/neilpang/acme.sh.git /tmp/acme.sh 2>/dev/null || \
|
|
114
|
-
git clone --depth 1 https://github.com/acmesh-official/acme.sh.git /tmp/acme.sh
|
|
115
|
-
cd /tmp/acme.sh && ./acme.sh --install -m $EMAIL
|
|
116
|
-
cd - > /dev/null
|
|
117
|
-
rm -rf /tmp/acme.sh
|
|
112
|
+
curl https://get.acme.sh | sh -s email=$EMAIL
|
|
118
113
|
source ~/.bashrc 2>/dev/null || true
|
|
119
114
|
fi
|
|
120
115
|
|