build(init): 增加 CentOS 服务脚本以及初始化 init.sh 命令

This commit is contained in:
Argo Zhang 2019-10-03 23:14:53 +08:00
parent 067972d648
commit 100478d3a2
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
5 changed files with 71 additions and 0 deletions

View File

@ -112,6 +112,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci", "ci", "{5F732D4E-133B-
appveyor.yml = appveyor.yml appveyor.yml = appveyor.yml
EndProjectSection EndProjectSection
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "service", "service", "{68F7C160-3FB2-4129-8F89-96F78B2DA0A9}"
ProjectSection(SolutionItems) = preProject
scripts\ba.admin.service = scripts\ba.admin.service
scripts\ba.client.service = scripts\ba.client.service
init.sh = init.sh
scripts\nginx.service = scripts\nginx.service
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -168,6 +176,7 @@ Global
{C6F2DCA0-7941-4C28-9328-2D495F5DCB00} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4} {C6F2DCA0-7941-4C28-9328-2D495F5DCB00} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4}
{FDCFC3E3-14CF-40B2-9FE5-5BC239AAC110} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4} {FDCFC3E3-14CF-40B2-9FE5-5BC239AAC110} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4}
{5F732D4E-133B-4DA6-811B-C369CDC3FB89} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4} {5F732D4E-133B-4DA6-811B-C369CDC3FB89} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4}
{68F7C160-3FB2-4129-8F89-96F78B2DA0A9} = {72C103DB-E1D3-449F-97C2-DF12CA111FD4}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC} SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC}

16
init.sh Normal file
View File

@ -0,0 +1,16 @@
#! /bin/bash
mkdir /usr/local/ba
mkdir /usr/local/ba/admin
mkdir /usr/local/ba/client
cd ~/
git clone https://gitee.com/LongbowEnterprise/BootstrapAdmin.git
cp ~/BootstrapAdmin/src/admin/Bootstrap.Admin/appsettings.json /usr/local/admin
cp ~/BootstrapAdmin/src/client/Bootstrap.Client/appsettings.json /usr/local/client
cp * /usr/lib/systemd/system/
systemctl enable ba.admin
systemctl enable ba.client
systemctl enable nginx

15
scripts/ba.admin.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Bootstrap Admin Application
[Service]
Type=simple
WorkingDirectory=/usr/local/ba/admin
Environment=ASPNETCORE_ENVIRONMENT=Production
ExecStart=/usr/bin/dotnet Bootstrap.Admin.dll --urls http://localhost:50852
ExecStop=/bin/kill -2 $MAINPID
KillMode=process
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=multi-user.target

15
scripts/ba.client.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Bootstrap Client Application
[Service]
Type=simple
WorkingDirectory=/usr/local/ba/client
Environment=ASPNETCORE_ENVIRONMENT=Production
ExecStart=/usr/bin/dotnet Bootstrap.Client.dll --urls http://localhost:49185
ExecStop=/bin/kill -2 $MAINPID
KillMode=process
Restart=on-failure
RestartSec=1s
[Install]
WantedBy=multi-user.target

16
scripts/nginx.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target