Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BW_DB_PROVIDER=mysql does not seem to be taken into account #2521

Closed
1 task done
haraldinho2000 opened this issue Dec 27, 2022 · 1 comment
Closed
1 task done

BW_DB_PROVIDER=mysql does not seem to be taken into account #2521

haraldinho2000 opened this issue Dec 27, 2022 · 1 comment
Labels
bug bw-unified-deploy An Issue related to Bitwarden unified deployment

Comments

@haraldinho2000
Copy link

Steps To Reproduce

When I start a new instance of the container using the settings.env file, the setting BW_DB_PROVIDER=mysql seems to be ignored and replaced with the default SQL Server provider.

BTW: I am not sure from the documentation if I should use "mysql/mariadb", "mysql" or "mariadb" (from the sample .env file I took that mysql should at lease be supported).

Snippet from my settings:

`
#####################

Required Settings

#####################

Server hostname

BW_DOMAIN=bitwarden.mydomain.lan

Database

Available providers are sqlserver, postgresql, mysql/mariadb, or sqlite

BW_DB_PROVIDER=mysql
BW_DB_SERVER=mariadb.mydomain.lan
BW_DB_DATABASE=bitwarden_vault
BW_DB_USERNAME=bitwarden
`

Expected Result

I would expect a proper connection to my MySQL (MariaDB) database, or a descriptive error that at least refers to MySQL instead of referring to SQL Server.

Actual Result

Logging from admin.log, referring to SQL Server instead of MySQL

2022-12-27 22:01:14.397 +00:00 [INF] Migrating database. 2022-12-27 22:01:29.141 +00:00 [ERR] Database unavailable for migration. Trying again (attempt #2)... System.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 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Bit.Migrator.SqlServerDbMigrator.MigrateDatabase(Boolean enableLogging, CancellationToken cancellationToken) in /source/util/Migrator/SqlServerDbMigrator.cs:line 49
at Bit.Admin.HostedServices.DatabaseMigrationHostedService.StartAsync(CancellationToken cancellationToken) in /source/src/Admin/HostedServices/DatabaseMigrationHostedService.cs:line 29
ClientConnectionId:00000000-0000-0000-0000-000000000000
`

Screenshots or Videos

No response

Additional Context

No response

Githash Version

N/A

Environment Details

Docker 20.10.3 on Synology NAS
DEV version of Self-hosted

Database Image

MariaDB 10.10.2 on Docker

Issue-Link

#2480

Issue Tracking Info

  • I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@haraldinho2000 haraldinho2000 added bug bw-unified-deploy An Issue related to Bitwarden unified deployment labels Dec 27, 2022
@haraldinho2000
Copy link
Author

PBKAC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bw-unified-deploy An Issue related to Bitwarden unified deployment
Projects
None yet
Development

No branches or pull requests

1 participant