forked from thepirat000/spleeter-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.ps1
More file actions
155 lines (128 loc) · 6.64 KB
/
Copy pathSetup.ps1
File metadata and controls
155 lines (128 loc) · 6.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force;
param(
[Parameter()][String]$type="",
[Parameter()][String]$iis=""
)
Set-ExecutionPolicy Bypass -Scope Process -Force;
if (!$type) {
$type = Read-Host -Prompt 'Enter the installation type (cpu/gpu)';
}
if ($type -ne "cpu" -and $type -ne "gpu") {
return;
}
if (!$iis) {
$iis = Read-Host -Prompt 'Install IIS components (y/n)'
}
if ($iis -ne "y" -and $iis -ne "n") {
return;
}
$down = New-Object System.Net.WebClient
# Create restore point
Checkpoint-Computer -Description 'Before spleeter-gpu'
# Install chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));
# Download dotnet core runtime & hosting bundle
Write-Host "Download dotnet core runtime & hosting bundle", $PSScriptRoot -foregroundcolor "green";
$url = 'https://download.visualstudio.microsoft.com/download/pr/bf608208-38aa-4a40-9b71-ae3b251e110a/bc1cecb14f75cc83dcd4bbc3309f7086/dotnet-hosting-3.0.0-win.exe';
$file = $PSScriptRoot + '\dotnet-hosting-3.0.0-win.exe';
$down.DownloadFile($url,$file);
# Install dotnet core runtime & hosting bundle
Write-Host "Install dotnet core runtime & hosting bundle", $file -foregroundcolor "green";
& $file /install /passive
#Enable IIS
if ($iis -eq "y") {
Write-Host "Installing IIS features" -foregroundcolor "green";
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-WebServerRole
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-WebServer
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-CommonHttpFeatures
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HttpErrors
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HttpRedirect
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ApplicationDevelopment
Enable-WindowsOptionalFeature -online -norestart -FeatureName NetFx4Extended-ASPNET45
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-NetFxExtensibility45
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HealthAndDiagnostics
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HttpLogging
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-LoggingLibraries
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-RequestMonitor
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HttpTracing
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-Security
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-RequestFiltering
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-Performance
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-WebServerManagementTools
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-IIS6ManagementCompatibility
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-Metabase
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ManagementConsole
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-BasicAuthentication
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-WindowsAuthentication
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-StaticContent
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-DefaultDocument
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-WebSockets
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ApplicationInit
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ISAPIExtensions
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ISAPIFilter
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-HttpCompressionStatic
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ASPNET45
Enable-WindowsOptionalFeature -Online -norestart -FeatureName IIS-ManagementService
net start WMSvc
choco install webdeploy -y --no-progress
choco install urlrewrite -y --no-progress
}
# Install dotnet core SDK
Write-Host "Install dotnet core SDK", $PSScriptRoot -foregroundcolor "green";
$url = 'https://download.visualstudio.microsoft.com/download/pr/66adfd75-9c1d-4e44-8d9c-cdc0cbc41104/5288b628601e30b0fa10d64fdaf64287/dotnet-sdk-3.0.101-win-x64.exe';
$file = $PSScriptRoot + '\dotnet-sdk-3.0.101-win-x64.exe';
$down.DownloadFile($url,$file);
& $file /install /passive
#GIT
Write-Host "Installing GIT" -foregroundcolor "green";
choco install git -y --no-progress
#ffmpeg
choco install ffmpeg -y --no-progress
if ($type -eq "gpu") {
#CUDA drivers
Write-Host "Installing CUDA drivers (this can take some time)" -foregroundcolor "green";
choco install cuda --ignore-checksums -y --no-progress
}
#Conda
Write-Host "Installing miniconda3 (this can take some time)" -foregroundcolor "green";
choco install miniconda3 -y --no-progress
& 'C:\tools\miniconda3\shell\condabin\conda-hook.ps1';
conda activate 'C:\tools\miniconda3';
conda update -n base -c defaults conda -y
Write-Host "Installing spleeter (this can take some time)" -foregroundcolor "green";
pip install spleeter
#conda install -c conda-forge spleeter -y
conda deactivate
#youtube-dl
choco install youtube-dl -y --no-progress
#create eventsource name
eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO Spleeter /D "Creating event source"
#environment variables and dirs
[Environment]::SetEnvironmentVariable("ASPNETCORE_ENVIRONMENT", "Production", "Machine")
[Environment]::SetEnvironmentVariable("MODEL_PATH", "c:\spleeter\model", "Machine")
mkdir "c:\spleeter\input"
mkdir "c:\spleeter\output"
mkdir "c:\spleeter\model"
mkdir "c:\spleeter\cache"
#Refresh PATH environment variable
refreshenv
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
#git clone
mkdir "c:\git"
cd "c:\git"
git clone -q https://github.com/deezer/spleeter
git clone -q https://github.com/thepirat000/spleeter-api
if ($type -eq "gpu") {
copy "C:\git\spleeter-api\lib\nvcuda.dll" "c:\windows\system32\nvcuda.dll"
}
#build and publish spleeter-api
cd spleeter-api
dotnet build SpleeterAPI.sln -c Release
dotnet publish SpleeterAPI.csproj -c Release
cd bin\Release\netcoreapp3.0\publish
Write-Host "Installation complete..."
Write-Host ""
Write-Host "You can run the server in Kestrel with command: " -foregroundcolor "green";
Write-Host "dotnet C:\git\spleeter-api\bin\Release\netcoreapp3.0\publish\SpleeterAPI.dll --https_enabled false" -foregroundcolor "cyan";
Write-Host ""
Write-Host "It's recommended that you restart the machine" -foregroundcolor "green";