microsoft / navcontainerhelper

Official Microsoft repository for BcContainerHelper, a PowerShell module, which makes it easier to work with Business Central Containers on Docker.
MIT License
381 stars 243 forks source link

Business Central 15.2 Webclient Does not work #1856

Closed bennyvanlyssebettens closed 3 years ago

bennyvanlyssebettens commented 3 years ago

BCContainerHelper 2.0.9

Script: function Get-WindowsTag { $OS = (Get-CimInstance Win32_OperatingSystem) $UBR = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name UBR).UBR $HostOSVersion = [System.Version]::Parse("$($OS.Version).$UBR") return "$($HostOSVersion.Major).$($HostOSVersion.Minor).$($HostOSVersion.Build).$($HostOSVersion.Revision)" }

OnPrem

$Country = 'W1' $GenericImage = Get-BestGenericImageName

$BCArtifactUrl = Get-BCArtifactUrl -type OnPrem -version 15.2 -select Latest -country $Country if ($BCArtifactUrl.StartsWith('https://bcartifacts.azureedge.net')) { $BCTag = $BCArtifactUrl.Substring(41) $BCTag = $BCTag.Substring(0,($BCTag.Length - 3)) } else {

Alternative url

}

$ImageName = "businesscentral/onprem:$($BCTag)-$($Country)-$(Get-WindowsTag)"

$LicenseFile = "C:\Users\Van Lyssebettens\Documents\Licenses\SONJA_7400987_PARTNER_BC15_2021 04 01.flf"

New-BcImage -artifactUrl $BCArtifactUrl -imageName $ImageName -baseImage $GenericImage -licenseFile $LicenseFile ` -includeTestToolkit -includeTestLibrariesOnly

New-BcContainer -accept_eula -accept_outdated -containerName BC150 -imageName $ImageName -auth NavUserPassword -updateHosts

Output: PS C:\WINDOWS\system32> C:\Users\Van Lyssebettens\Documents\Powershell\CreateDockerContainer.ps1 businesscentral/onprem:15.2.39040.0-w1-10.0.18363.1377 Building image businesscentral/onprem:15.2.39040.0-w1-10.0.18363.1377 based on mcr.microsoft.com/businesscentral:10.0.18363.1377 with https://bcartifacts.azureedge.net/onprem/15.2.39040.0/w1 Pulling latest image mcr.microsoft.com/businesscentral:10.0.18363.1377 10.0.18363.1377: Pulling from businesscentral Generic Tag: 1.0.1.4 Container OS Version: 10.0.18363.1377 (1909) Host OS Version: 10.0.18363.1377 (1909) Using process isolation Using license file C:\Users\Van Lyssebettens\Documents\Licenses\SONJA_7400987_PARTNER_BC15_2021 04 01.flf Files in c:\bcartifacts.cache\r3sosud1.q0v\my: Copying Platform Artifacts Copying Database Copying Licensefile c:\bcartifacts.cache\r3sosud1.q0v Sending build context to Docker daemon 1.049GB

Step 1/6 : FROM mcr.microsoft.com/businesscentral:10.0.18363.1377 ---> d7a4e1370ed2 Step 2/6 : ENV DatabaseServer=localhost DatabaseInstance=SQLEXPRESS DatabaseName=CRONUS IsBcSandbox=N artifactUrl=https://bcartifacts.azureedge.net/onprem/15.2.39040.0/w1 filesOnly=False ---> Running in 2f24c2a74dbe Removing intermediate container 2f24c2a74dbe ---> e5da8c8eb344 Step 3/6 : COPY my /run/ ---> ffc2007fd977 Step 4/6 : COPY NAVDVD /NAVDVD/ ---> a45730c24914 Step 5/6 : RUN \Run\start.ps1 -installOnly -includeTestToolkit -includeTestLibrariesOnly ---> Running in 4c6aa59514c2 Using installer from C:\Run\150-new Installing Business Central Installing from DVD Starting Local SQL Server Starting Internet Information Server Copying Service Tier Files Copying PowerShell Scripts Copying dependencies Copying ReportBuilder Importing PowerShell Modules Determining Database Collation Restoring CRONUS Demo Database Setting CompatibilityLevel for CRONUS on localhost\SQLEXPRESS Modifying Business Central Service Tier Config File for Docker Creating Business Central Service Tier Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll' Copying Web Client Files Copying Client Files Copying ModernDev Files Copying additional files Copying ConfigurationPackages Copying Test Assemblies Copying Applications Starting Business Central Service Tier Importing CRONUS license file Publishing C:\Applications\TestFramework\TestLibraries\Any\Microsoft_Any.app Synchronizing Any Installing Any Publishing C:\Applications\TestFramework\TestLibraries\Assert\Microsoft_Library Assert.app Synchronizing Library Assert Installing Library Assert Publishing C:\Applications\TestFramework\TestRunner\Microsoft_Test Runner.app Synchronizing Test Runner Installing Test Runner Publishing C:\Applications\System Application\Test\Microsoft_System Application Test Library.app Synchronizing System Application Test Library Installing System Application Test Library Publishing C:\Applications\BaseApp\Test\Microsoft_Tests-TestLibraries.app Synchronizing Tests-TestLibraries Installing Tests-TestLibraries Stopping Business Central Service Tier Installation took 95 seconds Installation complete Removing intermediate container 4c6aa59514c2 ---> eabd6c5af053 Step 6/6 : LABEL legal="http://go.microsoft.com/fwlink/?LinkId=837447" created="202104011343" nav="1910" cu="cu2" country="w1" version="15.2.39040.0" platform="15.0.38951.0" ---> Running in 87cdaaee42e7 Removing intermediate container 87cdaaee42e7 ---> 8a681311218c Successfully built 8a681311218c Successfully tagged businesscentral/onprem:15.2.39040.0-w1-10.0.18363.1377 Building image took 231 seconds BcContainerHelper is version 2.0.9 BcContainerHelper is running as administrator Host is Microsoft Windows 10 Enterprise - 1909 Docker Client Version is 19.03.5 Docker Server Version is 19.03.5 Removing BC150 from container hosts file Removing BC150-* from container hosts file Removing C:\ProgramData\BcContainerHelper\Extensions\BC150 Fetching all docker images Fetching all docker volumes Using image businesscentral/onprem:15.2.39040.0-w1-10.0.18363.1377 Creating Container BC150 Version: 15.2.39040.0-w1 Style: onprem Multitenant: No Platform: 15.0.38951.0 Generic Tag: 1.0.1.4 Container OS Version: 10.0.18363.1377 (1909) Host OS Version: 10.0.18363.1377 (1909) Using process isolation Using locale en-US Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable) Files in C:\ProgramData\BcContainerHelper\Extensions\BC150\my:

Creating Self Signed Certificate Self Signed Certificate Thumbprint 250F80073976A411F23992A96596B3A22BC99581 Modifying Service Tier Config File with Instance Specific Settings Starting Service Tier Registering event sources Creating DotNetCore Web Server Instance Creating http download site Setting SA Password and enabling SA Creating admin as SQL User and add to sysadmin Creating SUPER user Container IP Address: 172.18.225.245 Container Hostname : BC150 Container Dns Name : BC150 Web Client : http://BC150/BC/ Dev. Server : http://BC150 Dev. ServerInstance : BC Setting BC150 to 172.18.225.245 in host hosts file

Files: http://BC150:8080/ALLanguage.vsix

Container Total Physical Memory is 31.6Gb Container Free Physical Memory is 18.0Gb

Initialization took 128 seconds Ready for connections! Reading CustomSettings.config from BC150 Creating Desktop Shortcuts for BC150 Container BC150 successfully created

Use: Get-BcContainerEventLog -containerName BC150 to retrieve a snapshot of the event log from the container Get-BcContainerDebugInfo -containerName BC150 to get debug information about the container Enter-BcContainer -containerName BC150 to open a PowerShell prompt inside the container Remove-BcContainer -containerName BC150 to remove the container again docker logs BC150 to retrieve information about URL's again

Everything is working except when you go to http://BC150/BC and try to login, you always stays on the loginwindow No error, nothing in the eventviewer of the docker.

I don't have any issues when I create a 15.17or 17.6 container. Something with the artifacts? Cashed images on my buildservers are still working. This is only on my local machine where I did a cleanup of my artifacts & cached images.

freddydk commented 3 years ago

You could try to flush the artifacts by using flush-containerhelpercache

BTW - all this code:

function Get-WindowsTag
{
$OS = (Get-CimInstance Win32_OperatingSystem)
$UBR = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name UBR).UBR
$HostOSVersion = [System.Version]::Parse("$($OS.Version).$UBR")
return "$($HostOSVersion.Major).$($HostOSVersion.Minor).$($HostOSVersion.Build).$($HostOSVersion.Revision)"
}
$ImageName = "businesscentral/onprem:$($BCTag)-$($Country)-$(Get-WindowsTag)"
New-BcImage -artifactUrl $BCArtifactUrl -imageName $ImageName -baseImage $GenericImage -licenseFile $LicenseFile `
-includeTestToolkit -includeTestLibrariesOnly
New-BcContainer -accept_eula -accept_outdated -containerName BC150 -imageName $ImageName -auth NavUserPassword -updateHosts

Seems to be almost the same as just doing:

New-BcContainer -accept_eula -accept_outdated -artifactUrl $BCArtifactUrl -containerName BC150 -imageName "bconprem" -auth NavUserPassword -updateHosts

New-BcContainer with an imagename like this will cache the image until there is a new generic or a new OS - then it will override the old.

bennyvanlyssebettens commented 3 years ago

On my buildservers, Get-WindowsTag =fixed value in the custom scripts. If a server runs on a different build, the final image (generic + artifact) must always have the same name, since that imagename is filled in in my Azure Devops Tasks

image

Every server can be used for the build pipeline, but not all the buildservers are updated on the same upgrade window. Sow it can happen dat server has 2019 build X & the rest already build Y. Or maybe I'm making it myself to hard :)

freddydk commented 3 years ago

Are you publishing the image to a registry and sharing between servers?

bennyvanlyssebettens commented 3 years ago

That would be the next step. Now I'm building once in a time all the needed images on every server

freddydk commented 3 years ago

as long as things are on each server - the method I describe will work. When publishing to a registry you might need what you do here,

bennyvanlyssebettens commented 3 years ago

My real issue is not with the script, only a BC 15.2 BE container won't let me log in in the webclient. After entering the user & password, it stays on the login screen. ATM I'm trying with the 15.2 W1 artifacts.

bennyvanlyssebettens commented 3 years ago

This I ran, after stopping all my containers

Flush-ContainerHelperCache $BCArtifactUrl = Get-BCArtifactUrl -type OnPrem -version 15.2 -select Latest -country 'W1' New-BcContainer -accept_eula -accept_outdated -artifactUrl $BCArtifactUrl -containerName BC150 -imageName "bconprem" -auth NavUserPassword -updateHosts

result:

image

You see that I tried to logon to the instance. Only 15.2 gives me this issue.

freddydk commented 3 years ago

I can repro this, but I think this is a result of a hardened security in browsers.

If you add -useSSL -installCertificateOnHost

when you create the container, then the container will be created with a self-signed certificate and that certificate will be installed on the host, This made it work on my machine.