Closed catadumitru closed 1 year ago
You can use Get-BcContainerEventLog to download the log and see what the problem is.
I have a same problem in our upgrade script. I get this error>
When I try to mount tenant from BCv20 to service tier with technically updated BCv20 app to BCv21 platform.
I think this will be a platform problem, not bccontainerhelper problem....
I have a same problem in our upgrade script. I get this error>
When I try to mount tenant from BCv20 to service tier with technically updated BCv20 app to BCv21 platform.
I think this will be a platform problem, not bccontainerhelper problem....
Yes, I got the same error in the eventlog. I thought maybe it's not a platform problem because I couldn't find anyone else reporting it.
How is everyone else upgrading onprem? v21 has been out for almost 1 month. I haven't had the time to test an upgrade without bccontainerhelper yet.
Have found it on yammer, no reaction, posted on September 16. https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=1918775220314112
Let's take the discussion on Yammer - and if anything need to change in the docker generic image - I will fix that. I have tagged Nikola on Yammer to see
There is a missing step (task 7) in your technical upgrade. A recompilation of apps is needed in order to generate the right metadata. here you can find all the steps Technical Upgrade to Version 19 - Business Central | Microsoft Learn
Here is the missing step https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/upgrade-technical-upgrade-v19#task-7-recompile-published-extensions
Please follow the docs and let us know if you face any issues
I will have a look at how we can change this in the generic image. probably by tomorrow or over the weekend.
The technical upgrade process is described here: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/upgrade/upgrade-technical-upgrade-v21
The only step which is automatic in Docker (and has always been) is the NavAppDatabaseConversion (step 5)
The pre-steps and post-steps needs to be done - and for the 20 -> 21 upgrade this is different. This script performs a number of the steps of the technical upgrade list above (until step #9) - you will still have to perform #10 and #11 (Add-Ins upgrade) - but you get the picture... Only thing that I didn't find in the todo-list or things linked from that is the NavEwsWrapper replacement below.
$auth = "UserPassword"
$containerName = "bcserver"
$artifactUrl = get-bcartifacturl -country us
$credential = New-Object pscredential -ArgumentList 'admin', $PasswordSecret.SecretValue
$artifactUrl = "https://bcartifacts.azureedge.net/onprem/20.2.41144.41423/w1"
$containerName = "t202"
New-BCContainer -accept_eula `
-doNotCheckHealth `
-updateHosts `
-containerName $containerName `
-artifactUrl $artifactUrl `
-auth $auth `
-enableTaskScheduler `
-Credential $credential
# Get Apps in dependency order
$appsJson = (Get-BcContainerAppInfo -containerName $containerName -sort DependenciesFirst).Name | ConvertTo-Json
Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($appsJson)
$apps = $appsJson | ConvertFrom-Json
[Array]::Reverse($apps)
$apps | ForEach-Object {
Write-Host "Uninstalling $_"
Uninstall-NAVApp -ServerInstance $serverInstance -Name $_ -Force
}
Get-NAVAppInfo -ServerInstance $serverInstance -SymbolsOnly | ForEach-Object {
Write-Host "Unpublishing $($_.Name)"
Unpublish-NAVApp -ServerInstance $serverInstance -Name $_.Name
}
$addInsFolder = "c:\programData\BcContainerHelper\Extensions\v20Add-Ins"
if (!(Test-Path $addInsFolder)) {
New-Item -Path $addInsFolder -ItemType Directory | Out-Null
Copy-Item -Path 'C:\Program Files\Microsoft Dynamics NAV\200\Service\Add-Ins\TimeLine' -Destination $addInsFolder -Recurse -Force
Copy-Item -Path 'C:\Program Files\Microsoft Dynamics NAV\200\Service\Add-Ins\PingPong' -Destination $addInsFolder -Recurse -Force
New-Item -Path "$addInsFolder\NavEwsWrapper20" -ItemType Directory | Out-Null
Copy-Item -Path 'C:\Program Files\Microsoft Dynamics NAV\200\Service\Add-Ins\NavEwsWrapper\*.dll' -Destination "$addInsFolder\NavEwsWrapper20" -Recurse -Force
}
} -argumentList $appsJson
Backup-BcContainerDatabases $containerName
$artifactUrl = "https://bcartifacts.azureedge.net/onprem/21.0.46256.46853/w1"
$containerName = "t210"
New-BCContainer -accept_eula `
-doNotCheckHealth `
-updateHosts `
-containerName $containerName `
-artifactUrl $artifactUrl `
-auth $auth `
-enableTaskScheduler `
-Credential $credential `
-additionalParameters @("--volume ""$($bcContainerHelperConfig.HostHelperFolder)\Extensions\v20Add-Ins:c:\run\Add-Ins""") `
-bakFile "$($bcContainerHelperConfig.HostHelperFolder)\Extensions\t202\database.bak"
Invoke-ScriptInBcContainer -containerName $containerName -scriptBlock { Param($appsJson)
Remove-Item -path "C:\Program Files\Microsoft Dynamics NAV\210\Service\Add-ins\NavEwsWrapper" -Recurse -Force
$apps = $appsJson | ConvertFrom-Json
$apps | ForEach-Object {
Write-Host "Repairing $_"
Repair-NAVApp -ServerInstance $serverInstance -Name $_ | Out-Null
}
Restart-NavServerInstance -serverInstance $serverInstance
Sync-NAVTenant -ServerInstance $serverInstance -Tenant default -Mode Sync -Force
$apps | ForEach-Object {
Write-Host "Sync'ing $_"
Sync-NAVApp -ServerInstance $serverInstance -Name $_ | Out-Null
}
$apps | ForEach-Object {
Write-Host "Installing $_"
Install-NAVApp -ServerInstance $serverInstance -Name $_ | Out-Null
}
} -argumentList $appsJson
In 22 there will probably be different steps in a todo list like this.
Thanks for the reply, I've been sick the last few days and didn't manage to post my findings:
I've managed to create a v21container with a v20db if I first removed all apps and saved it. After that my old script for upgrading worked. - all is fine.
I didn't manage to use the Repair-NAVApp function like in your script. There are no apps to repair...
I've managed to create a v21container with a v20db if I first removed all apps and saved it. After that my old script for >upgrading worked. - all is fine. I didn't manage to use the Repair-NAVApp function like in your script. There are no apps to repair...
I had the same problem yesterday in an OnPrem customer update 20.4 to 21.1. I read here that you unpublished all extensions and it went through then. So I tried that - and heureka. Afterwards just had to publish and install all extensions. No negative impact according to the application consultants (I am tech). Thanks for your entry, [catadumitru] - that helped!
Glad it helped. I've only used it for dev/test environments but, if it works fine at customers that's great.
Can you please update which stage we need Publish/Install unpblished apps?
Can you please update which stage we need Publish/Install unpblished apps?
It is in the script above - you need to uninstall and unpublish before backing up the 20.x database - and then republish and re-install after mounting the DB in 21.x
Thanks Freddydk, That worked. I dont use Docker, thats why there was confusion.
Sorry, but that can't be the answer.
When I have an BC20 database and want to use it on BC21/22.. I install first BC20 somewhere, unpublish all Apps and then on BC21/22 Invoke-NavApplicationDatabaseConversion?
In the past it worked like that: Copy the database (maybe BC18), Invoke-NavApplicationDatabaseConversion it with -force from BC20, start the instance without this page 8700 Base Application error and uninstall/unpublish all apps. And I have an fresh starting point on BC20.
Now you can't to that, because the Instance on BC22 doesn't get started because of that error and I can't unpublish the apps..
So whats the solution when I want use an old .bak from BC20 and want to use it under BC22 without first uninstalling/unpublishing all apps on the server instance? Thats a lot of extra work, especially when you have to do it for a lot of databases and you want to keep them like they are.
I've done the following to uninstall / unpublish the apps from the bc20 databases:
Here is the script:
$objektarray = @(
'database1'
'database2'
)
foreach($objekt in $objektarray) {
$ServiceInstanceName = "BC200"
Set-NAVServerConfiguration -ServerInstance $ServiceInstanceName -KeyName "DatabaseServer" -KeyValue "DATABASESERVER"
Set-NAVServerConfiguration -ServerInstance $ServiceInstanceName -KeyName "DatabaseInstance" -KeyValue "DATABASESERVERINSTANCE"
Set-NAVServerConfiguration -ServerInstance $ServiceInstanceName -KeyName "DatabaseName" -KeyValue "$objekt"
Restart-NAVServerInstance -ServerInstance $ServiceInstanceName
do {
$i = $i + 1
try {
Get-NAVAppInfo -ServerInstance $ServiceInstanceName | % { Uninstall-NAVApp -ServerInstance $ServiceInstanceName -Name $_.Name -Version $_.Version -Force}
Get-NAVAppInfo -ServerInstance $ServiceInstanceName | % { Unpublish-NAVApp -ServerInstance $ServiceInstanceName -Name $_.Name -Version $_.Version }
}
catch {
}
$Temp = if (Get-NAVAppInfo -ServerInstance $ServiceInstanceName | % {$_.Name}) {"True"}else{"False"}
} until (($Temp -eq "False") -or ($i -eq 50))
}
And then you can invoke the database to BC22 and start the service tier without problems.
Hope this can help someone.
best regards, Robin
Describe the issue I used to upgrade containers by using a backup of the old version when creating a new container. I would then upgrade the application.
When trying to create a v21 container with a v20 database.bak the server instance does not start. The error log gives the following:
Scripts used to create container and cause the issue
Full output of scripts
Screenshots If applicable, add screenshots to help explain your problem.
Additional context