diff --git a/.gitignore b/.gitignore index 5e0ab77..d5a3311 100644 --- a/.gitignore +++ b/.gitignore @@ -380,3 +380,5 @@ package-lock.json /.template.config/template.json /MyOffice.Shared/appsettings.shared.Development.json /MyOffice.Shared/appsettings.shared.Production.json +/linux_deploy_mybank.bat +/linux_deploy_office.bat diff --git a/linux_deploy.ps1 b/linux_deploy.ps1 deleted file mode 100644 index f9cfbbb..0000000 --- a/linux_deploy.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -$params = @{ - "publish_folder" = "_Published" -}; - -$params_file="params.txt" - -$linux_run1 = "#!/bin/sh" -$linux_run2 = "cd /var/www/MyOffice/" -$linux_run3 = "dotnet MyOffice.Web.dll" -$linux_run4 = "exit" - -function Write2 { - Param ([string[]] $str1) - - Write-Output "-----------------------------------------------" - Write-Output $str1 - Write-Output "-----------------------------------------------" -} - -function ReadParams { - Param ([string] $str1) - - Get-Content -Path $str1| ForEach-Object { - $x = $_.split('='); - $params[$x[0]] = $x[1]; - } -} - -$params_file = if ($args[0] -eq $null) { "params.txt" } else { $args[0] } - -$copy = $args | where { $_ -eq "copy" } -$run = $args | where { $_ -eq "run" } -$file = $args | where { ($_ -ne "copy" -and $_ -ne "run") } - -if ($file) { - $params_file = $file -} -ReadParams($params_file) - -if ((!$copy) -and (!$run)) { - $copy = "copy" - $run = "run" -} - - -$linux_host = $params["linux_user"] + "@" + $params["linux_host"] -$from = $params["publish_folder"] + "\*" -$to = $linux_host + ":" + $params["linux_folder"] - -if ($copy -eq "copy") { - Write2 "Copy files" - scp -r $from $to -} - -if ($run -eq "run") { - Write2 "Run" - # create run script - $run_file = $params["linux_folder"] + "/run.sh""" - $cmd = """printf '#/bin/sh\ncd " + $params["linux_folder"] + "\ndotnet MyOffice.Web.dll\nexit' > " + $run_file - ssh $linux_host $cmd - - # run and wait - ssh $linux_host bash $run_file -} diff --git a/linux_deploy.sh b/linux_deploy.sh new file mode 100644 index 0000000..d6ddf08 --- /dev/null +++ b/linux_deploy.sh @@ -0,0 +1,19 @@ +host=$1 +servicename=$2 +path=$3 + +clear +echo "-= SERVICE STOP =-" +ssh root@$host ''systemctl is-active $servicename'' +ssh root@$host ''systemctl stop $servicename'' +ssh root@$host ''systemctl is-active $servicename'' + +echo "-= COPY FILES =-" +rsync -r --info=progress2 --exclude appsettings*.json _Published/ root@$host:$path +rsync -r --ignore-existing --info=progress2 _Published/appsettings*.json root@$1:$path + +echo "-= SERVICE START =-" +ssh root@$host ''systemctl start $servicename'' + +echo "-= SERVICE STATUS =-" +ssh root@$host ''systemctl status $servicename'' diff --git a/package.json b/package.json deleted file mode 100644 index 1c98d5c..0000000 --- a/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "dependencies": { - "@ngx-loading-bar/router": "^6.0.2", - "angular-feather": "^6.5.0", - "gulp": "^4.0.2", - "ng-apexcharts": "^1.7.4", - "ngx-mask": "^14.2.4", - "ngx-scrollbar": "^11.0.0" - } -} diff --git a/params.txt b/params.txt deleted file mode 100644 index 9257750..0000000 --- a/params.txt +++ /dev/null @@ -1,4 +0,0 @@ -publish_folder=_Published -linux_user=root -linux_host=192.168.1.215 -linux_folder=/var/www/MyOffice \ No newline at end of file diff --git a/params_public.txt b/params_public.txt deleted file mode 100644 index 83598cf..0000000 --- a/params_public.txt +++ /dev/null @@ -1,4 +0,0 @@ -publish_folder=_Published -linux_user=root -linux_host=192.168.1.215 -linux_folder=/var/www/myoffice_public \ No newline at end of file