Interesting Docker error in XM Cloud introduction Project

Scenario:

While trying to up.ps1 in case of XM Cloud Introduction project, CM container doesn't start and times-out after a long wait (prompt error and log error below). The issue; Sitecore admin password wasn't present in .env file. Although the readme page specifies the syntax for init.ps1, unfortunately, it isn't a mandatory param in init.ps1. Also, the existing XM Cloud project is now dependent on OKTA login and XM-based Sitecore identity server login (for which the Sitecore password is usually used) is irrelevant now. So, the Sitecore password param is of least significance at least for user login but useful in container startup since it is used in docker compose file. So, if you forget the admin password param, this falls through gaps and fails only while starting the CM container. How costly! So, this Pull Request is a suggestion to provide a default value in .env.template similar to XMCloud Foundation head project so that docker compose file can pass on this value to startup the CM container. Plus, init.ps1 just needs license file path as the only mandatory param and doesn't need the Sitecore password param since it is not mandatory anymore. In case if this  Pull Request isn't approved or merged and in future, you receive the following error that means you haven't provided Sitecore admin password param as part of init.ps1! In other words, .env file doesn’t have value for Sitecore_Admin_Password variable.

Docker compose file for reference:



Suggested .env.template with default value:


Cmd Prompt error:

C:\projects\XM-Cloud-Introduction\up.ps1 : Timeout waiting for Sitecore CM to become available via Traefik proxy.

Check CM container logs.

At line:1 char:1

+ .\up.ps1

+ ~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,up.ps1



Docker Error:

2024-07-17 11:15:10 Error Number:4060,State:1,Class:11 

2024-07-17 11:15:10  Error code:

2024-07-17 11:15:10  4060: Cannot open database "Sitecore.Master" requested by the login. The login failed..

2024-07-17 11:15:10 18456: Login failed for user 'sa'..

2024-07-17 11:15:10 

2024-07-17 11:15:10  940 11:14:45 WARN  sql error in retryer. System.Data.SqlClient.SqlException (0x80131904): Cannot open database "Sitecore.Master" requested by the login. The login failed.

2024-07-17 11:15:10 Login failed for user 'sa'.

2024-07-17 11:15:10    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)

2024-07-17 11:15:10    at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)

2024-07-17 11:15:10    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)

2024-07-17 11:15:10    at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)

2024-07-17 11:15:10    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)

2024-07-17 11:15:10    at System.Data.SqlClient.SqlConnection.Open()

2024-07-17 11:15:10    at Sitecore.Data.DataProviders.Sql.DataProviderCommand..ctor(IDbCommand command, DataProviderTransaction transaction, Boolean openConnection)

2024-07-17 11:15:10    at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass29_0.<CreateCommandEx>b__0()

2024-07-17 11:15:10    at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)

2024-07-17 11:15:10    at Sitecore.Data.DataProviders.TransientRetryer.Execute[T](Func`1 action, Action recover)

2024-07-17 11:15:10    at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass33_0.<CreateReaderEx>b__0()

2024-07-17 11:15:10    at Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)

2024-07-17 11:15:10    at Sitecore.Data.DataProviders.TransientRetryer.Execute[T](Func`1 action, Action recover)

2024-07-17 11:15:10 ClientConnectionId:dc3b32ee-6939-4dbc-a652-be0894f44446

2024-07-17 11:15:10 Error Number:4060,State:1,Class:11 

2024-07-17 11:15:10  Error code:

2024-07-17 11:15:10  4060: Cannot open database "Sitecore.Master" requested by the login. The login failed..

2024-07-17 11:15:10 18456: Login failed for user 'sa'..

2024-07-17 11:15:10 

2024-07-17 11:15:10 2852 11:14:55 INFO  **************************************************

2024-07-17 11:15:10 2852 11:14:55 WARN  Sitecore shutting down

2024-07-17 11:15:10 2852 11:14:55 WARN  Shutdown message: Initialization Error



Comments

Popular Posts