refactoring build script

This commit is contained in:
Alexey Bannov 2021-11-15 19:36:09 +03:00
parent 678b9ae147
commit d235288370
10 changed files with 88 additions and 24 deletions

View File

@ -1,6 +1,7 @@
@echo off
PUSHD %~dp0.. PUSHD %~dp0..
dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
@echo off
echo. echo.
echo Install nodejs projects dependencies... echo Install nodejs projects dependencies...
echo. echo.
@ -15,6 +16,8 @@ if %errorlevel% == 0 (
echo. echo.
POPD
if "%1"=="nopause" goto start if "%1"=="nopause" goto start
pause pause
:start :start

View File

@ -1,18 +1,27 @@
@echo off
echo "##########################################################"
echo "######### Start build and deploy #######################"
echo "##########################################################"
echo.
PUSHD %~dp0 PUSHD %~dp0
call runasadmin.bat "%~dpnx0" call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 ( if %errorlevel% == 0 (
call start\stop.bat call start\stop.bat nopause
PUSHD %~dp0..
echo "FRONT-END (for start run command 'yarn start' inside the root folder)" echo "FRONT-END (for start run command 'yarn start' inside the root folder)"
call build\build.frontend.bat call build.frontend.bat nopause
echo "BACK-END" echo "BACK-END"
call build\build.backend.bat call build.backend.bat nopause
start /b call build\start\start.bat call start\start.bat nopause
echo.
pause pause
) )

View File

@ -48,15 +48,24 @@ powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-studio.conf
REM restart nginx REM restart nginx
echo service nginx stop echo service nginx stop
call sc stop nginx call sc stop nginx > nul
REM sleep 5 seconds REM sleep 5 seconds
call ping 127.0.0.1 -n 6 > nul call ping 127.0.0.1 -n 6 > nul
echo service nginx start echo service nginx start
call sc start nginx call sc start nginx > nul
if NOT %errorlevel% == 0 (
echo Couldn't restarte Onlyoffice%%~nf service
) )
)
echo.
POPD
if "%1"=="nopause" goto start if "%1"=="nopause" goto start
pause pause
:start :start

View File

@ -1,3 +1,9 @@
echo "##########################################################"
echo "######### Start build and deploy Personal ##############"
echo "##########################################################"
echo.
PUSHD %~dp0 PUSHD %~dp0
call runasadmin.bat "%~dpnx0" call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 ( if %errorlevel% == 0 (

View File

@ -1,5 +1,11 @@
@echo off @echo off
PUSHD %~dp0
echo "##########################################################"
echo "######### Start build and deploy #######################"
echo "##########################################################"
echo.
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
call runasadmin.bat "%~dpnx0" call runasadmin.bat "%~dpnx0"
@ -8,15 +14,15 @@ if %errorlevel% == 0 (
call start\stop.bat nopause call start\stop.bat nopause
PUSHD %~dp0..
echo "FRONT-END static" echo "FRONT-END static"
call build\build.static.bat nopause call build.static.bat nopause
echo "BACK-END" echo "BACK-END"
call build\build.backend.bat nopause call build.backend.bat nopause
call build\start\start.bat nopause call start\start.bat nopause
echo.
pause pause
) )

View File

@ -23,6 +23,5 @@ if '%errorlevel%' NEQ '0' (
exit /B 1 exit /B 1
:gotAdmin :gotAdmin
pushd "%CD%"
CD /D "%~dp0" CD /D "%~dp0"
:-------------------------------------- :--------------------------------------

View File

@ -5,11 +5,19 @@ call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 ( if %errorlevel% == 0 (
for /R "run\" %%f in (*.bat) do ( for /R "run\" %%f in (*.bat) do (
call sc stop "Onlyoffice%%~nf" call sc stop "Onlyoffice%%~nf" > nul
call sc start "Onlyoffice%%~nf" call sc start "Onlyoffice%%~nf" > nul
if %errorlevel% == 0 (
echo Onlyoffice%%~nf service has been restarted
) else (
echo Couldn't restarte Onlyoffice%%~nf service
)
) )
) )
POPD
echo. echo.
if "%1"=="nopause" goto start if "%1"=="nopause" goto start

View File

@ -3,11 +3,8 @@
PUSHD %~dp0.. PUSHD %~dp0..
call runasadmin.bat "%~dpnx0" call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 ( POPD
for /R "run\" %%f in (*.bat) do ( powershell %~dp0/start.ps1
call sc start "Onlyoffice%%~nf"
)
)
echo. echo.

19
build/start/start.ps1 Normal file
View File

@ -0,0 +1,19 @@
$WorkDir = "$(Split-Path -Parent $PSScriptRoot)\run"
workflow StartServices-Runbook
{
param(
[string]$WorkDir
)
foreach -parallel($s in Get-ChildItem -Path $WorkDir | ForEach-Object -Process {[System.IO.Path]::GetFileNameWithoutExtension($_)}) {
Start-Service -InputObject $(Get-Service -Name "Onlyoffice$s")
Write-Output "Onlyoffice$s service has been started"
}
}
#Write-Output "Starting services at time: $(Get-Date -Format HH:mm:ss)"
#Write-Output ""
StartServices-Runbook $WorkDir
#Write-Output ""
#Write-Output "End start services at time: $(Get-Date -Format HH:mm:ss)"

View File

@ -5,12 +5,20 @@ call runasadmin.bat "%~dpnx0"
if %errorlevel% == 0 ( if %errorlevel% == 0 (
for /R "run\" %%f in (*.bat) do ( for /R "run\" %%f in (*.bat) do (
call sc stop "Onlyoffice%%~nf" call sc stop "Onlyoffice%%~nf" > nul
if %errorlevel% == 0 (
echo Onlyoffice%%~nf service has been stopped
) else (
echo Couldn't stop Onlyoffice%%~nf service
)
) )
) )
echo. echo.
POPD
if "%1"=="nopause" goto start if "%1"=="nopause" goto start
pause pause
:start :start