docs: update deploy

This commit is contained in:
yubaolee
2025-04-24 14:29:56 +08:00
parent 59a099b607
commit 9653778c77
2 changed files with 77 additions and 8 deletions

View File

@@ -38,17 +38,30 @@ source /etc/profile
![2025-04-24-00-21-09](http://img.openauth.net.cn/2025-04-24-00-21-09.png)
* 发布完成后可以在输出目录看到发布详情(红色框内即为发布的文件夹)
* 发布完成后可以在输出目录看到发布详情:
![说明](http://pj.openauth.net.cn/zentao/file-read-69.png "说明")
![2025-04-24-14-15-58](http://img.openauth.net.cn/2025-04-24-14-15-58.png)
## 部署OpenAuth.Mvc
## 部署&启动
将发布后的文件拷贝到服务器文件夹。直接使用`dotnet openauth.mvc.dll` 命令启动。启动成功后使用浏览器打开http://localhost:1802 即可访问,如下图所示:
如果是windows系统可以直接运行`OpenAuth.Mvc.exe`启动。
如果是linux系统将发布后的文件拷贝到服务器文件夹。直接使用`dotnet openauth.mvc.dll` 命令启动。
启动成功后使用浏览器打开[http://localhost:1802](http://localhost:1802) 即可访问,如下图所示:
![2025-04-24-00-32-42](http://img.openauth.net.cn/2025-04-24-00-32-42.png)
## jenkins部署OpenAuth.Mvc
## docker部署
框架自带的dockerfile文件会同时生成webapi、mvc、identity三个项目可以根据需要调整后使用。使用方式如下
```shell
# 构建镜像
docker build -f Dockerfile -t openauthapi-img .
# 运行容器
docker run --network="host" -d -p 52789:52789 -p 1802:1802 -p 12796:12796 openauthapi-img
```
## jenkins无容器部署
OpenAuth.Net采用的是gitee托管源码只需使用Gitee WebHook构建触发器。配置如下
@@ -78,5 +91,27 @@ nohup dotnet /data/openauthmvc/OpenAuth.Mvc.dll &
echo '============================end build======================================='
```
## jenkins容器部署
如果需要jenkins配合自动部署启动可以将上面的shell调整如下
```shell
# 停止并删除所有与 openauthapi-img 镜像相关的容器
docker ps -a --filter "ancestor=openauthapi-img" --format "{{.ID}}" | xargs -r docker stop
# 删除所有与 openauthapi-img 镜像相关的容器
docker ps -a --filter "ancestor=openauthapi-img" --format "{{.ID}}" | xargs -r docker rm
#docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
cd /var/lib/jenkins/workspace/openauth.webapi
# 构建镜像
docker build -f Dockerfile -t openauthapi-img .
# 运行容器
docker run --network="host" -d -p 52789:52789 -p 1802:1802 -p 12796:12796 openauthapi-img
```

View File

@@ -41,14 +41,26 @@ source /etc/profile
![20220101235436](http://img.openauth.net.cn/20220101235436.png)
## 部署OpenAuth.WebApi
## 部署&启动
将发布后的文件拷贝到服务器文件夹。直接使用`dotnet OpenAuth.WebApi.dll` 命令启动。启动成功后使用浏览器打开[http://localhost:52789/swagger/index.html](http://localhost:52789/swagger/index.html) 即可访问,如下图所示:
如果是windows系统可以直接运行`OpenAuth.Mvc.exe`启动。
如果是linux系统将发布后的文件拷贝到服务器文件夹。直接使用`dotnet OpenAuth.WebApi.dll` 命令启动。
启动成功后使用浏览器打开[http://localhost:52789/swagger/index.html](http://localhost:52789/swagger/index.html) 即可访问,如下图所示:
![20220101233542](http://img.openauth.net.cn/20220101233542.png)
## docker部署
## jenkins部署OpenAuth.WebApi
框架自带的dockerfile文件会同时生成webapi、mvc、identity三个项目可以根据需要调整后使用。使用方式如下
```shell
# 构建镜像
docker build -f Dockerfile -t openauthapi-img .
# 运行容器
docker run --network="host" -d -p 52789:52789 -p 1802:1802 -p 12796:12796 openauthapi-img
```
## jenkins无容器部署
OpenAuth.Net采用的是gitee托管源码只需使用Gitee WebHook构建触发器。配置如下
@@ -88,4 +100,26 @@ nohup dotnet /data/openauthapi/OpenAuth.WebApi.dll &
echo '============================end build======================================='
```
## jenkins容器部署
如果需要jenkins配合自动部署启动可以将上面的shell调整如下
```shell
# 停止并删除所有与 openauthapi-img 镜像相关的容器
docker ps -a --filter "ancestor=openauthapi-img" --format "{{.ID}}" | xargs -r docker stop
# 删除所有与 openauthapi-img 镜像相关的容器
docker ps -a --filter "ancestor=openauthapi-img" --format "{{.ID}}" | xargs -r docker rm
#docker rmi $(docker images | grep "^<none>" | awk "{print $3}")
cd /var/lib/jenkins/workspace/openauth.webapi
# 构建镜像
docker build -f Dockerfile -t openauthapi-img .
# 运行容器
docker run --network="host" -d -p 52789:52789 -p 1802:1802 -p 12796:12796 openauthapi-img
```