Commit df7b1a27 authored by Israel Ramos's avatar Israel Ramos Committed by Geovanni Perez

Issue141 app veyor integration test (#171)

* script for iis

* Update appveyor.yml

* Update appveyor.yml

* Update appveyor.yml

* IIS website to get path and reset location

* appveyor path to passcore on script and localhost port

* directory full path, waiting 3 seconds after making the request

* publish and iis path changed

* Chekcing if the site was created

* starting app and app pool and checking request

* port changed

* Update appveyor.yml

* Update appveyor.yml

* IISWebsite.ps1 renamed to IISSetup.ps1, Installer.ps1 created

* open appsettings after iis setup and restarting website after saving appsettings

* checking if world wide web publishing service is running, leave just one security protocol for webrequest

* message to tell passcore will restart

* REadme to download Power Shell installer and github links point to master

* Update README.md

* checking for the host bundle and README.md updated

* Update README.md

* Update appveyor.yml
parent e5489a5e
$iis = Get-Service W3svc -ErrorAction Ignore
if($iis){
if($iis.Status -eq "Running") {
Write-Host "World Wide Web Publishing is running"
}
else {
Write-Host "World Wide Web Publishing is not running"
exit 1
}
}
else {
Write-Host "World Wide Web Publishing not installed"
exit 1
}
Write-Host "Configuring IIS"
$currentDirectory = (Get-Item -Path ".\").FullName
$iisAppName = "passcore"
$iisAppPort = "8080"
$iisAppPoolName = "Passcore Pool PS"
$iisAppPoolDotNetVersion = ""
$iisAppPoolStartMode = "AlwaysRunning"
#the directory where you will be serving the website from
$directoryPath = (Get-Item -Path $args[0]).FullName
try {
Import-Module WebAdministration
#navigate to the app pools root
Set-Location IIS:\AppPools\
#check if the app pool exists
if (!(Test-Path $iisAppPoolName -pathType container))
{
Write-Host "Creating $($iisAppPoolName)"
#create the app pool
$appPool = New-Item $iisAppPoolName
$appPool | Set-ItemProperty -Name "managedRuntimeVersion" -Value $iisAppPoolDotNetVersion
$appPool | Set-ItemProperty -Name "startMode" -value $iisAppPoolStartMode
}
#navigate to the sites root
Set-Location IIS:\Sites\
#check if the site exists
if (Test-Path $iisAppName -pathType container)
{
Write-Host "The site $($iisAppName) already exist"
exit 1
}
Write-Host "Creating $($iisAppName) on IIS"
#create the site
$iisApp = New-Item $iisAppName -bindings @{protocol="http";bindingInformation="*:$($iisAppPort):"} -physicalPath $directoryPath
$iisApp | Set-ItemProperty -Name "applicationPool" -Value $iisAppPoolName
$site = Get-Website $iisAppName
Get-IISAppPool $iisAppPoolName
$site
if(!$site) {
Write-Host "No site was created"
exit 1
}
Start-WebAppPool -Name $iisAppPoolName
Start-Website -Name $iisAppName
$request = Invoke-WebRequest -Uri "http://localhost:$($iisAppPort)"
if ($request.StatusCode -ne 200) {
Write-Host "HTTP Error"
exit 1
}
Write-Host "Website request status: $($request.StatusCode)"
}
finally {
Set-Location $currentDirectory
}
Write-Host "Installing Passcore"
Write-Host "Creating Directory"
$directory = "C:\passcore"
New-Item -ItemType directory -Path $directory
Set-Location $directory
# Determining latest release
Write-Host "Determining latest release"
$repo = "unosquare/passcore"
$releasesUrl = "https://api.github.com/repos/$repo/releases"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-WebRequest $releasesUrl -UseBasicParsing
$releasesJson = ($releases.Content | ConvertFrom-Json)[0]
$assetsJson = $releasesJson.assets
$zipName = $assetsJson.name
$zipUrl = $assetsJson.browser_download_url
$zipPath = "$($directory)\$($zipName)"
# Downloading
Write-Host "Downloading $($zipName)"
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -UseBasicParsing
# Unzipping
Write-Host "Unzipping"
Expand-Archive $zipPath -dest $directory -force
Remove-Item $zipPath
# Checkin for Net Core Host
$netCoreHost = Get-wmiobject -class win32_product | Where-Object {$_.Name -match "Microsoft .NET Core Host - 2.1.0" }
if([string]::IsNullOrEmpty($netCoreHost)) {
Write-Host "Please install the hosting bundle and then restart the installation"
Start-Process "https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.0-windows-hosting-bundle-installer"
exit 1
}
# IIS setup script
# Comment or delete the follow lines if you are making a custom installation and setup
Write-Host "ISS setup runnig"
$iisSetup = (new-object net.webclient).DownloadString('https://raw.githubusercontent.com/unosquare/passcore/master/IISSetup.ps1')
Invoke-Command -ScriptBlock ([scriptblock]::Create($iisSetup)) -ArgumentList $directory
Write-Host "Once you finish configuring appsettings.json, passcore will restart"
Start-Process notepad .\appsettings.json -NoNewWindow -Wait
Write-Host "Restarting passcore"
Import-Module WebAdministration
Stop-WebSite 'passcore'
Start-WebSite 'passcore'
\ No newline at end of file
......@@ -12,6 +12,7 @@
- [Overview](#overview)
- [Features](#features)
- [Installation on IIS](#installation-on-iis)
- [PowerShell Installer](#powershell-installer)
- [Customization and Configuration](#customization-and-configuration)
- [Running as a sub application](#running-as-a-sub-application)
- [Troubleshooting](#troubleshooting)
......@@ -37,6 +38,8 @@ PassCore has the following features:
## Installation on IIS
*You can easily install using Powershell. Check the next section to know how.*
1. Ensure the server running IIS is domain-joined. To determine if the computer is domain-joined:
- Go to the *Start* menu, right click on *Computer*, then select *Properties*
- Make sure the *Domain* field contains the correct setting.
......@@ -59,6 +62,16 @@ PassCore has the following features:
**NOTE:** If you have a previous version, you **can not** use the same `appsettings.json` file. Please update your settings manually editing the new file.
## PowerShell Installer
You can use PowerShell to download and setup Passcore using the following command line, just make sure you have installed the [.NET Core 2.1 Windows Server Hosting bundle](https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.0-windows-hosting-bundle-installer) and enabled the world wide web publishing service:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/unosquare/passcore/master/Installer.ps1'))
```
Using the above command will install to the folder `C:\passcore` and using the HTTP Port 8080 with the default (localhost) binding.If you want to customize your installation please download the [installer script](https://raw.githubusercontent.com/unosquare/passcore/master/Installer.ps1) and the [IIS setup script](https://raw.githubusercontent.com/unosquare/passcore/master/IISSetup.ps1).
## Customization and Configuration
All server-side settings and client-side settings are stored in the `/appsettings.json` file.
......
......@@ -5,5 +5,8 @@ install:
- ps: Install-Product node 8
before_build:
- dotnet restore --verbosity q
- iisreset
- net start W3SVC
build_script:
- dotnet build
- dotnet publish -c Release --output "C:/passcore"
- ps: ./IISSetup.ps1 "C:/passcore"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment