frandallfarmer / neohabitat

Repository for the NeoClassical Habitat Server Project
http://neohabitat.org
MIT License
229 stars 41 forks source link

Fix Docker build #440

Closed jeremypenner closed 7 months ago

jeremypenner commented 7 months ago

Addresses #437.

NodeSource has reinstated the deprecated installer scripts, but the NodeSource repo doesn't contain a packge for npm, and the CentOS package for npm conflicts with the NodeSource nodejs. Updated to use the nsolid package directly.

Also updated the habibots Dockerfile to use the latest node 18 image. Debian Bookworm transitioned the netcat package from one that installed netcat-openbsd to a "virtual package" which doesn't specify a preferred version. Changed it to specify netcat-openbsd explicitly.

StuBlad commented 7 months ago

I can confirm this has been tested in WSL2 with Docker Desktop and the neohabitat image now successfully builds and stands up. It still needs testing on other configs but this seems good.

I'm having an unrelated issue where I can't login with a pre-existing avatar, hatch a new avatar or log a bot inworld:


neohabitat-neohabitat-1         | error: Unable to find last Region context-hatchery for User: user-stu. Setting to Turf undefined.
neohabitat-neohabitat-1         | debug: Sending 'entercontext' to undefined on behalf of the Habitat client.
neohabitat-neohabitat-1         | debug: Processing Client message for Client 172.18.0.4:53734 (unknown): {"to":"session","op":"entercontext","user":"user-stu"}
neohabitat-neohabitat-1         | - 2024/01/27 03:57:08.019 MSG comm-cli : TCP(2) -> {"to":"session","op":"entercontext","user":"user-stu"}
neohabitat-neohabitat-1         | - 2024/01/27 03:57:08.078 ERR comm (RoutingActor.processMessage:RoutingActor.java:74) exception in message handler
neohabitat-neohabitat-1         | +-vvvv--
neohabitat-neohabitat-1         | + org.elkoserver.foundation.json.JSONInvocationException: expected parameter 'context' missing
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.json.Invoker.apply(Invoker.java:142)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.json.MethodInvoker.handle(MethodInvoker.java:77)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.json.MessageDispatcher.dispatchMessage(MessageDispatcher.java:170)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.actor.RefTable.dispatchMessage(RefTable.java:183)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.actor.RoutingActor.processMessage(RoutingActor.java:68)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.net.ConnectionBase$MessageHandlerThunk.run(ConnectionBase.java:100)
neohabitat-neohabitat-1         | +    org.elkoserver.foundation.run.Runner.run(Runner.java:215)
neohabitat-neohabitat-1         | +    java.lang.Thread.run(Thread.java:750)
neohabitat-neohabitat-1         | +-^^^^--
neohabitat-neohabitat-1         |
neohabitat-neohabitat-1         | - 2024/01/27 03:57:08.124 WRN comm (RoutingActor.processMessage:RoutingActor.java:83) error handling message: org.elkoserver.foundation.json.JSONInvocationException: expected parameter 'context' missing
neohabitat-neohabitat-1         | - 2024/01/27 03:57:08.135 MSG comm-cli : TCP(2) <- {"to":"error", "op":"debug", "msg":"error handling message: org.elkoserver.foundation.json.JSONInvocationException: expected parameter 'context' missing"}
neohabitat-neohabitat-1         | debug: Processing Server message for Client 172.18.0.4:53734 (unknown): {"to":"error","op":"debug","msg":"error handling message: org.elkoserver.foundation.json.JSONInvocationException: expected parameter 'context' missing"}
neohabitat-neohabitat-1         | debug: server (5) -> {"to":"error","op":"debug","msg":"error handling message: org.elkoserver.foundation.json.JSONInvocationException: expected parameter 'context' missing"}
neohabitat-neohabitat-1         | warn: Message from server headed to binary client not yet converted. IGNORED:```
StuBlad commented 7 months ago

RE: the problem I had in my previous comment, for some reason the object database hadn't built at all. After SSH'ing into the neohabitat container and running make clean in the db folder, I restarted everything and was able to successfully stand up the neohabitat server and log in! Great work @jeremypenner !

frandallfarmer commented 7 months ago

The test .js scripts no longer function with this PR:

randy@pop-os:~/try/neohabitat/test$ node Telko.js --help
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module 'winston'
Require stack:
- /home/randy/try/neohabitat/test/Telko.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/randy/try/neohabitat/test/Telko.js:32:17)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/randy/try/neohabitat/test/Telko.js' ]
}

JS package stuff is sensitive. I think code changes will be required to update packages to the latest supported.

jeremypenner commented 7 months ago

Hmm, it seems to run for me inside the container I changed, although the help text for Telko.js is now calling itself nsolid :/ What environment is this failing in? If it's your local clone, my change shouldn't have had any effect at all, and you probably just need to run npm install to bring in the necessary dependencies.

~/src/neohabitat/db$ docker exec -it neohabitat-neohabitat-1 bash                                                                                                                     
[root@505cc9958b3f neohabitat]# cd test/
[root@505cc9958b3f test]# node Telko.js --help
Usage: nsolid [options]

Options:
      --version  Show version number                                   [boolean]
  -?, --help     Get this usage/help information.                      [boolean]
  -t, --trace    Trace level name. (see: npm winston)         [default: "debug"]
  -c, --context  Parameter for entercontext if left unspecified.
                                                [default: "context-Downtown_5f"]
  -h, --host     Host name or address of the Elko server. [default: "127.0.0.1"]
  -p, --port     Port number for the Elko server.              [default: "1337"]
  -f, --files    Send a comma seperated list of Elko scripts [.elko optional] to
                 server. If unspecified, run in interactive (STDIN) mode.
  -e, --end      Ending script [.elko optional] to run after all the -f files
                 have been transmitted.                        [default: "quit"]
  -d, --delay    Time between packet sends in milliseconds. Usually overridden
                 in scripts.                                     [default: 2000]
  -l, --logtime  Add timestamp to log?                           [default: true]

Examples:
  nsolid                                    Connect to default Elko server in
                                            interactive (standard input) mode
                                            (paste/type json blocks) or type
                                            <[SCRIPT] to read lines from an
                                            [.elko] file.

  nsolid --files=start,more --end=stdin     Connect to the default Elko server
  --trace=debug                             in 'debug' trace mode and send the
                                            contents of start[.elko],
                                            more[.elko] and then stdin[.elko]
                                            [keeps connection open, enters
                                            interactive mode]

  nsolid -f start                           Connect to default Elko server,
                                            execute start[.elko] then the
                                            default termination file,
                                            quit[.elko] which disconnects from
                                            the server.
[root@505cc9958b3f test]#