代码拉取完成,页面将自动刷新
同步操作将从 zuohuaijun/Admin.NET 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
cd /etc/supervisor/conf.d
touch smart_prison_core.conf
#配置程序名称
[program:DotnetSmartPrison]
#运行程序的命令
command=dotnet Dilon.Web.Entry.dll --urls="http://*:5000"
#命令执行的目录
directory=/wwwroot/smart_prison_core
#错误日志文件
stderr_logfile=/var/log/smart_prison.err.log
#输出日志文件
stdout_logfile=/var/log/smart_prison.out.log
#进程环境变量
environment=ASPNETCORE_ENVIRONMENT=Production
#进程执行的用户身份
user=root
#程序是否自启动
autostart=true
#程序意外退出是否自动重启
autorestart=true
#启动时间间隔(秒)
startsecs=5
stopsignal=INT
supervisorctl shutdown
cd ..
supervisor reload -c ./supervisord.conf
cd /etc/nginx/conf.d
touch smart_prison_core.conf
server {
listen 8001;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
touch smart_prison_vue.conf
server{
listen 9001;
location / {
root /wwwroot/smart_prison_vue;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5000;
}
location /hubs/ {
proxy_pass http://127.0.0.1:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_read_timeout 600s;#设置websocket超时时间
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
nginx -s reload
编辑 build-vue.ps1, 需要修改你服务器的地址
# 定义服务器地址
$remoteIp = "81.70.44.26"
其他根据自己的东西修改对应的变量
# supervisor 服务名称, 这个对应上边 smart_prison_core.conf 里的名称
$supervisorServername = "DotnetSmartPrison"
# 定义路径
$buildFolder = (Get-Item -Path "./" -Verbose).FullName
$coreFolder = Join-Path $buildFolder "../backend"
$vueFolder = Join-Path $buildFolder "../frontend"
$outputFolder = Join-Path $buildFolder "../outputs"
右击 build-vue.ps1 文件, 点击使用 powershell 运行
完整文件
# 定义服务器地址
$remoteIp = "81.70.44.26"
# 定义路径
$buildFolder = (Get-Item -Path "./" -Verbose).FullName
$vueFolder = Join-Path $buildFolder "../frontend"
$outputFolder = Join-Path $buildFolder "../outputs"
## 清空本地历史
Remove-Item $outputFolder -Force -Recurse -ErrorAction Ignore
New-Item -Path $outputFolder -ItemType Directory
## 发布前端
### 还原&打包
Set-Location $vueFolder
yarn
yarn build
### 推送到服务器
Set-Location $outputFolder
ssh root@$remoteIp "rm -rf /wwwroot/smart_prison_vue; exit"
scp -r (Join-Path $outputFolder "smart_prison_vue") root@$remoteIp:/wwwroot
build-core.ps1
修改 supervisor 服务名称, 这个对应上边 smart_prison_core.conf 里的名称
# supervisor 服务名称, 这个对应上边 smart_prison_core.conf 里的名称
$supervisorServername = "DotnetSmartPrison"
完整文件
# 定义服务器地址
$remoteIp = "81.70.44.26"
# supervisor 服务名称
$supervisorServername = "DotnetSmartPrison"
# 定义路径
$buildFolder = (Get-Item -Path "./" -Verbose).FullName
$coreFolder = Join-Path $buildFolder "../backend"
$outputFolder = Join-Path $buildFolder "../outputs"
## 清空本地历史
Remove-Item $outputFolder -Force -Recurse -ErrorAction Ignore
New-Item -Path $outputFolder -ItemType Directory
## 发布后端
### 还原&打包
Set-Location $coreFolder
dotnet restore
dotnet publish --no-restore --output (Join-Path $outputFolder "smart_prison_core") --configuration Release
### 推送到服务器
Set-Location $outputFolder
ssh root@$remoteIp "rm -rf /wwwroot/smart_prison_core; exit"
scp -r (Join-Path $outputFolder "smart_prison_core") root@$remoteIp:/wwwroot
### dotnet 命令运行
# ssh root@$remoteIp "cd /wwwroot/smart_prison_core; dotnet Dilon.Web.Entry.dll --urls http://*:5000; exit"
### 如果是用 supervisor 守护进程的需要使用
ssh root@$remoteIp "sudo supervisorctl restart $supervisorServername; exit"
build-all.ps1
完整文件
# 定义服务器地址
$remoteIp = "81.70.44.26"
# supervisor 服务名称
$supervisorServername = "DotnetSmartPrison"
# 定义路径
$buildFolder = (Get-Item -Path "./" -Verbose).FullName
$coreFolder = Join-Path $buildFolder "../backend"
$vueFolder = Join-Path $buildFolder "../frontend"
$outputFolder = Join-Path $buildFolder "../outputs"
## 清空本地历史
Remove-Item $outputFolder -Force -Recurse -ErrorAction Ignore
New-Item -Path $outputFolder -ItemType Directory
## 发布前端
### 还原&打包
Set-Location $vueFolder
yarn
yarn build
### 推送到服务器
Set-Location $outputFolder
ssh root@$remoteIp "rm -rf /wwwroot/smart_prison_vue; exit"
scp -r (Join-Path $outputFolder "smart_prison_vue") root@$remoteIp:/wwwroot
## 发布后端
### 还原&打包
Set-Location $coreFolder
dotnet restore
dotnet publish --no-restore --output (Join-Path $outputFolder "smart_prison_core") --configuration Release
### 推送到服务器
Set-Location $outputFolder
ssh root@$remoteIp "rm -rf /wwwroot/smart_prison_core; exit"
scp -r (Join-Path $outputFolder "smart_prison_core") root@$remoteIp:/wwwroot
### dotnet 命令运行
# ssh root@$remoteIp "cd /wwwroot/smart_prison_core; dotnet Dilon.Web.Entry.dll --urls http://*:5000; exit"
### 如果是用 supervisor 守护进程的需要使用
ssh root@$remoteIp "sudo supervisorctl restart $supervisorServername; exit"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。