DXP Deployment Issues

Vote:
 

I am trying to get my first Optimizely 12 site deployed to the DXP and am having a great deal of difficulty:

  1. I create a deployment package

    https://docs.developers.optimizely.com/digital-experience-platform/v1.2.0-dxp-cloud-services/docs/deploying-an-existing-cms-site

    So, my package is called sitename.cms.app.buildnumber.nukpg

  2. Since I am deploying to Integration, I can do a direct deploy. The powershell looks like:
    param ($clientkey, $clientsecret, $projectid, $targetEnvironment)
    
    # Set root folder name
    $rootPath = "artifacts"
    
    # Set security
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    
    # Install EpiClound
    if (-not (Get-Module -Name EpiCloud -ListAvailable)) {
        Install-Module EpiCloud -Scope CurrentUser -Force
        Write-Host "EPiCloud isntalled"
    }
    
    # Get the artifact
    $resolvedPackagePath = Get-ChildItem -Path $rootPath -Filter *.nupkg
    
    # Set the paramaters
    $getEpiDeploymentPackageLocationSplat = @{
        ClientKey = "$clientkey"
        ClientSecret = "$clientsecret"
        ProjectId = "$projectid"
    }
    
    # Get the package location
    $packageLocation = Get-EpiDeploymentPackageLocation @getEpiDeploymentPackageLocationSplat
    
    # Upload the package                                                                   
    Add-EpiDeploymentPackage -SasUrl $packageLocation -Path $resolvedPackagePath.FullName
    Write-Host "Package Uploaded"
    
    $startEpiDeploymentSplat = @{
        DeploymentPackage = $resolvedPackagePath.Name
        ProjectId = "$projectid"
        Wait = $true
        TargetEnvironment = "$targetEnvironment"
        DirectDeploy = $true
        ClientSecret = "$clientsecret"
        ClientKey = "$clientkey"    
    }
    
    # Deploy package to environment. This will first build a docker image out of the package and then deploy it to the target environment.
    $deploy = Start-EpiDeployment @startEpiDeploymentSplat
    Write-Host "Deployment Complete"
    Write-Host $deploy.id
  3. And the deployment works. I dont see any errors. BUT, the site doesnt work. I have not yet set up any custom host names, so I can use .azurewebsites.net url or the CDN url and in both cases I get:

    :( Application Error

    And looking at the Azure logs:

    2022-09-20T00:28:27.720Z INFO  - Initiating warmup request to container ruen01mstr1zps6inte__fc3a_0_18c1e694_msiProxy for site ruen01mstr1zps6inte__fc3a
    2022-09-20T00:28:27.751Z INFO  - Container ruen01mstr1zps6inte__fc3a_0_18c1e694_msiProxy for site ruen01mstr1zps6inte__fc3a initialized successfully and is ready to serve requests.
    2022-09-20T00:28:27.752Z INFO  - Initiating warmup request to container ruen01mstr1zps6inte__fc3a_0_18c1e694 for site ruen01mstr1zps6inte__fc3a
    2022-09-20T00:28:28.786Z ERROR - Container ruen01mstr1zps6inte__fc3a_0_18c1e694 for site ruen01mstr1zps6inte__fc3a has exited, failing site start
    2022-09-20T00:28:28.791Z ERROR - Container ruen01mstr1zps6inte__fc3a_0_18c1e694 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
    2022-09-20T00:28:28.799Z INFO  - Stopping site ruen01mstr1zps6inte__fc3a because it failed during startup.
    2022-09-20T00:33:25.505Z INFO  - Pulling image: ruen01mstr1zps6.azurecr.io/cms:myproject.cms.app.177.nupkg
    2022-09-20T00:33:26.765Z INFO  - myproject.cms.app.177.nupkg Pulling from cms
    2022-09-20T00:33:26.766Z INFO  -  Digest: sha256:fc16edcc97ed322ee68e0d902ca7f9396895278a7b868a152d000c3415c302a3
    2022-09-20T00:33:26.767Z INFO  -  Status: Image is up to date for ruen01mstr1zps6.azurecr.io/cms:myproject.cms.app.177.nupkg
    2022-09-20T00:33:26.770Z INFO  - Pull Image successful, Time taken: 0 Minutes and 1 Seconds
    2022-09-20T00:33:26.790Z INFO  - Starting container for site
    2022-09-20T00:33:26.791Z INFO  - docker run -d -p 5615:80 --name ruen01mstr1zps6inte__fc3a_0_c581b4c0 -e WEBSITE_SITE_NAME=ruen01mstr1zps6inte -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=ruen01mstr1zps6inte.azurewebsites.net -e WEBSITE_INSTANCE_ID=9b8d906b23c6e694e85ffaf0e963ef57d474af3bda672fab4fca2748bb070d68 -e HTTP_LOGGING_ENABLED=1 -e NODE_OPTIONS=--require /agents/node/build/src/Loader.js -e JAVA_TOOL_OPTIONS=-javaagent:/agents/java/applicationinsights-agent-codeless.jar -e StartupBootstrapper=Microsoft.ApplicationInsights.StartupBootstrapper -e DOTNET_SHARED_STORE=/agents/core/store/lin -e DOTNET_ADDITIONAL_DEPS=/agents/core/additionalDeps -e WEBSITE_USE_DIAGNOSTIC_SERVER=False ruen01mstr1zps6.azurecr.io/cms:myproject.cms.app.177.nupkg  

    I need to find some more detail about why it wont start? How do I get the logs for the actual site? As opposed to just Docker logs.
#287715
Edited, Sep 20, 2022 12:28
Vote:
 

Log into PaasPortal: https://paasportal.episerver.net/

Click the troubleshoot tab

Clicky the application logs, stream or download. Maybe there's a clue in there.

#287717
Sep 20, 2022 12:52
Vote:
 

Potentially your archive is not in the correct structure

If you can setup Azure Pipelines, I created a very basic YML script here to publish to Integration 

Azure DevOps build pipeline for CMS 12 | Optimizely Developer Com 

#287799
Sep 21, 2022 14:34
Ethan Schofer - Sep 21, 2022 20:03
How do I establish what the correct structure should be?
Minesh Shah (Netcel) - Sep 21, 2022 21:47
myapp.cms.app.1.0.0.nupkg
wwwroot
appSettings.json
appSettings.Integration.json
appSettings.Preproduction.json
appSettings.Production.json
dxpPlatformSettings.json
myapp.dll
......
myapp.cms.app.nuspec (optional)

See here : https://docs.developers.optimizely.com/digital-experience-platform/v1.2.0-dxp-cloud-services/docs/code-package-format
Ethan Schofer - Sep 22, 2022 11:50
This is the package structure I am using.
Vote:
 

Do you have all the configuration correctly setup. You need to make sure you have

1. EPiServer.CloudPlatform.Cms and EPiServer.CloudPlatform.Commerce (if a commerce site) packages added

2. Calls in the startup to AddCmsCloudPlatformSupport / AddCommerceCloudPlatformSupport for these packages

3. Starup doing the default _configuration = configuration; in the constructor. When doing local development some change the way it loads config but you have to make sure it loads the default way e.g. this is an example of a working startup that has the appSetting loading for local but falls back for DXP to normal

        public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration)
        {
            _webHostingEnvironment = webHostingEnvironment;

            if (webHostingEnvironment.IsDevelopment())
            {
                var builder = new ConfigurationBuilder()
                    .SetBasePath(_webHostingEnvironment.ContentRootPath)
                    .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                    .AddJsonFile($"appsettings.{_webHostingEnvironment.EnvironmentName}.json", optional: true);
                _configuration = builder.Build();
            }
            else
            {
                _configuration = configuration;
            }
            SetStaticOptions();
        }

4. Empty Events/Blobs sections setup in the appSettings e.g

  "ConnectionStrings": {
    "EPiServerDB": "",
    "EcfSqlConnection": "",
    "EPiServerAzureBlobs": "",
    "EPiServerAzureEvents": ""
  },

5. Make sure you have a default wildcard binding in the site configuration section

#287804
Edited, Sep 21, 2022 15:47
Ethan Schofer - Sep 21, 2022 21:20
So I did these things and Im still having the problem. The site wont start.
Vote:
 

also in your logs it's showing your client's name just incase you want to blat it out :p

#287805
Sep 21, 2022 15:48
Ethan Schofer - Sep 21, 2022 20:04
Face Palm
Vote:
 

Also although Surjit mentioned the pass portal error logs, since the change of the docker structure with Linux on .NET 5/6 some infrastructure error messages from Docker don't show there but you can see them by going in to the direct logs on the app service in Azure. This helped me troubleshoot a lot

#287811
Edited, Sep 21, 2022 15:56
Vote:
 

I'd like to make another suggestion. How have you verified the deployment was completed successfully? When you mentioned you didn't see any errors, is that watching the output of the powershell script?

I had a couple of issues i needed to resolve and they were only showing up in paasportal on the deployment log (Deployment tab -> Recent Deployments section at the bottom of the page).

This is an example of an error appearing when you misname your package:

Example of a successful deployment:

#287878
Sep 22, 2022 0:17
Ethan Schofer - Sep 22, 2022 11:51
No errors appear here. I get a warning about needing the Commerce dll, but the site isnt a commerce site.
Surjit Bharath - Sep 22, 2022 11:57
You shouldn't be seeing any warnings o_O

Can you share a screenshot of it? Scrub out any references to the client name.
Minesh Shah (Netcel) - Sep 22, 2022 12:01
Also I would suggest raising a support ticket as could be a provisioning issue
Ethan Schofer - Sep 22, 2022 14:33
Ive had a support ticket around this for some time. I finally was able to get a better error message. I think I know the issue, but am trying to confirm for real. Ill post the answer here once I get a final answer.
Surjit Bharath - Sep 27, 2022 22:13
Ethan, what was the answer?
Vote:
 

Hi

If you don't see any error within PaaS portal deployment log section, it means your deployment went into successfully. From your log, it seems your application fails to start that caused the container exit. There could be many causes for application failed to start in DXP. Typical ones I've seen so far are around case-sensitive literal and config transformation issue.

The safest way to test this is run your app in either docker or WSL first to see if there is any error. I hope this helps. 

#287976
Edited, Sep 23, 2022 8:08
Vote:
 

Ethan, did you look at the application log files, as suggested by Scott?

#288167
Sep 27, 2022 13:02
Vote:
 

There were multiple factors causing this issue:

  1. When I first created the site, using the CLI, it gave the user related tables, aspnetuser, aspnetrole, etc... a custom sql schema. Locally this didnt matter but something about the Azure environment, this really didnt work, it couldnt find the table with users.
  2. I was missing some config values - they were in appsettings.Develop.json, but not appsettings.Integration.json. This was causing an error that prevented the site from starting.
  3. Logging - and this is where I am the least sure of the actual cause, but because logging wasnt working, I couldnt see any error messages related to numbers 1 or 2. What it comes down to I think is that I needed to use the most basic Host.CreateDefaultBuilder I can for the Integration environment, and keep anything custom I wanted to local work (Like console logging) completeley separate.
if (isDevelopment)
{
	//Development configuration can be addded here, like local logging.
	return Host.CreateDefaultBuilder(args)
		.ConfigureCmsDefaults()
		.ConfigureWebHostDefaults(webBuilder =>
		{
			webBuilder.UseStartup<Startup>();
		}).ConfigureLogging((context, logging) =>
		{
			logging.ClearProviders();
			var loggingSection = context.Configuration.GetSection("Logging");
			logging.AddConfiguration(loggingSection);

			logging.AddDebug();
			logging.AddConsoleFormatter<PlainConsoleFormatter, PlainConsoleFormatterOptions>();
			logging.AddConsole(options => options.FormatterName = nameof(PlainConsoleFormatter));

			logging.AddFile(loggingSection, options =>
			{
			   options.FormatLogFileName = fileName =>
				   string.Format(CultureInfo.InvariantCulture, fileName, DateTime.Now);
			   options.FormatLogEntry = (msg) =>
			   {
				   var sb = new System.Text.StringBuilder();
				   var sw = new StringWriter(sb);
				   var jsonWriter = new Newtonsoft.Json.JsonTextWriter(sw);
				   jsonWriter.WriteStartArray();
				   jsonWriter.WriteValue(DateTime.Now.ToString("o"));
				   jsonWriter.WriteValue(msg.LogLevel.ToString().ToUpper(CultureInfo.CurrentCulture));
				   jsonWriter.WriteValue(msg.LogName);
				   jsonWriter.WriteValue(msg.EventId.Id);
				   jsonWriter.WriteValue(msg.Message);
				   jsonWriter.WriteValue(msg.Exception?.ToString());
				   jsonWriter.WriteEndArray();
				   return sb.ToString();
			   };
			});
		});
}
else
{
	return Host.CreateDefaultBuilder(args)
		.ConfigureCmsDefaults()
		.ConfigureWebHostDefaults(webBuilder =>
		{
			webBuilder.UseStartup<Startup>();
		});
}
#288676
Oct 05, 2022 11:52
Linda Mohacsi - Sep 20, 2023 9:40
Thank you so much for posting the cause and solution. It really helped me when I had the same situation.
Vote:
 

Ethan, glad your problem got resolved but more importantly for the forum, thanks for taking the time to write the solution you found!

#288677
Oct 05, 2022 12:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.