nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
131 stars 92 forks source link

nwnx connection to mysql database #78

Closed diavlen closed 6 years ago

diavlen commented 6 years ago

I've been at this all day. Trying to get nwnx to work with MySQL. At this point, I think I'm the closest I've been..I'm using the latest docker image from Glorwinger. It seems to be fine, except it cannot connect to the mysql server. I've verified that the mysql server is running, and I can connect to it. Could this be because the path to the mysql socket doesn't exist within the docker image? If so, how can I make the docker image look in the right location? Any insight? Here's what the output of docker looks like:

`/var/nwn_ee$ docker run --rm -it -p 5121:5121 -p 5121:5121/udp --env-file docker_env.ini -v $(pwd):/nwn/home nwnxee/nwserver:8164[] Copying any custom NWNX plugins '/nwn/home/nwnx/NWNX_Administration.so' -> '/nwn/nwnx/NWNX_Administration.so' '/nwn/home/nwnx/NWNX_BehaviourTree.so' -> '/nwn/nwnx/NWNX_BehaviourTree.so' '/nwn/home/nwnx/NWNX_Chat.so' -> '/nwn/nwnx/NWNX_Chat.so' '/nwn/home/nwnx/NWNX_Core.so' -> '/nwn/nwnx/NWNX_Core.so' '/nwn/home/nwnx/NWNX_Creature.so' -> '/nwn/nwnx/NWNX_Creature.so' '/nwn/home/nwnx/NWNX_Data.so' -> '/nwn/nwnx/NWNX_Data.so' '/nwn/home/nwnx/NWNX_Events.so' -> '/nwn/nwnx/NWNX_Events.so' '/nwn/home/nwnx/NWNX_Item.so' -> '/nwn/nwnx/NWNX_Item.so' '/nwn/home/nwnx/NWNX_JVM.so' -> '/nwn/nwnx/NWNX_JVM.so' '/nwn/home/nwnx/NWNX_Metrics_InfluxDB.so' -> '/nwn/nwnx/NWNX_Metrics_InfluxDB.so' '/nwn/home/nwnx/NWNX_Object.so' -> '/nwn/nwnx/NWNX_Object.so' '/nwn/home/nwnx/NWNX_Player.so' -> '/nwn/nwnx/NWNX_Player.so' '/nwn/home/nwnx/NWNX_Profiler.so' -> '/nwn/nwnx/NWNX_Profiler.so' '/nwn/home/nwnx/NWNX_Redis.so' -> '/nwn/nwnx/NWNX_Redis.so' '/nwn/home/nwnx/NWNX_Ruby.so' -> '/nwn/nwnx/NWNX_Ruby.so' '/nwn/home/nwnx/NWNX_SQL.so' -> '/nwn/nwnx/NWNX_SQL.so' '/nwn/home/nwnx/NWNX_ServerLogRedirector.so' -> '/nwn/nwnx/NWNX_ServerLogRedirector.so' '/nwn/home/nwnx/NWNX_ThreadWatchdog.so' -> '/nwn/nwnx/NWNX_ThreadWatchdog.so' '/nwn/home/nwnx/NWNX_Time.so' -> '/nwn/nwnx/NWNX_Time.so' '/nwn/home/nwnx/NWNX_Tracking.so' -> '/nwn/nwnx/NWNX_Tracking.so' [] Linking in user home '/nwn/run/database' -> '/nwn/home/database' '/nwn/run/hak' -> '/nwn/home/hak' '/nwn/run/modules' -> '/nwn/home/modules' '/nwn/run/override' -> '/nwn/home/override' '/nwn/run/portraits' -> '/nwn/home/portraits' '/nwn/run/saves' -> '/nwn/home/saves' '/nwn/run/servervault' -> '/nwn/home/servervault' '/nwn/run/tlk' -> '/nwn/home/tlk' '/nwn/run/dialog.tlk' -> '/nwn/home/dialog.tlk' '/nwn/run/dialogf.tlk' -> '/nwn/home/dialogf.tlk' [] Importing configuration [] Port: 5121/udp Neverwinter Nights Server Build:8164 Copyright BioWare Corp 1998-2004 Registering crash signal handlers.

Server: Loading... I [03:19:21] [NWNXCore.cpp:184] NWNX_Core: Loading plugins from: /nwn/nwnx/ I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Administration due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_BehaviourTree due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Chat due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Creature due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Data due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Events due to configuration. D [03:19:21] [NWNXCore.cpp:218] NWNX_Core: Loading plugin NWNX_Item.so I [03:19:21] [NWNXCore.cpp:221] NWNX_Core: Loaded plugin 0 (Item) v2 by Various / sherincall / Bhaal. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_JVM due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Metrics_InfluxDB due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Object due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Player due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Profiler due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Redis due to configuration. I [03:19:21] [NWNXCore.cpp:212] NWNX_Core: Skipping plugin NWNX_Ruby due to configuration. D [03:19:21] [NWNXCore.cpp:218] NWNX_Core: Loading plugin NWNX_SQL.so I [03:19:21] [SQL.cpp:81] NWNX_SQL: Connecting to type MYSQL I [03:19:21] [MySQL.cpp:34] NWNX_SQL: Connection info: host=localhost username=nwn D [03:19:21] [MySQL.cpp:35] NWNX_SQL: : password=SJ--------------------Q E [03:19:21] [NWNXCore.cpp:226] NWNX_Core: Failed to load plugin (NWNX_SQL.so) because 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")'. F [03:19:21] [NWNXCore.cpp:353] NWNX_Core: The server encountered a fatal error 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")' during setup and must now terminate. We just crashed hard. :( Sorry about that. But you can help us fix this! Please consider reporting this crash at http://redmine.beamdog.com with the relevant information attached.

A log file has been written to /nwn/run/nwserver-crash-1521429561.log containing further diagnostic information. /nwn/run-server.sh: line 63: 19 Aborted (core dumped) LD_PRELOAD=$NWN_LD_PRELOAD LD_LIBRARY_PATH=$NWN_LD_LIBRARY_PATH ./nwserver-linux $NWN_EXTRA_ARGS -port ${NWN_PORT:-5121} -interactive -servername "${NWN_SERVERNAME:-I was too lazy to configure my server.}" -module "${NWN_MODULE:-DockerDemo}" -publicserver "${NWN_PUBLICSERVER:-0}" -maxclients "${NWN_MAXCLIENTS:-96}" -minlevel "${NWN_MINLEVEL:-1}" -maxlevel "${NWN_MAXLEVEL:-40}" -pauseandplay "${NWN_PAUSEANDPLAY:-1}" -pvp "${NWN_PVP:-2}" -servervault "${NWN_SERVERVAULT:-1}" -elc "${NWN_ELC:-1}" -ilr "${NWN_ILR:-1}" -gametype "${NWN_GAMETYPE:-0}" -oneparty "${NWN_ONEPARTY:-0}" -difficulty "${NWN_DIFFICULTY:-3}" -autosaveinterval "${NWN_AUTOSAVEINTERVAL:-0}" -playerpassword "${NWN_PLAYERPASSWORD}" -dmpassword "${NWN_DMPASSWORD}" -adminpassword "${NWN_ADMINPASSWORD}" -reloadwhenempty "${NWN_RELOADWHENEMPTY:-0}" The server crashed with return code 134. Trying to save crash data into your mounted server home. '/nwn/run/nwserver-crash-1521429561.log' -> '/nwn/home/nwserver-crash-1521429561.log'`

NWNX_SQL_TYPE=MYSQL NWNX_SQL_HOSTNAME=localhost NWNX_SQL_USERNAME=nwn NWNX_SQL_PASSWORD=SJ--------------------Q

kmsheehan commented 6 years ago

Can you (or have you joined the Discord chat channel? I can help you correct the startup... https://discord.gg/SkEznc

diavlen commented 6 years ago

Well, after a night of sleeping on it, I've gotten a little further:

  1. I'm successfully connecting to the mysql server now. I had to bind it to any address (was localhost only)
  2. I had to change the variable setting in my env file. It was NWNX_SQL_HOSTNAME, and it should've been NWNX_SQL_HOST

Now, I'm having this error when the module loads. NWNXLib: SetLocalString encountered error 'Input string size mismatch.' for input 'ODBC!FETCH' and value '

I'll jump on discord in a bit...

kmsheehan commented 6 years ago

The main issue is that localhost inside a container IS the container... Assuming mysql is running on the Host server then you can do one of two things. 1. Add --net="host" then 127.0.0.1 will point to the host as then the container uses the host network not a docker created one. 2. Use the FQDN or real host IP of the server (and set mysql to allow logins) you can use --add-host hostname:IP

kmsheehan commented 6 years ago

Sorry - missed that you figured that out...