From 7ba107a82eba8d1606cf905715e65bd5bffcbf8a Mon Sep 17 00:00:00 2001 From: zze Date: Fri, 27 Oct 2023 15:58:32 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 35 +++++++++++++++++++++- hack/config.yaml | 1 + internal/logic/ci_pipeline/client/Makefile | 6 ++-- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/README.MD b/README.MD index 65670c8..30ccbd7 100644 --- a/README.MD +++ b/README.MD @@ -70,4 +70,37 @@ mysql ## 前端项目 -本仓库是后端项目,对应前端项目地址为:。 \ No newline at end of file +本仓库是后端项目,对应前端项目地址为:。 + +## 快速部署 + +1、在 MySQL 中执行 `manifest/db/devops_super.sql` 创建好数据库以及初始化数据; + +2、从 [releases](https://github.com/zze326/devops-super/releases) 获取到要部署的镜像版本,以 [v1.0](https://github.com/zze326/devops-super/releases/tag/v1.0) 为例:主程序 Docker 镜像为 `registry.cn-shenzhen.aliyuncs.com/zze/devops-super:202310271518`; + +3、运行容器,看如下实例: +```bash +docker run -d --name devops-super \ + -v/opt/devops-super/host-sessions:/app/host-sessions \ + -eSERVER_PORT=8001 \ + -eDB_HOST=127.0.0.1 \ + -eDB_PORT=3306 \ + -eDB_NAME=devops_super \ + -eDB_USER=zze \ + -eDB_PWD=zze.admin \ + -eJWT_SECRET=vIIEngfamdsaGZasdsasdasadkseadgF9fe \ + --network host registry.cn-shenzhen.aliyuncs.com/zze/devops-super:202310271518 +``` +> 环境变量说明: +> - `DB_HOST`:MySQL 主机地址; +> - `DB_PORT`:MySQL 端口; +> - `DB_NAME`:数据库名称; +> - `DB_USER`:连接数据库使用的用户; +> - `DB_PWD`:连接数据库的用户密码; +> - `JWT_SECRET`:JWT 秘钥,随机生成即可; +> - `SERVER_PORT`:服务监听端口; +> +> 参数说明(按需使用): +> - `-d`:后台运行容器; +> - `--name`:指定容器名称; +> - `--network host`:容器共用宿主机网络空间; \ No newline at end of file diff --git a/hack/config.yaml b/hack/config.yaml index 955c6b8..2ea9088 100644 --- a/hack/config.yaml +++ b/hack/config.yaml @@ -6,6 +6,7 @@ gfcli: tagPrefixes: # - registry-azj-registry.cn-shanghai.cr.aliyuncs.com/ops/ - zze326/ + - registry.cn-shenzhen.aliyuncs.com/zze/ gen: dao: - link: "mysql:devops_super:devops_super.zze@tcp(192.168.2.231:3306)/devops_super?loc=Local&parseTime=true" diff --git a/internal/logic/ci_pipeline/client/Makefile b/internal/logic/ci_pipeline/client/Makefile index a46d9b5..ee92892 100644 --- a/internal/logic/ci_pipeline/client/Makefile +++ b/internal/logic/ci_pipeline/client/Makefile @@ -1,5 +1,7 @@ +DATE := $(shell date '+%Y%m%d%H%M') + image.push: rm -f devops-super-cli && go env -w 'GOPROXY=https://goproxy.cn,direct' && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o devops-super-cli - docker build --platform linux/amd64 -t registry.cn-shenzhen.aliyuncs.com/zze/devops-super-ci-client:tmp . - docker push registry.cn-shenzhen.aliyuncs.com/zze/devops-super-ci-client:tmp + docker build --platform linux/amd64 -t registry.cn-shenzhen.aliyuncs.com/zze/devops-super-ci-client:$(DATE) . + docker push registry.cn-shenzhen.aliyuncs.com/zze/devops-super-ci-client:$(DATE) rm -f devops-super-cli \ No newline at end of file