gaseous-project / gaseous-server

A game ROM manager, with a built in web based emulator using multiple sources to identify and provide metadata
GNU Affero General Public License v3.0
238 stars 9 forks source link

Unable to spin up a fresh instance using docker with either MariaDB or MySQL #217

Open gazoscalvertos opened 7 months ago

gazoscalvertos commented 7 months ago

Describe the bug Unable to spin up a fresh instance using docker with either MariaDB or MySQL

Log:


gaseous-server  | {
gaseous-server  |   "DatabaseConfiguration": {
gaseous-server  |     "HostName": "gsdb",
gaseous-server  |     "UserName": "root",
gaseous-server  |     "Password": "gaseous",
gaseous-server  |     "DatabaseName": "gaseous",
gaseous-server  |     "Port": 3306
gaseous-server  |   },
gaseous-server  |   "IGDBConfiguration": {
gaseous-server  |     "ClientId": "",
gaseous-server  |     "Secret": ""
gaseous-server  |   },
gaseous-server  |   "LoggingConfiguration": {
gaseous-server  |     "DebugLogging": false,
gaseous-server  |     "LogRetention": 7
gaseous-server  |   }
gaseous-server  | }
gaseous-server  | 20231204 124809: Information: Startup: Waiting for database...
gaseous-server  | 
gaseous-server  | 20231204 124840: Information: Database: Creating database if it doesn't exist
gaseous-server  | 
gaseous-server  | Unhandled exception. System.InvalidCastException: Object cannot be cast from DBNull to other types.
gaseous-server  |    at System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider)
gaseous-server  |    at MySql.Data.MySqlClient.Driver.LoadCharacterSetsAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.Driver.ConfigureAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.MySqlConnection.Open()
gaseous-server  |    at gaseous_tools.Database.MySQLServerConnector.ExecCMD(String SQL, Dictionary`2 Parameters, Int32 Timeout) in /App/gaseous-tools/Database.cs:line 253
gaseous-server  |    at gaseous_tools.Database._ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 158
gaseous-server  |    at gaseous_tools.Database.ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 148
gaseous-server  |    at gaseous_tools.Database.InitDB() in /App/gaseous-tools/Database.cs:line 69
gaseous-server  |    at Program.<Main>$(String[] args) in /App/gaseous-server/Program.cs:line 33
gsdb            | 2023-12-04 12:48:40 12 [Warning] Aborted connection 12 to db: 'unconnected' user: 'root' host: '192.168.48.3' (Got an error reading communication packets)
gaseous-server exited with code 0
gaseous-server  | 20231204 124843: Information: Startup: Starting Gaseous Server 1.6.1.0
gaseous-server  | 
gaseous-server  | Using configuration:
gaseous-server  | {
gaseous-server  |   "DatabaseConfiguration": {
gaseous-server  |     "HostName": "gsdb",
gaseous-server  |     "UserName": "root",
gaseous-server  |     "Password": "gaseous",
gaseous-server  |     "DatabaseName": "gaseous",
gaseous-server  |     "Port": 3306
gaseous-server  |   },
gaseous-server  |   "IGDBConfiguration": {
gaseous-server  |     "ClientId": "",
gaseous-server  |     "Secret": ""
gaseous-server  |   },
gaseous-server  |   "LoggingConfiguration": {
gaseous-server  |     "DebugLogging": false,
gaseous-server  |     "LogRetention": 7
gaseous-server  |   }
gaseous-server  | }
gaseous-server  | 20231204 124843: Information: Startup: Waiting for database...
gaseous-server  | 
gaseous-server  | 20231204 124914: Information: Database: Creating database if it doesn't exist
gaseous-server  | 
gaseous-server  | Unhandled exception. System.InvalidCastException: Object cannot be cast from DBNull to other types.
gaseous-server  |    at System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider)
gaseous-server  |    at MySql.Data.MySqlClient.Driver.LoadCharacterSetsAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.Driver.ConfigureAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)
gaseous-server  |    at MySql.Data.MySqlClient.MySqlConnection.Open()
gaseous-server  |    at gaseous_tools.Database.MySQLServerConnector.ExecCMD(String SQL, Dictionary`2 Parameters, Int32 Timeout) in /App/gaseous-tools/Database.cs:line 253
gaseous-server  |    at gaseous_tools.Database._ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 158
gaseous-server  |    at gaseous_tools.Database.ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 148
gaseous-server  |    at gaseous_tools.Database.InitDB() in /App/gaseous-tools/Database.cs:line 69
gaseous-server  |    at Program.<Main>$(String[] args) in /App/gaseous-server/Program.cs:line 33
gsdb            | 2023-12-04 12:49:14 14 [Warning] Aborted connection 14 to db: 'unconnected' user: 'root' host: '192.168.48.3' (Got an error reading communication packets)
gaseous-server exited with code 0
jpcapone commented 7 months ago

I have the same issue. Any suggestions?

michael-j-green commented 7 months ago

Hi @gazoscalvertos; just wanted to check if you're still experiencing this issue?

jpcapone commented 7 months ago

Hi @gazoscalvertos; just wanted to check if you're still experiencing this issue?

I haven't tried it in a while. I could try and give it a shot if that issue has been resolved. What do you think?

michael-j-green commented 7 months ago

Hi @gazoscalvertos; just wanted to check if you're still experiencing this issue?

I haven't tried it in a while. I could try and give it a shot if that issue has been resolved. What do you think?

If you have Discord, come on over to our server and I'll be happy to help.

If not, please send me your docker-compose.yml (remember to redact your IGDB credentials though).

jpcapone commented 7 months ago

Hi @gazoscalvertos; just wanted to check if you're still experiencing this issue?

I haven't tried it in a while. I could try and give it a shot if that issue has been resolved. What do you think?

If you have Discord, come on over to our server and I'll be happy to help.

If not, please send me your docker-compose.yml (remember to redact your IGDB credentials though).

Hey I am over there. jpcapone

michael-j-green commented 7 months ago

Hi @gazoscalvertos; just wanted to check if you're still experiencing this issue?

I haven't tried it in a while. I could try and give it a shot if that issue has been resolved. What do you think?

If you have Discord, come on over to our server and I'll be happy to help. If not, please send me your docker-compose.yml (remember to redact your IGDB credentials though).

Hey I am over there. jpcapone

I know... I was replying to @gazoscalvertos 😀

InputObject2 commented 7 months ago

Hey, same issue here with mariadb, completely fresh install. Using kubernetes in my case with a mariadb provisionned bythe mariadb-operator.

Which shows me this on startup (before crashing with the dbnull issue:

{
  "DatabaseConfiguration": {
    "HostName": "shared-cluster-primary.database.svc.cluster.local",
    "UserName": "gaseous",
    "Password": "<good database password>",
    "DatabaseName": "gaseous",
    "Port": 3306
  },
  "IGDBConfiguration": {
    "ClientId": "<good client id>",
    "Secret": "<good client secret>"
  },
  "LoggingConfiguration": {
    "DebugLogging": false,
    "LogRetention": 7
  }
}

Error logs in gaseous:

20231224 204928: Information: Startup: Waiting for database...
2023-12-24T20:49:28.540667040Z
20231224 204958: Information: Database: Creating database if it doesn't exist
2023-12-24T20:49:58.776876128Z
Unhandled exception. System.InvalidCastException: Object cannot be cast from DBNull to other types.
   at System.DBNull.System.IConvertible.ToInt32(IFormatProvider provider)
   at MySql.Data.MySqlClient.Driver.LoadCharacterSetsAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
   at MySql.Data.MySqlClient.Driver.ConfigureAsync(MySqlConnection connection, Boolean execAsync, CancellationToken cancellationToken)
   at MySql.Data.MySqlClient.MySqlConnection.OpenAsync(Boolean execAsync, CancellationToken cancellationToken)
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at gaseous_tools.Database.MySQLServerConnector.ExecCMD(String SQL, Dictionary`2 Parameters, Int32 Timeout) in /App/gaseous-tools/Database.cs:line 253
   at gaseous_tools.Database._ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 158
   at gaseous_tools.Database.ExecuteCMD(String Command, Dictionary`2 Parameters, Int32 Timeout, String ConnectionString) in /App/gaseous-tools/Database.cs:line 148
   at gaseous_tools.Database.InitDB() in /App/gaseous-tools/Database.cs:line 69
   at Program.<Main>$(String[] args) in /App/gaseous-server/Program.cs:line 33

Mariadb logs only show:

2023-12-24 20:53:05 90901 [Warning] Aborted connection 90901 to db: 'unconnected' user: 'gaseous' host: '10.1.250.159' (Got an error reading communication packets)
2023-12-24 20:53:05 90894 [Warning] Aborted connection 90894 to db: 'gaseous' user: 'gaseous' host: '10.1.250.159' (Got an error reading communication packets)

Could gaseous need mysql root server admin credentials and not just database admin?

michael-j-green commented 7 months ago

Hey, it's Christmas Day here, so I won't be able to reply too much for a day or two, but Gaseous expects enough permissions on startup to create the database and provision tables within.

In a standard docker compose deployment, we normally just give it root since it has the entire db instance to itself.

You could try temporarily granting the user account root access to let it create the db as after first start up it doesn't require such advanced permissions (reminder to self to create an environment variable to bypass database creation if in a shared or custom environment). It will still need permissions to create and alter tables and views though as it applies schema updates on start up.

Which version of the image did you pull? If 1.6.1, I'd suggest only using MySql. If using the previews, only use 1.7.0-preview.6. It supports both MySql and MariaDB (preferred).

Be aware that the 1.7.0 previews are very much a work in progress, but should be stable enough to use.

InputObject2 commented 7 months ago

Hey thanks for the super quick answer!

Which version of the image did you pull? If 1.6.1, I'd suggest only using MySql. If using the previews, only use 1.7.0-preview.6. It supports both MySql and MariaDB (preferred).

I was using tag latest (e11d0ba49abc) which is v1.6.1.

I tried with the v1.7.0-preview6 and the Mariadb support seems to have completely solved this!

Thanks for the hint!

michael-j-green commented 7 months ago

Hey thanks for the super quick answer!

Which version of the image did you pull? If 1.6.1, I'd suggest only using MySql. If using the previews, only use 1.7.0-preview.6. It supports both MySql and MariaDB (preferred).

I was using tag latest (e11d0ba49abc) which is v1.6.1.

I tried with the v1.7.0-preview6 and the Mariadb support seems to have completely solved this!

Thanks for the hint!

That’s great to hear! Glad you’re up and running.

1.7.0 implements a different database connector than 1.6.1 and earlier, which allows for MariaDB support (prior versions used some MySQL specific features which were removed in 1.7.0).

I’m hoping to have a full 1.7.0 release by the end of January, so you can flip the docker tag back to latest when that’s released :)

Hope you have an awesome Christmas!

michael-j-green commented 5 months ago

Hi, just wanted to check to see if this was still an issue?