microsoft / navcontainerhelper

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

useBestContainerOS and external db #881

Closed gunnargestsson closed 4 years ago

gunnargestsson commented 4 years ago

I am using the following

New-BCContainer `
    -useBestContainerOS `
    -accept_eula `
    -accept_outdated `
    -containerName $ContainerName `
    -imageName $ImageName `
    -useTraefik `
    -PublicDnsName erpdocker.ossur.com `
    -auth NavUserPassword `
    -useSSL `
    -Credential $Credential `
    -databaseServer $sqlHost `
    -databaseName $ContainerName `
    -updateHosts `
    -licenseFile $license `
    -shortcuts None `
    -alwaysPull `
    -restart no `
    -additionalParameters @('--security-opt "credentialspec=file://ossur_gmsa-erpdocker.json"')   

The external database server does not disable the SQL jobs in -useBestContainerOS and in the end the container build fails. Can I give you any more details?

NavContainerHelper is version 0.6.5.0 NavContainerHelper is running as administrator Host is Microsoft Windows Server 2019 Datacenter - ltsc2019 Docker Client Version is 18.09.11 Docker Server Version is 18.09.11 Enabling SSL as otherwise all clients will see mixed HTTP / HTTPS request, which will cause problems e.g. on the mobile and modern windows clients Pulling image mcr.microsoft.com/businesscentral/onprem:14.10.40471.0-na-ltsc2019 14.10.40471.0-na-ltsc2019: Pulling from businesscentral/onprem Using image mcr.microsoft.com/businesscentral/onprem:14.10.40471.0-na-ltsc2019 PublicDnsName is erpdocker.ossur.com Creating Container bhalldorsson Version: 14.10.40471.0-na Style: onprem Platform: 14.0.40464.0 Generic Tag: 0.0.9.98 Container OS Version: 10.0.17763.973 (ltsc2019) Host OS Version: 10.0.17763.1039 (ltsc2019) A better Generic Container OS exists for your host (mcr.microsoft.com/dynamicsnav:10.0.17763.1040-generic) Creating temp container from mcr.microsoft.com/businesscentral/onprem:14.10.40471.0-na-ltsc2019 and extract necessary files Extracting Service Tier and WebClient Files Extracting Windows Client Files Extracting Configuration packages Extracting Test Assemblies Extracting Test Toolkit Extracting Upgrade Toolkit Extracting Extensions Extracting Applications Extracting Applications.na Extracting Files from Run folder Extracting Database Files Downloading prerequisites Downloading C:\ProgramData\NavContainerHelper\14.10.40471.0-na-Files\Prerequisite Components\IIS URL Rewrite Module\rewrite_2.0_rtw_x64.msi Downloading C:\ProgramData\NavContainerHelper\14.10.40471.0-na-Files\Prerequisite Components\Open XML SDK 2.5 for Microsoft Office\OpenXMLSDKv25.msi Downloading C:\ProgramData\NavContainerHelper\14.10.40471.0-na-Files\Prerequisite Components\DotNetCore\DotNetCore.1.0.4_1.1.1-WindowsHosting.exe Performing cleanup Removing temp container Using generic image mcr.microsoft.com/dynamicsnav:10.0.17763.1040-generic Pulling image mcr.microsoft.com/dynamicsnav:10.0.17763.1040-generic 10.0.17763.1040-generic: Pulling from dynamicsnav b5405b758079: Pull complete ac56c610af03: Pull complete d8d61c2ababf: Pull complete 0ed57babb001: Pull complete c8a0f45b3421: Pull complete 45a5e51f11bd: Pull complete 26327d2d1283: Pull complete 7cf0b6478528: Pull complete 6b10a851aed8: Pull complete f08414901ec8: Pull complete d8c9747a07c1: Pull complete 28cc02b8e623: Pull complete 42141538cfb6: Pull complete d5df98d7779c: Pull complete 961cf351c5ba: Pull complete e04afa40bfc7: Pull complete Digest: sha256:6d2222b76109031d3e162575727c29783427323900eab2e0c925a02db589850b Status: Downloaded newer image for mcr.microsoft.com/dynamicsnav:10.0.17763.1040-generic Generic Container OS Version: 10.0.17763.1040 (ltsc2019) Generic Tag of better generic: 0.0.9.99 WARNING: The container operating system matches the host operating system, but the revision is different. If you encounter issues, you might want to specify -isolation hyperv Using locale en-US Using process isolation Adding special CheckHealth.ps1 to enable Traefik support Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable) Using license file f:\license\6433432-14Ossur.flf Files in C:\ProgramData\NavContainerHelper\Extensions\bhalldorsson\my:

tfenster commented 4 years ago

Just a guess, maybe https://github.com/microsoft/nav-docker/issues/373 hit you

freddydk commented 4 years ago

In this case it is during install and probably trying to install the db on the server (which obviously is wrong). Will have a look and apply a fix.

freddydk commented 4 years ago

@tfenster might be right - could you try to set the databaseInstance as well?

gunnargestsson commented 4 years ago

@tfenster is usually right!

If I use

New-BCContainer `
    -isolation hyperv `
    -accept_eula `
    -accept_outdated `
    -containerName $ContainerName `
    -imageName $ImageName `
    -useTraefik `
    -PublicDnsName erpdocker.ossur.com `
    -auth NavUserPassword `
    -useSSL `
    -Credential $Credential `
    -databaseServer $sqlHost `
    -databaseName $ContainerName `
    -updateHosts `
    -licenseFile $license `
    -shortcuts None `
    -alwaysPull `
    -restart no `
    -additionalParameters @('--security-opt "credentialspec=file://ossur_gmsa-erpdocker.json"') 

then I get the container working fine. Adding database instance and executing

New-BCContainer `
    -isolation hyperv `
    -accept_eula `
    -accept_outdated `
    -containerName $ContainerName `
    -imageName $ImageName `
    -useTraefik `
    -PublicDnsName erpdocker.ossur.com `
    -auth NavUserPassword `
    -useSSL `
    -Credential $Credential `
    -databaseServer $sqlHost `
    -databaseInstance MSSQLSERVER `
    -databaseName $ContainerName `
    -updateHosts `
    -licenseFile $license `
    -shortcuts None `
    -alwaysPull `
    -restart no `
    -additionalParameters @('--security-opt "credentialspec=file://ossur_gmsa-erpdocker.json"') 

fails. The database configuration for the nav service seem to be incorrect - pointing to localhost\sqlexpress. See attached event log.

New-BCContainer `
    -userBestContainerOS `
    -accept_eula `
    -accept_outdated `
    -containerName $ContainerName `
    -imageName $ImageName `
    -useTraefik `
    -PublicDnsName erpdocker.ossur.com `
    -auth NavUserPassword `
    -useSSL `
    -Credential $Credential `
    -databaseServer $sqlHost `
    -databaseInstance MSSQLSERVER `
    -databaseName $ContainerName `
    -updateHosts `
    -licenseFile $license `
    -shortcuts None `
    -alwaysPull `
    -restart no `
    -additionalParameters @('--security-opt "credentialspec=file://ossur_gmsa-erpdocker.json"')

failes with the same error as the first. [(https://365bcfiles.blob.core.windows.net/navisonguru/container 2020-02-28 14.07.55.evtx)]

freddydk commented 4 years ago

strange

Tobias' bug (above) describes that you have to specify databaseinstance to make it work - that doesn't work for you.

Will have to see if I can repro.

freddydk commented 4 years ago

I think this is the same as #907