Fix install script line endings; Fix service logging; Update readme (#124)
This commit is contained in:
Родитель
8b3ffcef8f
Коммит
b00fa7265b
21
README.md
21
README.md
|
@ -61,8 +61,9 @@ FactoryOrchestrator
|
|||
## Prerequisites to build source code
|
||||
|
||||
### Install dependencies
|
||||
Building Factory Orchestrator source requires the [NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0), the [NET Core 3.1 runtime.](https://dotnet.microsoft.com/download/dotnet/3.1/runtime/), and [PowerShell 7+](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell) (or Windows PowerShell). If you wish to build the app as well, you also need the Universal Windows Platform Development (10.0.17763.0) SDK.
|
||||
|
||||
The easiest way to open the project is using any variation of [Visual Studio 2019+ (Enterprise, Community)](https://visualstudio.microsoft.com/vs/). In the installer, make sure you click the checkboxes for .NET Core cross-platform Development, and Universal Windows Platform Development (10.0.17763.0).
|
||||
The easiest way to prepare to build the solutions is using any variation of [Visual Studio 2019+ (Enterprise, Community)](https://visualstudio.microsoft.com/vs/). In the installer, make sure you click the checkboxes for .NET Core cross-platform Development, and Universal Windows Platform Development (10.0.17763.0).
|
||||
|
||||
You can also use [Visual Studio Code](https://code.visualstudio.com/), or any whatever editor you prefer. Visual Studio provides a sleek [command-line installer](https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio) that can be used to just deploy the necessary dependencies using their [workload component id](https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community).
|
||||
|
||||
|
@ -70,27 +71,15 @@ You can also use [Visual Studio Code](https://code.visualstudio.com/), or any wh
|
|||
|
||||
https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development
|
||||
|
||||
### Addressing Unsigned Powershell Scripts
|
||||
FactoryOrchestrator contains a series of unsigned powershell scripts. Windows security measures prevent unsigned scripts from executing. In order to develop on FactoryOrchestrator, you need to do one of two things.
|
||||
|
||||
1. Self-sign the scripts
|
||||
|
||||
More information on how to do this can be found here: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_signing?view=powershell-7
|
||||
|
||||
2. Set the Execution Policy to Unrestricted
|
||||
|
||||
This method is not recommended. Setting the Execution Policy to Unresricted allows any powershell script to run.
|
||||
|
||||
Documentation on Execution Policy:
|
||||
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7
|
||||
|
||||
## Other notes
|
||||
|
||||
* There are two Visual Studio .sln files in the src/ folder. Use src/FactoryOrchestratorNoApp.sln if you do not need to build the Windows app or are building on Linux.
|
||||
* You may see IntelliSense errors before building Microsoft.FactoryOrchestrator.Core, as that project creates Autogenerated C# files used in other projects.
|
||||
|
||||
## Debugging
|
||||
The service will not run properly unless it is run as administator/sudo.
|
||||
|
||||
Run _Microsoft.FactoryOrchestrator.App (Universal Windows)_ and _Microsoft.FactoryOrchestrator.Service_ in separate Visual Studio 2019+ instances. This will allow the app and the service to communicate with each other.
|
||||
If you need to debug the app, run _Microsoft.FactoryOrchestrator.App (Universal Windows)_ and _Microsoft.FactoryOrchestrator.Service_ in separate Visual Studio 2019+ instances. This will allow the app and the service to communicate with each other.
|
||||
|
||||
## Versioning
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ if ((Test-Path $tmpdir) -eq $false)
|
|||
}
|
||||
[string]$randString = Get-Random
|
||||
$tmppublishdir = join-path "$([System.IO.Path]::GetTempPath())" "$randString"
|
||||
if ((Test-Path $tmpdir) -eq $false)
|
||||
if ((Test-Path $tmppublishdir) -eq $false)
|
||||
{
|
||||
$null = New-Item -Path $tmpdir -ItemType Directory
|
||||
$null = New-Item -Path $tmppublishdir -ItemType Directory
|
||||
}
|
||||
|
||||
if ($null -ne $($env:VERSIONSUFFIXVPACK))
|
||||
|
@ -34,7 +34,7 @@ else
|
|||
}
|
||||
|
||||
# copy install scripts to temp dir
|
||||
$installdir = Join-Path $env:FORepoRoot "install"
|
||||
$installdir = Join-Path $PSScriptRoot "../../install"
|
||||
if ($BuildOS -eq "win")
|
||||
{
|
||||
$files = Get-ChildItem -Path $installdir -Filter "*.ps1"
|
||||
|
@ -44,20 +44,29 @@ else
|
|||
$files = Get-ChildItem -Path $installdir -Filter "*"
|
||||
}
|
||||
|
||||
# Set $variables$ in tempdir files
|
||||
# Set $variables$ and correct line ending in tempdir files
|
||||
foreach ($file in $files)
|
||||
{
|
||||
$destfile = Join-Path $tmpdir $($file.Name)
|
||||
$null = Get-Content $file.FullName -raw |
|
||||
$content = Get-Content $file.FullName -raw |
|
||||
ForEach-Object{$_ -replace '\$Version\$', "$version"} |
|
||||
ForEach-Object{$_ -replace '\$BuildPlatform\$', "$BuildPlatform"} |
|
||||
ForEach-Object{$_ -replace '\$BuildOS\$', "$BuildOS"} |
|
||||
Set-Content $destfile -NoNewline
|
||||
ForEach-Object{$_ -replace '\$BuildOS\$', "$BuildOS"}
|
||||
|
||||
if ($BuildOS -eq "win")
|
||||
{
|
||||
$content = $content | ForEach-Object{$_ -replace '\r\n', "`n"} | ForEach-Object{$_ -replace '\n', "`r`n"}
|
||||
}
|
||||
else
|
||||
{
|
||||
$content = $content | ForEach-Object{$_ -replace '\r\n', "`n"}
|
||||
}
|
||||
Set-Content -Path $destfile -Value $content -NoNewline
|
||||
}
|
||||
|
||||
# create bin zip in temp dir
|
||||
$publishdir = Join-Path $BinDir "$BuildConfiguration/Publish/$BuildOS/Microsoft.FactoryOrchestrator.Service.$BuildOS-$BuildPlatform"
|
||||
Copy-Item -Path $publishdir -recurse -exclude "*.pdb" -destination $tmppublishdir
|
||||
Copy-Item -Path "$publishdir/*" -recurse -exclude "*.pdb" -destination $tmppublishdir
|
||||
Compress-Archive -Path "$tmppublishdir/*" -DestinationPath "$tmpdir/Microsoft.FactoryOrchestrator.Service-$version-$BuildOS-$BuildPlatform-bin.zip" -Force
|
||||
|
||||
# create zip with bin zip and install files
|
||||
|
|
|
@ -29,7 +29,7 @@ then
|
|||
fi
|
||||
|
||||
# unzip binary files
|
||||
sudo unzip -q -d /usr/sbin/FactoryOrchestrator -o $SCRIPTDIR/Microsoft.FactoryOrchestrator.Service-10.0.0-foo-linux-x64-bin.zip
|
||||
sudo unzip -q -d /usr/sbin/FactoryOrchestrator -o $SCRIPTDIR/Microsoft.FactoryOrchestrator.Service-$Version$-$BuildOS$-$BuildPlatform$-bin.zip
|
||||
sudo cp -f $SCRIPTDIR/Microsoft.FactoryOrchestrator.CleanVolatile.sh /usr/sbin/FactoryOrchestrator/
|
||||
# mark everything as executable
|
||||
sudo chmod -R +x /usr/sbin/FactoryOrchestrator/*
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
if [[ -f "/var/log/FactoryOrchestrator/FactoryOrchestratorVolatileServiceStatus.xml" ]]
|
||||
then
|
||||
rm /var/log/FactoryOrchestrator/FactoryOrchestratorVolatileServiceStatus.xml
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT license.
|
||||
|
||||
[Unit]
|
||||
Description=Microsoft Factory Orchestrator service
|
||||
Description=Microsoft Factory Orchestrator service version $Version$
|
||||
After=Microsoft.FactoryOrchestrator.CleanVolatile.service
|
||||
Requires=Microsoft.FactoryOrchestrator.CleanVolatile.service
|
||||
[Service]
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace Microsoft.FactoryOrchestrator.Service
|
|||
#if DEBUG
|
||||
var _logLevel = LogLevel.Information;
|
||||
#else
|
||||
var _logLevel = LogLevel.Error;
|
||||
var _logLevel = LogLevel.Critical;
|
||||
#endif
|
||||
builder.SetMinimumLevel(_logLevel).AddConsole().AddProvider(new LogFileProvider());
|
||||
}).Build();
|
||||
|
@ -115,7 +115,7 @@ namespace Microsoft.FactoryOrchestrator.Service
|
|||
#if DEBUG
|
||||
var _logLevel = LogLevel.Debug;
|
||||
#else
|
||||
var _logLevel = LogLevel.Error;
|
||||
var _logLevel = LogLevel.Information;
|
||||
#endif
|
||||
builder.SetMinimumLevel(_logLevel).AddConsole().AddProvider(new LogFileProvider());
|
||||
}).Build().Run();
|
||||
|
|
Загрузка…
Ссылка в новой задаче