Hi,
We are trying to upgrade from 2020.6.4855 to 2021.1.7500 but have run into an issue where the upgraded container cannot connect to the external database. I exec
into the pod and have confirmed that the connection string is still the same, master key has not changed. When I rollback to 2020.6.4855 it connects again without any problems. I spoke to the DB admins and they are not sure what could be blocking the connections. Has something changed in the script which tests the DB connection? I looked at the install.sh
script but was unable to find where the connection is tested. It only checks the master key.
The error we see is:
======== Initializing DB ========
Using supplied Master Key
Setting master key
Setting database connection string to: server=SERVER_ADDRESS;database=T_OCTOPUS;user=Octopus_Admin;password=********
========== SQL Database Connection Details ========
SQL Server: SERVER_ADDRESS
SQL Database: T_OCTOPUS
Authentication Type: SQL Server Credentials
User: Octopus_Admin
===================================================
Testing connection to the 'master' database...
Connection test to master timed out after trying 17 times over 00:01:00.9699846.
Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Octopus.Core.RelationalStorage.SqlServerManager.TestConnection(Boolean throwException, String databaseName, Nullable`1 timeout) in /opt/buildagent/work/c42ca9d2b8233f1c/source/Octopus.Core/RelationalStorage/SqlServerManager.cs:line 326
ClientConnectionId:00000000-0000-0000-0000-000000000000
We are having trouble working with your SQL Database. This will usually be something you can fix. If not please contact support@octopus.com for help. Here are the error details: SQL Error 0 - A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)
Microsoft.Data.SqlClient.SqlException
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
at Octopus.Core.RelationalStorage.SqlServerManager.TestConnection(Boolean throwException, String databaseName, Nullable`1 timeout) in SqlServerManager.cs:line 326
at Octopus.Core.RelationalStorage.SqlServerManager.TestConnection(Boolean throwException, String databaseName, Nullable`1 timeout) in SqlServerManager.cs:line 346
at Octopus.Server.Commands.DatabaseCommand.Start() in DatabaseCommand.cs:line 110
When we rollback we see a successful connection:
======== Initializing DB ========
Using supplied Master Key
Setting master key
Setting database connection string to: server=SERVER_ADDRESS;database=T_OCTOPUS;user=Octopus_Admin;password=********
========== SQL Database Connection Details ========
SQL Server: SERVER_ADDRESS
SQL Database: T_OCTOPUS
Authentication Type: SQL Server Credentials
User: Octopus_Admin
===================================================
Testing connection to the 'master' database...
Successfully connected to 'master' database!
Database 'T_OCTOPUS' already exists on SQL Server at 'SERVER_ADDRESS, no need to create it.
Checking the Octopus Master Key has been configured.
The DB admins only said that connecting to the master db shouldn’t happen as this user has no access there but it works on 2020.6.4855.
Thanks for the assistance.
Kind Regards,
Ian