Browse Source

Server install tools for Windows Server 2012 R2

Pēteris Ņikiforovs 12 years ago
parent
commit
a03eb1f1d1
3 changed files with 111 additions and 0 deletions
  1. 2 0
      benchmarker.py
  2. 39 0
      installer-bootstrap.ps1
  3. 70 0
      installer.ps1

+ 2 - 0
benchmarker.py

@@ -249,6 +249,8 @@ class Benchmarker:
   ############################################################
   ############################################################
   def __setup_server(self):
   def __setup_server(self):
     try:
     try:
+      if os.name == 'nt':
+        return True
       subprocess.check_call("sudo sysctl -w net.core.somaxconn=1024".rsplit(" "))
       subprocess.check_call("sudo sysctl -w net.core.somaxconn=1024".rsplit(" "))
       subprocess.check_call("sudo -s ulimit -n 8192".rsplit(" "))
       subprocess.check_call("sudo -s ulimit -n 8192".rsplit(" "))
       subprocess.check_call("sudo sysctl net.ipv4.tcp_tw_reuse=1".rsplit(" "))
       subprocess.check_call("sudo sysctl net.ipv4.tcp_tw_reuse=1".rsplit(" "))

+ 39 - 0
installer-bootstrap.ps1

@@ -0,0 +1,39 @@
+param($Work)
+
+if (!$Work) {
+    Write-Host "`nRestarting PowerShell with -NoExit...`n"
+    powershell -NoExit -File $MyInvocation.MyCommand.Path 1
+    return
+}
+
+$basedir = "C:\FrameworkBenchmarks"
+$workdir = $basedir + "\installs"
+
+$repo = "https://github.com/TechEmpower/FrameworkBenchmarks"
+$installer = $basedir + "\installer.ps1"
+
+$git = "C:\Git\bin\git.exe"
+$gitinstaller_file = "Git-1.8.1.2-preview20130201.exe"
+$gitinstaller_url = "https://msysgit.googlecode.com/files/" + $gitinstaller_file
+$gitinstaller_local = $workdir + "\" + $gitinstaller_file
+
+Write-Host "Creating work directory: $workdir `n"
+New-Item -Path $workdir -Type directory -Force | Out-Null
+
+Write-Host "Downloading git...`n"
+$wc = New-Object System.Net.WebClient
+$wc.DownloadFile($gitinstaller_url, $gitinstaller_local)
+
+Write-Host "Installing git...`n"
+Start-Process $gitinstaller_local '/silent /dir="C:\Git"' -Wait
+$env:Path += ";C:\Git\bin"; [Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine )
+
+Write-Host "Removing git installation files...`n"
+Remove-Item -Recurse -Force $basedir
+
+Write-Host "Downloading FrameworkBenchmarks from git...`n"
+&$git "clone" $repo $basedir | Out-Host
+
+Write-Host "`nLaunching installer...`n"
+Set-ExecutionPolicy -ExecutionPolicy Bypass
+powershell -NoExit -File $installer

+ 70 - 0
installer.ps1

@@ -0,0 +1,70 @@
+$basedir = "C:\FrameworkBenchmarks"
+$workdir = $basedir + "\installs"
+New-Item -Path $workdir -Type directory -Force | Out-Null
+
+#
+# ASP.NET
+#
+Write-Host "Installing IIS, .NET and ASP.NET..."
+
+# Enable Windows Update to get rid of the yellow warnings
+# But this is not strictly neccessary
+$Updates = (New-Object -ComObject "Microsoft.Update.AutoUpdate").Settings
+$Updates.NotificationLevel = 2 # Notify before download
+$Updates.Save()
+$Updates.Refresh()
+
+Install-WindowsFeature Web-Server
+Install-WindowsFeature Web-Mgmt-Console
+Install-WindowsFeature NET-Framework-45-ASPNET
+Install-WindowsFeature Web-Asp-Net45
+
+#
+# Tools for building .NET projects on the server
+#
+Write-Host "`nInstalling .NET build tools...`n"
+
+# .NET Framework 4.5 SDK
+$sdktools_url = "http://download.microsoft.com/download/F/1/3/F1300C9C-A120-4341-90DF-8A52509B23AC/standalonesdk/sdksetup.exe"
+$sdktools_local = "$workdir\sdksetup.exe"
+(New-Object System.Net.WebClient).DownloadFile($sdktools_url, $sdktools_local)
+Start-Process "$workdir\sdksetup.exe" "/features OptionId.NetFxSoftwareDevelopmentKit /q /layout $workdir\sdksetup" -Wait
+Start-Process "msiexec" "/i $workdir\sdksetup\Redistributable\4.5.50710\sdk_tools4.msi VSEXTUI=1" -Wait
+
+# Web Deploy 3.0
+$webdeploy_url = "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi"
+$webdeploy_local = "$workdir\WebDeploy_amd64_en-US.msi"
+(New-Object System.Net.WebClient).DownloadFile($webdeploy_url, $webdeploy_local)
+Start-Process "msiexec" "/i $webdeploy_local /passive" -Wait
+
+#
+# node.js
+#
+Write-Host "Installing node.js...`n"
+$nodeinstaller_file = "node-v0.10.5-x64.msi"
+$nodeinstaller_url = "http://nodejs.org/dist/v0.10.5/x64/" + $nodeinstaller_file
+$nodeinstaller_local = $workdir + "\" + $nodeinstaller_file
+(New-Object System.Net.WebClient).DownloadFile($nodeinstaller_url, $nodeinstaller_local)
+
+Start-Process $nodeinstaller_local '/passive' -Wait
+$env:Path += ";C:\Program Files\nodejs"; [Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine )
+
+#
+# Python
+#
+Write-Host "Installing Python...`n"
+$pythoninstaller_file = "python-2.7.4.amd64.msi"
+$pythoninstaller_url = "http://www.python.org/ftp/python/2.7.4/" + $pythoninstaller_file
+$pythoninstaller_local = $workdir + "\" + $pythoninstaller_file
+(New-Object System.Net.WebClient).DownloadFile($pythoninstaller_url, $pythoninstaller_local)
+
+Start-Process $pythoninstaller_local '/passive' -Wait
+$env:Path += ";C:\Python27"; [Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine )
+
+#
+# Firewall
+#
+Write-Host "Configuring firewall...`n"
+New-NetFirewallRule -DisplayName "HTTP 8080" -Action Allow -Direction Inbound -LocalPort 8080 -Protocol TCP | Out-Null
+
+cd "C:\FrameworkBenchmarks"