microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
279 stars 114 forks source link

localDevEnv.ps1: Error when running: ALTER DATABASE [CRONUS] SET ONLINE #103

Closed achim-t closed 2 years ago

achim-t commented 2 years ago

Scenario 1, Step 10

F5 in VS Code:

  _                     _   _____             ______
 | |                   | | |  __ \           |  ____|
 | |     ___   ___ __ _| | | |  | | _____   __ |__   _ ____   __
 | |    / _ \ / __/ _` | | | |  | |/ _ \ \ / /  __| | '_ \ \ / /
 | |____ (_) | (__ (_| | | | |__| |  __/\ V /| |____| | | \ V /
 |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/

This script will create a docker based local development environment for your project.

NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work.
If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1

All apps and test apps will be compiled and published to the environment in the development scope.
The script will also modify launch.json to have a Local Sandbox configuration point to your environment.

Checking .github\AL-Go-Settings.json
Reading .github\AL-Go-Settings.json
Checking .AL-Go\settings.json
Reading .AL-Go\settings.json
Checking .github\.settings.json
Checking .AL-Go\.settings.json
Checking .AL-Go\ataeschner.settings.json
Checking System Requirements

Container name
--------------
Please enter the name of the container to create (default bcserver) algo
algo selected

Authentication mechanism for container
--------------------------------------
a Windows Authentication
b Username/Password authentication

Select authentication mechanism for container (default b)
Username/Password authentication selected

LicenseFileUrl
--------------
When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps

Local path or a secure download URL to license file  (default none)
none selected

Downloading BcContainerHelper latest version
Using 7zip
BcContainerHelper version 3.0.7
BcContainerHelper emits usage statistics telemetry to Microsoft
Checking .github\AL-Go-Settings.json
Reading .github\AL-Go-Settings.json
Checking .AL-Go\settings.json
Reading .AL-Go\settings.json
Checking .github\localDevEnv.settings.json
Checking .AL-Go\localDevEnv.settings.json
Checking .AL-Go\ataeschner.settings.json
Checking type
Checking appFolders and testFolders
Application Dependency 19.0.0.0
Checking artifact setting
Downloading artifacts from https://bcartifacts.azureedge.net/sandbox/20.0.37253.40114/us
Updating app- and test Dependencies
Analyzing Test App Dependencies
WARNING: No test apps found in testFolders in .AL-Go\settings.json
  _____                               _
 |  __ \                             | |
 | |__) |_ _ _ __ __ _ _ __ ___   ___| |_ ___ _ __ ___
 |  ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __|
 | |  | (_| | | | (_| | | | | | |  __/ |_  __/ |  \__ \
 |_|   \__,_|_|  \__,_|_| |_| |_|\___|\__\___|_|  |___/

Pipeline name               localDevEnv
Container name              algo
Image name
ArtifactUrl                 https://bcartifacts.azureedge.net/sandbox/20.0.37253.40114/us
SasToken                    Not Specified
BcAuthContext               Not Specified
Environment
ReUseContainer              False
KeepContainer               True
Auth                        UserPassword
Credential                  Specified
CompanyName
MemoryLimit                 8G
Enable Task Scheduler       False
Assign Premium Plan         False
Install Test Runner         False
Install Test Framework      False
Install Test Libraries      False
Install Perf. Toolkit       False
InstallOnlyReferencedApps   True
generateDependencyArtifact  False
CopySymbolsFromContainer    False
enableCodeCop               False
enableAppSourceCop          False
enableUICop                 False
enablePerTenantExtensionCop True
doNotPerformUpgrade         False
uninstallRemovedApps        False
escapeFromCops              False
doNotBuildTests             False
doNotRunTests               True
doNotRunBcptTests           False
useDefaultAppSourceRuleSet  False
rulesetFile
azureDevOps                 False
gitLab                      False
gitHubActions               False
License file                Not specified
CodeSignCertPfxFile         Not specified
CodeSignCertPfxPassword     Not specified
CodeSignCertIsSelfSigned    False
KeyVaultCertPfxFile         Not specified
KeyVaultCertPfxPassword     Not specified
KeyVaultClientId
BuildOutputFile             C:\Users\ataeschner\Documents\AL\shiny-octo-computing-machine\BuildOutput.txt
TestResultsFile             C:\Users\ataeschner\Documents\AL\shiny-octo-computing-machine\TestResults.xml
BcptTestResultsFile         C:\Users\ataeschner\Documents\AL\shiny-octo-computing-machine\bcptTestResults.json
TestResultsFormat           JUnit
AdditionalCountries
PackagesFolder
OutputFolder
BuildArtifactFolder
CreateRuntimePackages       False
AppVersion
AppBuild                    0
AppRevision                 0
Install Apps
- None
Install Test Apps
- None
Previous Apps
- None
Application folders
- C:\Users\ataeschner\Documents\AL\shiny-octo-computing-machine\MySpecialApp
Test application folders
- None
BCPT Test application folders
- None
Custom CodeCops
- None

  _____       _ _ _                                          _        _
 |  __ \     | | (_)                                        (_)      (_)
 | |__) |   _| | |_ _ __   __ _    __ _  ___ _ __   ___ _ __ _  ___   _ _ __ ___   __ _  __ _  ___
 |  ___/ | | | | | | '_ \ / _` |  / _` |/ _ \ '_ \ / _ \ '__| |/ __| | | '_ ` _ \ / _` |/ _` |/ _ \
 | |   | |_| | | | | | | | (_| | | (_| |  __/ | | |  __/ |  | | (__  | | | | | | | (_| | (_| |  __/
 |_|    \__,_|_|_|_|_| |_|\__, |  \__, |\___|_| |_|\___|_|  |_|\___| |_|_| |_| |_|\__,_|\__, |\___|
                           __/ |   __/ |                                                 __/ |
                          |___/   |___/                                                 |___/

Pulling mcr.microsoft.com/businesscentral:10.0.20348.643

Pulling generic image took 2 seconds

   _____                _   _                               _        _
  / ____|              | | (_)                             | |      (_)
 | |     _ __ ___  __ _| |_ _ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __
 | |    | '__/ _ \/ _` | __| | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | |____| | |  __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | |  __/ |
  \_____|_|  \___|\__,_|\__|_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|
                                     __/ |
                                    |___/

BcContainerHelper is version 3.0.7
BcContainerHelper is running as administrator
Hyper-V is Enabled
Host is Microsoft Windows 11 Enterprise - 21H2
Docker Client Version is 20.10.13
Docker Server Version is 20.10.13
Removing container algo
Removing algo from container hosts file
Removing algo-* from container hosts file
Removing C:\ProgramData\BcContainerHelper\Extensions\algo
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.643
Creating Container algo
Style: sandbox
Multitenant: Yes
Version: 20.0.37253.40114
Platform: 20.0.37114.40052
Generic Tag: 1.0.2.1
Container OS Version: 10.0.20348.643 (ltsc2022)
Host OS Version: 10.0.22000.613 (21H2)
Using process isolation
Using locale en-US
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--volume "C:\Users\ataeschner\Documents\AL\shiny-octo-computing-machine:c:\sources"
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\algo\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container algo from image mcr.microsoft.com/businesscentral:10.0.20348.643
13efafcf541a721bb3cb236216a1ad5b5bf69713f4d4028d42e00a6a89904033
Waiting for container algo to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.0.37253.40114/us
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.0.37253.40114\platform\ServiceTier\Program Files
c:\dl\sandbox\20.0.37253.40114\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.0.37253.40114\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.0.37253.40114\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.0.37253.40114\us\BusinessCentral-US.bak
Initializing...
Setting host.docker.internal to 192.168.244.169 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.244.169 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.30.192.1 in container hosts file
Starting Container
Hostname is algo
PublicDnsName is algo
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Copying Database on localhost\SQLEXPRESS from CRONUS to tenant
Taking database CRONUS offline
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Putting database CRONUS back online
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET ONLINE
User does not have permission to alter database 'CRONUS', the database does not exist, or the database is not in a state that allows access checks.
ALTER DATABASE statement failed.
at Invoke-SqlCmdWithRetry, C:\Run\HelperFunctions.ps1: line 434
at Copy-NavDatabase, C:\Run\HelperFunctions.ps1: line 203
at <ScriptBlock>, C:\Run\SetupDatabase.ps1: line 166
at <ScriptBlock>, C:\Run\navstart.ps1: line 122
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.0.37253.40114/us
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.0.37253.40114\platform\ServiceTier\Program Files
c:\dl\sandbox\20.0.37253.40114\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.0.37253.40114\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.0.37253.40114\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.0.37253.40114\us\BusinessCentral-US.bak
Initializing...
Setting host.docker.internal to 192.168.244.169 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.244.169 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.30.192.1 in container hosts file
Starting Container
Hostname is algo
PublicDnsName is algo
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Copying Database on localhost\SQLEXPRESS from CRONUS to tenant
Taking database CRONUS offline
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Putting database CRONUS back online
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET ONLINE
User does not have permission to alter database 'CRONUS', the database does not exist, or the database is not in a state that allows access checks.
ALTER DATABASE statement failed.
at Invoke-SqlCmdWithRetry, C:\Run\HelperFunctions.ps1: line 434
at Copy-NavDatabase, C:\Run\HelperFunctions.ps1: line 203
at <ScriptBlock>, C:\Run\SetupDatabase.ps1: line 166
at <ScriptBlock>, C:\Run\navstart.ps1: line 122
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1
New-BcContainer Telemetry Correlation Id: 3367781c-2e3e-4b8c-b9df-3b56ee41f0bc
Run-AlPipeline Telemetry Correlation Id: a548a9e5-4182-48fe-a105-574897d800c6
Removing BcContainerHelper
Press ENTER to close this window:

I can create other BC containers, this script works fine:

$accept_eula = $true

$auth = "UserPassword"
$credential = get-credential -UserName $env:USERNAME -Message "Using $auth Authentication. Please enter your Windows credentials."
$artifactUrl = Get-BCArtifactUrl -country de 
$containerName = "runtest4"
$licenseFile = "##############"
New-BcContainer -accept_eula `
                -containerName $containerName `
                -artifactUrl $artifactUrl `
                -auth $auth `
                -credential $credential `
                -licenseFile $licenseFile `
                -updateHosts `
                -isolation hyperv `
                -assignPremiumPlan `
                -multitenant:$false 
achim-t commented 2 years ago

As admin: there is no error message in the console, but I can still see that error in the event log.

The container behaves the same.

freddydk commented 2 years ago

can you download http://runtest6:8080/ALLanguage.vsix from the container?

achim-t commented 2 years ago

No, timed out.

freddydk commented 2 years ago

and with -isolation hyperv - webclient works and download as well?

achim-t commented 2 years ago

Yes, both.

BcContainerHelper is version 3.0.7
BcContainerHelper is not running as administrator
Host is Microsoft Windows 11 Enterprise - 21H2
Docker Client Version is 20.10.13
Docker Server Version is 20.10.13
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.20348.643-dev
Creating Container runtest6
Style: sandbox
Multitenant: Yes
Version: 20.0.37253.40301
Platform: 20.0.37114.40239
Generic Tag: 1.0.2.2
Container OS Version: 10.0.20348.643 (ltsc2022)
Host OS Version: 10.0.22000.613 (21H2)
Using hyperv isolation
Using locale de-DE
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Using license file C:\Users\ataeschner\Desktop\fin.flf
Files in C:\ProgramData\BcContainerHelper\Extensions\runtest6\my:
- AdditionalOutput.ps1
- license.flf
- MainLoop.ps1
- SetupNavUsers.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container runtest6 from image mcr.microsoft.com/businesscentral:10.0.20348.643-dev
c819069a0276f979fe20d1d013b15f26b662ef691476d3c13becd850adb769b5
Waiting for container runtest6 to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.0.37253.40301/de
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.0.37253.40301\platform\ServiceTier\Program Files
c:\dl\sandbox\20.0.37253.40301\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.0.37253.40301\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.0.37253.40301\platform\WindowsPowerShellScripts\WebSearch
Copying Web Client Files
c:\dl\sandbox\20.0.37253.40301\platform\WebClient\Microsoft Dynamics NAV
Copying Client Files
c:\dl\sandbox\20.0.37253.40301\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\20.0.37253.40301\platform\LegacyDlls\program files\Microsoft Dynamics NAV
c:\dl\sandbox\20.0.37253.40301\platform\LegacyDlls\systemFolder
Copying ModernDev Files
c:\dl\sandbox\20.0.37253.40301\platform
c:\dl\sandbox\20.0.37253.40301\platform\ModernDev\program files\Microsoft Dynamics NAV
Copying additional files
Copying ConfigurationPackages
C:\dl\sandbox\20.0.37253.40301\de\ConfigurationPackages
Copying Test Assemblies
C:\dl\sandbox\20.0.37253.40301\platform\Test Assemblies
Copying Extensions
C:\dl\sandbox\20.0.37253.40301\de\Extensions
Copying Applications
C:\dl\sandbox\20.0.37253.40301\platform\Applications
Copying Applications.DE
C:\dl\sandbox\20.0.37253.40301\de\Applications.DE
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Removing Application from tenant
Modifying Business Central Service Tier Config File for Docker
Creating Business Central Service Tier
Installing SIP crypto provider: 'C:\Windows\System32\NavSip.dll'
Starting Business Central Service Tier
Importing license file
Copying Database on localhost\SQLEXPRESS from tenant to default
Taking database tenant offline
Copying database files
Attaching files as new Database default
Putting database tenant back online
Mounting tenant database
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Stopping Business Central Service Tier
Installation took 111 seconds
Installation complete
Initializing...
Setting host.docker.internal to 192.168.244.162 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.244.162 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.30.192.1 in container hosts file
Starting Container
Hostname is runtest6
PublicDnsName is runtest6
WARNING: Container starts with TimeZone = Mitteleuropäische Zeit, which is not recognized in the list of TimeZones.
Using NavUserPassword Authentication
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 48489D73C9F0E88E4E2A64EA6831238AD018AB82
DNS identity runtest6
Modifying Service Tier Config File with Instance Specific Settings
Starting Service Tier
Registering event sources
Creating DotNetCore Web Server Instance
Using application pool name: BC
Using default container name: NavWebApplicationContainer
Copy files to WWW root C:\inetpub\wwwroot\BC
Create the application pool BC
Create website: NavWebApplicationContainer without SSL
Update configuration: navsettings.json
Done Configuring Web Client
Enabling Financials User Experience
Using license file 'c:\run\my\license.flf'
Import License
Dismounting Tenant
Mounting Tenant
Mounting Database for default on server localhost\SQLEXPRESS with AllowAppDatabaseWrite = False
Sync'ing Tenant
Tenant is Operational
Creating http download site
Setting SA Password and enabling SA
Creating ataeschner as SQL User and add to sysadmin
WARNING: This license is not compatible with this version of Business Central.
Creating SUPER user
WARNING: The password that you entered does not meet the minimum requirements. 
It should be at least 8 characters long and contain at least one uppercase 
letter, one lowercase letter, and one number.
WARNING: This license is not compatible with this version of Business Central.
WARNING: This license is not compatible with this version of Business Central.
WARNING: This license is not compatible with this version of Business Central.
Assign Premium plan for ATAESCHNER
Container IP Address: 172.30.197.57
Container Hostname  : runtest6
Container Dns Name  : runtest6
Web Client          : http://runtest6/BC/?tenant=default
Dev. Server         : http://runtest6
Dev. ServerInstance : BC
Dev. Server Tenant  : default
Setting runtest6 to 172.30.197.57 in host hosts file
Setting runtest6-default to 172.30.197.57 in host hosts file
Setting runtest6-default to 172.30.197.57 in container hosts file

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

Container Total Physical Memory is 8.5Gb
Container Free Physical Memory is 5.7Gb

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

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

@achim-t - can we maybe setup a Teams call to investigate the WebClient issue. I am unsure whether this is related to the other issue.

If possible, please email me at freddyk at microsoft dot com and give me a few suggested timeslots (30 min should be enough) I can pick between to do some investigations, thanks (excluding thursday and friday this week as I am OOF)

achim-t commented 2 years ago

I sent an email from my work account.

rafastrozyk commented 2 years ago

Facing the same issue with localDevEnv.ps1

  _                     _   _____             ______
 | |                   | | |  __ \           |  ____|
 | |     ___   ___ __ _| | | |  | | _____   __ |__   _ ____   __
 | |    / _ \ / __/ _` | | | |  | |/ _ \ \ / /  __| | '_ \ \ / /
 | |____ (_) | (__ (_| | | | |__| |  __/\ V /| |____| | | \ V /
 |______\___/ \___\__,_|_| |_____/ \___| \_/ |______|_| |_|\_/

This script will create a docker based local development environment for your project.

NOTE: You need to have Docker installed, configured and be able to create Business Central containers for this to work.
If this fails, you can setup a cloud based development environment by running cloudDevEnv.ps1

All apps and test apps will be compiled and published to the environment in the development scope.
The script will also modify launch.json to have a Local Sandbox configuration point to your environment.

Checking .github\AL-Go-Settings.json
Reading .github\AL-Go-Settings.json
Checking .AL-Go\settings.json
Reading .AL-Go\settings.json
Checking .github\.settings.json
Checking .AL-Go\.settings.json
Checking .AL-Go\rafal.strozyk.settings.json
Checking System Requirements

Container name
--------------
Please enter the name of the container to create (default bcserver)
bcserver selected

Authentication mechanism for container
--------------------------------------
a Windows Authentication
b Username/Password authentication

Select authentication mechanism for container (default b)
Username/Password authentication selected

LicenseFileUrl
--------------
When developing PTEs, you can optionally specify a developer licensefile with permissions to object IDs of your dependant apps

Local path or a secure download URL to license file  (default none)
none selected

Downloading BcContainerHelper latest version
Using 7zip
BcContainerHelper version 3.0.7
BcContainerHelper emits usage statistics telemetry to Microsoft
Checking .github\AL-Go-Settings.json
Reading .github\AL-Go-Settings.json
Checking .AL-Go\settings.json
Reading .AL-Go\settings.json
Checking .github\localDevEnv.settings.json
Checking .AL-Go\localDevEnv.settings.json
Checking .AL-Go\rafal.strozyk.settings.json
Checking type
Checking appFolders and testFolders
Application Dependency 19.0.0.0
Checking artifact setting
Downloading artifacts from https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
Updating app- and test Dependencies
Analyzing Test App Dependencies
WARNING: No test apps found in testFolders in .AL-Go\settings.json
  _____                               _
 |  __ \                             | |
 | |__) |_ _ _ __ __ _ _ __ ___   ___| |_ ___ _ __ ___
 |  ___/ _` | '__/ _` | '_ ` _ \ / _ \ __/ _ \ '__/ __|
 | |  | (_| | | | (_| | | | | | |  __/ |_  __/ |  \__ \
 |_|   \__,_|_|  \__,_|_| |_| |_|\___|\__\___|_|  |___/

Pipeline name               localDevEnv
Container name              bcserver
Image name
ArtifactUrl                 https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
SasToken                    Not Specified
BcAuthContext               Not Specified
Environment
ReUseContainer              False
KeepContainer               True
Auth                        UserPassword
Credential                  Specified
CompanyName
MemoryLimit                 8G
Enable Task Scheduler       False
Assign Premium Plan         False
Install Test Runner         False
Install Test Framework      False
Install Test Libraries      False
Install Perf. Toolkit       False
InstallOnlyReferencedApps   True
generateDependencyArtifact  False
CopySymbolsFromContainer    False
enableCodeCop               False
enableAppSourceCop          False
enableUICop                 False
enablePerTenantExtensionCop True
doNotPerformUpgrade         False
uninstallRemovedApps        False
escapeFromCops              False
doNotBuildTests             False
doNotRunTests               True
doNotRunBcptTests           False
useDefaultAppSourceRuleSet  False
rulesetFile
azureDevOps                 False
gitLab                      False
gitHubActions               False
License file                Not specified
CodeSignCertPfxFile         Not specified
CodeSignCertPfxPassword     Not specified
CodeSignCertIsSelfSigned    False
KeyVaultCertPfxFile         Not specified
KeyVaultCertPfxPassword     Not specified
KeyVaultClientId
BuildOutputFile             C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions\BuildOutput.txt
TestResultsFile             C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions\TestResults.xml
BcptTestResultsFile         C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions\bcptTestResults.json
TestResultsFormat           JUnit
AdditionalCountries
PackagesFolder
OutputFolder
BuildArtifactFolder
CreateRuntimePackages       False
AppVersion
AppBuild                    0
AppRevision                 0
Install Apps
- None
Install Test Apps
- None
Previous Apps
- None
Application folders
- C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions\getsix Extensions
Test application folders
- None
BCPT Test application folders
- None
Custom CodeCops
- None

  _____       _ _ _                                          _        _
 |  __ \     | | (_)                                        (_)      (_)
 | |__) |   _| | |_ _ __   __ _    __ _  ___ _ __   ___ _ __ _  ___   _ _ __ ___   __ _  __ _  ___
 |  ___/ | | | | | | '_ \ / _` |  / _` |/ _ \ '_ \ / _ \ '__| |/ __| | | '_ ` _ \ / _` |/ _` |/ _ \
 | |   | |_| | | | | | | | (_| | | (_| |  __/ | | |  __/ |  | | (__  | | | | | | | (_| | (_| |  __/
 |_|    \__,_|_|_|_|_| |_|\__, |  \__, |\___|_| |_|\___|_|  |_|\___| |_|_| |_| |_|\__,_|\__, |\___|
                           __/ |   __/ |                                                 __/ |
                          |___/   |___/                                                 |___/

INFO: Windows 10 21H1/21H2 images are not yet available, using 2004 as these are found to work better than 20H2 on 21H1/21H2
Pulling mcr.microsoft.com/businesscentral:10.0.19041.1415

Pulling generic image took 4 seconds

   _____                _   _                               _        _
  / ____|              | | (_)                             | |      (_)
 | |     _ __ ___  __ _| |_ _ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __
 | |    | '__/ _ \/ _` | __| | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | |____| | |  __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | |  __/ |
  \_____|_|  \___|\__,_|\__|_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|
                                     __/ |
                                    |___/

BcContainerHelper is version 3.0.7
BcContainerHelper is running as administrator
Hyper-V is Enabled
Host is Microsoft Windows 10 Pro - 21H2
Docker Client Version is 20.10.14
Docker Server Version is 20.10.14
Removing container bcserver
Removing bcserver from container hosts file
Removing bcserver-* from container hosts file
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.19041.1415
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 20.1.39764.40482
Platform: 20.0.39668.40349
Generic Tag: 1.0.2.1
Container OS Version: 10.0.19041.1415 (2004)
Host OS Version: 10.0.19044.1645 (21H2)
WARNING: Host OS is 21H1 and Container OS is 2004, defaulting to process isolation. If you experience problems, add -isolation hyperv.
Using process isolation
Using locale en-US
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--volume "C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions:c:\sources"
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.19041.1415
c4ff9c9cc75efa7dc54db03fd35458d8afc251d5891845204d429df3f49bbfd8
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\Program Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.1.39764.40482\w1\BusinessCentral-W1.bak
Initializing...
Setting host.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.25.240.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Copying Database on localhost\SQLEXPRESS from CRONUS to tenant
Taking database CRONUS offline
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Putting database CRONUS back online
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET ONLINE
User does not have permission to alter database 'CRONUS', the database does not exist, or the database is not in a state that allows access checks.
ALTER DATABASE statement failed.
at Invoke-SqlCmdWithRetry, C:\Run\HelperFunctions.ps1: line 434
at Copy-NavDatabase, C:\Run\HelperFunctions.ps1: line 203
at <ScriptBlock>, C:\Run\SetupDatabase.ps1: line 166
at <ScriptBlock>, C:\Run\navstart.ps1: line 122
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\Program Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.1.39764.40482\w1\BusinessCentral-W1.bak
Initializing...
Setting host.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.25.240.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Copying Database on localhost\SQLEXPRESS from CRONUS to tenant
Taking database CRONUS offline
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET OFFLINE WITH ROLLBACK IMMEDIATE
Putting database CRONUS back online
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting... - retrying
Warning, exception when running: ALTER DATABASE [CRONUS] SET ONLINE
Waiting...... - retrying
Error when running: ALTER DATABASE [CRONUS] SET ONLINE
User does not have permission to alter database 'CRONUS', the database does not exist, or the database is not in a state that allows access checks.
ALTER DATABASE statement failed.
at Invoke-SqlCmdWithRetry, C:\Run\HelperFunctions.ps1: line 434
at Copy-NavDatabase, C:\Run\HelperFunctions.ps1: line 203
at <ScriptBlock>, C:\Run\SetupDatabase.ps1: line 166
at <ScriptBlock>, C:\Run\navstart.ps1: line 122
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1
New-BcContainer Telemetry Correlation Id: 868ccbf0-fc6f-42fe-ba81-eaae47409f46
Run-AlPipeline Telemetry Correlation Id: b2585c99-4546-4f4e-9d15-05d10976bf67
Removing BcContainerHelper`
freddydk commented 2 years ago

@rafastrozyk - if you modify the .github\AL-Go-Settings.json and add a property called:

"bcContainerHelperVersion":  "preview"

then you should be able to retry and succeed.

rafastrozyk commented 2 years ago

Thanks, a step forward. Yet another error:

   _____                _   _                               _        _
  / ____|              | | (_)                             | |      (_)
 | |     _ __ ___  __ _| |_ _ _ __   __ _    ___ ___  _ __ | |_ __ _ _ _ __   ___ _ __
 | |    | '__/ _ \/ _` | __| | '_ \ / _` |  / __/ _ \| '_ \| __/ _` | | '_ \ / _ \ '__|
 | |____| | |  __/ (_| | |_| | | | | (_| | | (__ (_) | | | | |_ (_| | | | | |  __/ |
  \_____|_|  \___|\__,_|\__|_|_| |_|\__, |  \___\___/|_| |_|\__\__,_|_|_| |_|\___|_|
                                     __/ |
                                    |___/

BcContainerHelper is version 3.0.8-preview593
BcContainerHelper is running as administrator
Hyper-V is Enabled
Host is Microsoft Windows 10 Pro - 21H2
Docker Client Version is 20.10.14
Docker Server Version is 20.10.14
Removing entires from hosts
Removing bcserver from container hosts file
Removing bcserver-* from container hosts file
Removing Desktop shortcuts
Removing C:\ProgramData\BcContainerHelper\Extensions\bcserver
Fetching all docker images
Fetching all docker volumes
Using image mcr.microsoft.com/businesscentral:10.0.19041.1415
Creating Container bcserver
Style: sandbox
Multitenant: Yes
Version: 20.1.39764.40482
Platform: 20.0.39668.40349
Generic Tag: 1.0.2.1
Container OS Version: 10.0.19041.1415 (2004)
Host OS Version: 10.0.19044.1645 (21H2)
WARNING: Host OS is 21H1 and Container OS is 2004, defaulting to process isolation. If you experience problems, add -isolation hyperv.
Using process isolation
WARNING: Using process isolation on Windows Desktop OS with generic image version prior to 1.0.2.4 or NAV/BC versions prior to 15.0, might require you to use HyperV isolation or disable Windows Defender while creating the container
Using locale en-US
Disabling the standard eventlog dump to container log every 2 seconds (use -dumpEventLog to enable)
Additional Parameters:
--volume "C:\Users\rafal.strozyk\Dropbox\Visual Studio Code Projects\BC-getsix-extensions:c:\sources"
--env customNavSettings=EnableTaskScheduler=False
Files in C:\ProgramData\BcContainerHelper\Extensions\bcserver\my:
- AdditionalOutput.ps1
- MainLoop.ps1
- SetupVariables.ps1
- updatehosts.ps1
Creating container bcserver from image mcr.microsoft.com/businesscentral:10.0.19041.1415
be3897aaa4344b25ba358bdc46c0af61d9f1aac4fc67b3dd64753e3233266076
Waiting for container bcserver to be ready
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\Program Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.1.39764.40482\w1\BusinessCentral-W1.bak
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Initializing...
Setting host.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.25.240.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 202CB741FC577D50FB1255199783351FA0F6D3CF
DNS identity bcserver
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to False
Service Tier doesn't exist / is not installed
at <ScriptBlock>, C:\Run\navstart.ps1: line 153
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1Error
Using artifactUrl https://bcartifacts.azureedge.net/sandbox/20.1.39764.40482/w1
Using installer from C:\Run\150-new
Installing Business Central
Installing from artifacts
Starting Local SQL Server
Starting Internet Information Server
Copying Service Tier Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\Program Files
c:\dl\sandbox\20.1.39764.40482\platform\ServiceTier\System64Folder
Copying PowerShell Scripts
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\Cloud\NAVAdministration
c:\dl\sandbox\20.1.39764.40482\platform\WindowsPowerShellScripts\WebSearch
Copying dependencies
Copying ReportBuilder
Importing PowerShell Modules
Determining Database Collation from c:\dl\sandbox\20.1.39764.40482\w1\BusinessCentral-W1.bak
Restoring CRONUS Demo Database
Setting CompatibilityLevel for tenant on localhost\SQLEXPRESS
Exporting Application to CRONUS
Initializing...
Setting host.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting gateway.docker.internal to 192.168.8.100 in container hosts file (copy from host hosts file)
Setting kubernetes.docker.internal to 127.0.0.1 in container hosts file (copy from host hosts file)
Setting host.containerhelper.internal to 172.25.240.1 in container hosts file
Starting Container
Hostname is bcserver
PublicDnsName is bcserver
Using NavUserPassword Authentication
Starting Local SQL Server
Starting Internet Information Server
Creating Self Signed Certificate
Self Signed Certificate Thumbprint 202CB741FC577D50FB1255199783351FA0F6D3CF
DNS identity bcserver
Modifying Service Tier Config File with Instance Specific Settings
Modifying Service Tier Config File with settings from environment variable
Setting EnableTaskScheduler to False
Service Tier doesn't exist / is not installed
at <ScriptBlock>, C:\Run\navstart.ps1: line 153
at <ScriptBlock>, C:\Run\start.ps1: line 363
at <ScriptBlock>, <No file>: line 1
New-BcContainer Telemetry Correlation Id: c4f27967-13c7-4e84-8363-42a9fd2307f0
Run-AlPipeline Telemetry Correlation Id: 3d8f5928-25cd-41b9-8b2f-3e75e527ca99
Removing BcContainerHelper
Initialization of container bcserver failed
At C:\Users\rafal.strozyk\AppData\Local\Temp\21a3f2b3-da5b-45e3-9bf0-da7015c2b606\BcContainerHelper\ContainerHandling\Wait-NavContainerReady.ps1:42 char:17
+ ...             throw "Initialization of container $containerName failed" ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Initialization ...bcserver failed:String) [], RuntimeException
    + FullyQualifiedErrorId : Initialization of container bcserver failed
freddydk commented 2 years ago

Ok, I was expecting the latest preview containerhelper to use the preview generic image - that didn't happen. I will investigate and get back shortly.

freddydk commented 2 years ago

If you add this property to the .github\AL-Go-Settings.json

"genericImageName":  "mcr.microsoft.com/businesscentral:{0}-dev"

then it should select the preview.

in 1-2 weeks from now - you can remove these two properties again as things will be out of preview.

Sorry for the inconvenience.

rafastrozyk commented 2 years ago

It worked, thanks a lot!

freddydk commented 2 years ago

I have another partner with the same problem, where the web client isn't accessible. Next version of containerhelper will check the health of the web client after creation and attempt one reboot if the webclient isn't accessible.

freddydk commented 2 years ago

Shipped in v1.5 (and ContainerHelper 3.0.10)

freddydk commented 2 years ago

@achim-t - thanks for all the help on this

achim-t commented 2 years ago

My pleasure.

I can confirm it is working now.