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

Docker build not working #286

Open
hpx7 opened this issue Jun 10, 2024 · 21 comments
Open

Docker build not working #286

hpx7 opened this issue Jun 10, 2024 · 21 comments

Comments

@hpx7
Copy link

hpx7 commented Jun 10, 2024

Running docker build -t hypersomnia on master fails with the following error:

 > [builder 5/5] RUN cmake/build.sh Release x64 "-DHEADLESS=1" &&     ninja all -C build/current:
#11 0.219 Building into build/Release-x64-clang-16-headless
#11 0.406 -- The C compiler identification is Clang 16.0.6
#11 0.524 -- The CXX compiler identification is Clang 16.0.6
#11 0.529 -- Detecting C compiler ABI info
#11 0.627 -- Detecting C compiler ABI info - done
#11 0.632 -- Check for working C compiler: /usr/bin/clang-16 - skipped
#11 0.632 -- Detecting C compile features
#11 0.633 -- Detecting C compile features - done
#11 0.635 -- Detecting CXX compiler ABI info
#11 0.757 -- Detecting CXX compiler ABI info - done
#11 0.762 -- Check for working CXX compiler: /usr/bin/clang++-16 - skipped
#11 0.762 -- Detecting CXX compile features
#11 0.763 -- Detecting CXX compile features - done
#11 0.851 -- The ASM compiler identification is Clang with GNU-like command-line
#11 0.852 -- Found assembler: /usr/bin/clang-16
#11 0.853 CMAKE_C_COMPILER: /usr/bin/clang-16
#11 0.853 CMAKE_CXX_COMPILER: /usr/bin/clang++-16
#11 0.853 CMAKE_LINKER: /usr/bin/ld.lld-16
#11 0.853 Hypersomnia project source dir: /hypersomnia
#11 0.853 Hypersomnia project binary dir: /hypersomnia/build/Release-x64-clang-16-headless
#11 0.853 Hypersomnia current binary dir: /hypersomnia/build/Release-x64-clang-16-headless
#11 0.853 Building with Clang.
#11 0.883 Clang full version string: Ubuntu clang version 16.0.6 (++20231112100510+7cbf1a259152-1~exp1~20231112100554.106)
#11 0.883 Target: aarch64-unknown-linux-gnu
#11 0.883 Thread model: posix
#11 0.883 InstalledDir: /usr/bin
#11 0.883
#11 0.883 Clang version: 16.0
#11 0.883 Building for UNIX systems.
#11 0.883 Building for x64 architecture.
#11 0.883 Building a minimal executable required to run a dedicated server or a masterserver.
#11 0.883 Not generating debug information.
#11 0.883 Building without debugger setup.
#11 0.928 Building of test scenes is enabled.
#11 0.928 Steam integration will NOT be linked at all. Building stubs directly.
#11 0.928 CMake Error at CMakeLists.txt:1043 (add_subdirectory):
#11 0.928   The source directory
#11 0.928
#11 0.928     /hypersomnia/cmake/Introspector-generator
#11 0.928
#11 0.928   does not contain a CMakeLists.txt file.
#11 0.928
#11 0.928
#11 0.935 -- Found Git: /usr/bin/git (found version "2.34.1")
#11 0.935 Git path: /usr/bin/git
#11 0.935 Building version_file_generator.
#11 0.935 Building with Clang.
#11 0.965 Clang full version string: Ubuntu clang version 16.0.6 (++20231112100510+7cbf1a259152-1~exp1~20231112100554.106)
#11 0.965 Target: aarch64-unknown-linux-gnu
#11 0.965 Thread model: posix
#11 0.965 InstalledDir: /usr/bin
#11 0.965
#11 0.965 Clang version: 16.0
#11 0.965 Omitting c++fs.
#11 0.966 -O0 will be specified for Debug build.
#11 0.967 Chosen standard library: libc++
#11 0.967 Forcing use of O2.
#11 0.967 GENERATE_DEBUG_INFORMATION: OFF
#11 0.967 BUILD_DEBUGGER_SETUP: OFF
#11 0.967 Removing -g flag.
#11 0.968 CMAKE_RUNTIME_OUTPUT_DIRECTORY: /hypersomnia/build/Release-x64-clang-16-headless
#11 0.972 COPY_STEAM_LIBS_TO_EXE_FOLDER is OFF.
#11 0.972 Building OpenSSL.
#11 0.972 OPENSSL_ROOT_DIR:
#11 0.978 Found: TRUE)
#11 0.978 Include dir: /usr/include)
#11 0.978 Crypto library: /usr/lib/aarch64-linux-gnu/libcrypto.so)
#11 0.978 SSL library: /usr/lib/aarch64-linux-gnu/libssl.so)
#11 0.978 Libraries: /usr/lib/aarch64-linux-gnu/libssl.so;/usr/lib/aarch64-linux-gnu/libcrypto.so)
#11 0.978 Version: 3.0.2)
#11 0.978 -- Found OpenSSL: /usr/lib/aarch64-linux-gnu/libcrypto.so (found version "3.0.2")
#11 0.979 CMake Error at CMakeLists.txt:2065 (add_subdirectory):
#11 0.979   The source directory
#11 0.979
#11 0.979     /hypersomnia/src/3rdparty/libdatachannel
#11 0.979
#11 0.979   does not contain a CMakeLists.txt file.
#11 0.979
#11 0.979
#11 0.979 CMake Error at CMakeLists.txt:2068 (target_compile_options):
#11 0.979   Cannot specify compile options for target "datachannel-static" which is not
#11 0.979   built by this project.
#11 0.979
#11 0.979
#11 0.979 Omitting c++fs.
#11 0.979 Building Networking.
#11 0.979 These libraries will be linked statically.
#11 0.979 Default CMAKE_FIND_LIBRARY_SUFFIXES: .so;.a
#11 0.979 CMAKE_FIND_LIBRARY_SUFFIXES after adjustment: .a;.so
#11 0.979 These libraries will be linked dynamically.
#11 0.979 Default CMAKE_FIND_LIBRARY_SUFFIXES: .a;.so
#11 0.979 CMAKE_FIND_LIBRARY_SUFFIXES after adjustment: .so;.a
#11 0.979 All libs:
#11 0.979 lua
#11 0.979 streflop
#11 0.979 blake3
#11 0.979 OpenSSL::SSL
#11 0.979 OpenSSL::Crypto
#11 0.979 datachannel-static
#11 0.979 dl
#11 0.979 /usr/lib/aarch64-linux-gnu/libsodium.a
#11 0.980 ALL linked libraries: lua;streflop;blake3;OpenSSL::SSL;OpenSSL::Crypto;datachannel-static;dl;/usr/lib/aarch64-linux-gnu/libsodium.a
#11 0.980 All CXX flags:   -m64 -Xclang -fno-threadsafe-statics  -Wall -Werror -Wextra -Wcast-align -Wover-aligned  -fcolor-diagnostics -Wno-error=unused-command-line-argument -Wno-error=missing-braces -Wno-deprecated-enum-enum-conversion -ftemplate-backtrace-limit=0 -std=c++20 -stdlib=libc++
#11 0.980 Debug CXX flags:   -Xclang -O0
#11 0.980 RelWithDebInfo CXX flags: -O2  -DNDEBUG
#11 0.980 Release CXX flags: -O2 -DNDEBUG  -DIS_PRODUCTION_BUILD=1
#11 0.980 ALl linker flags:  -pthread -unwindlib=libgcc -fuse-ld=lld
#11 0.980 Linker Debug flags:
#11 0.980 Linker RelWithDebInfo flags:
#11 0.980 Linker Release flags:
#11 0.980 -- Configuring incomplete, errors occurred!
#11 0.980 See also "/hypersomnia/build/Release-x64-clang-16-headless/CMakeFiles/CMakeOutput.log".
#11 0.980 See also "/hypersomnia/build/Release-x64-clang-16-headless/CMakeFiles/CMakeError.log".
#11 0.985 /hypersomnia/build /hypersomnia/build/Release-x64-clang-16-headless
#11 0.987 /hypersomnia/build/Release-x64-clang-16-headless
#11 0.989 ninja: Entering directory `build/current'
#11 0.990 ninja: error: loading 'build.ninja': No such file or directory
------
executor failed running [/bin/sh -c cmake/build.sh Release x64 "-DHEADLESS=1" &&     ninja all -C build/current]: exit code: 1
@geneotech
Copy link
Member

Hello! I forgot to death - the Dockerfile has not been updated in a good while! If you're interested, the real working build instructions that are always up to date are found in the .yml files, e.g. Linux_build.yml. I'll take a look at Dockerfile later

BoskoDelic added a commit to BoskoDelic/Hypersomnia that referenced this issue Jun 14, 2024
geneotech pushed a commit that referenced this issue Jun 17, 2024
@geneotech
Copy link
Member

Hey @hpx7 , take a look at the new Dockerfile. Cheers!

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

Thanks, it builds now but fails to run with

fuse: device not found, try 'modprobe fuse' first
open dir error: No such file or directory

Is it possible to run without fuse?

@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

Is it possible to run without fuse?

Unfortunately fuse is required for mounting any AppImage file.
Alternatively you can try passing --appimage-extract-and-run which will prevent the mount process but will involve additional copy step into /tmp.

fuse: device not found, try 'modprobe fuse' first

Does this happen with the new Dockerfile (so the line needs to be added there)? Or do you maybe have your own?

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

It happened with the new Dockerfile, but was able to get it to start with your suggestion:

CMD ["./Hypersomnia-Headless.AppImage", "--appimage-extract-and-run"]

Is WebRTC required to connect from the web portal, or are websockets supported as well? I'm running it an environment where port ranges (e.g. 9000-9100) can't be exposed, only individual ports.

@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

It happened with the new Dockerfile

I see, we might need to update it.

Is WebRTC required to connect from the web portal, or are websockets supported as well?

WebRTC is necessary from the Web to establish connection with any game server. WebSockets are still used to communicate with the signalling server that lets us initiate the WebRTC connection. If you only plan to support several web clients at most, consider setting:

webrtc_port_range_begin = 9000,
webrtc_port_range_end = 9004

And then only exposing ports 9000, 9001, 9002, 9003 and 9004.

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

I tried updating dockerfile_server_config.lua to include the port range override:

  server = {
    server_name = "Server",
    webrtc_port_range_begin = 9000,
    webrtc_port_range_end = 9001
  },

But I don't think the configuration was correctly applied:

[13:09:56] Starting yojimbo::Server.
[13:09:56] server listening on 127.0.0.1:8412
[13:09:56] server started with 20 client slots
[13:09:56] Server address is 127.0.0.1:8412
[13:09:56] Web port range: 9000-9100

@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

Check if the new Dockerfile works any better. It's copying the config into config.force.lua so it is certain to never be overwritten, as config.lua is an input/output file.

The next server build will also allow muxing on a single UDP port. (i need to deploy it first tho)

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

I tried the latest but it still logs Web port range: 9000-9100

@geneotech
Copy link
Member

I tried the latest but it still logs Web port range: 9000-9100

Thank you, I just found a bug that caused some settings to not be applied on startup. This will be fixed in the next update.

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

Awesome, let me know when the next release is cut and I'll test it out!

geneotech added a commit that referenced this issue Jun 18, 2024
This uses the lowest possible Ubuntu version.
@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

The new version is live.

  • UDP muxing is now enabled by default for the Dockerfile so you only need to expose a single port 9000.
  • I'm using Ubuntu 20.04 for the Dockerfile to use the lowest supported Ubuntu version.
  • Startup configuration issues should be fixed now.

Let me know if the config loads correctly as the Docker server had problems locating config.force.lua - it should say something like:

Loading default_config.lua.
Applying config: user/config.force.lua
Loaded all user configs.

If it doesn't, try renaming config.force.lua to config.lua and go again.

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

Startup failed with

Applying config: /root/.config/Hypersomnia/user/config.force.lua
(completed_work_result=2)
[string "return {..."]:9: '}' expected (to close '{' at line 6) near 'webrtc_udp_mux'
Failed to obtain patch table from /root/.config/Hypersomnia/user/config.force.lua:
There was a problem reading /root/.config/Hypersomnia/user/config.force.lua.
Failed to read the initial config for the game!

I tried renaming it to config.lua but that didn't work either

COPY cmake/dockerfile_server_config.lua /root/.config/Hypersomnia/user/config.lua
There was a problem reading /root/.config/Hypersomnia/user/config.lua.

@hpx7
Copy link
Author

hpx7 commented Jun 18, 2024

Looks like there was just a comma missing in docker_server_config.lua. After adding that, the server starts up!

Now I'm having issues connecting to the server:

[20:07:46] Starting a dedicated server. Binding to a port: 8412 (8412 was preferred)
[20:07:46] Starting yojimbo::Server.
[20:07:46] server listening on 127.0.0.1:8412
[20:07:46] server started with 10 client slots
[20:07:46] Server address is 127.0.0.1:8412

When I try to connect to it from https://hypersomnia.io/game/<hostname>:<port>, I get WebRTC: WebSocket closed after a while

@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

Thanks for the catch - fixed the comma! That's already some progress.

When I try to connect to it from https://hypersomnia.io/game/:, I get WebRTC: WebSocket closed after a while

Are you sure your Docker server is visible from the server list here? (the one Server is someone else's Docker server - although it somehow seems to work fine on their end)
image

If it's missing, it means it is not registered with the signalling server and has no way of accepting WebRTC connections - even if you use a direct browser link.

Try double-clicking your server from the server list. What about the native client by the way? Does it connect?

Also forgive me for all the chaos - you're actually one of the first testers of the Docker build - you're doing me a favor!

@geneotech
Copy link
Member

geneotech commented Jun 18, 2024

I tested the current dockerfile_server_config.lua locally as config.force.lua and it does seem to accept browser connections - if you're using no other user config, I might have forgotten to expose another port.

WebRTC: WebSocket closed after a while

Also make sure any other official server works from your browser, e.g. https://hypersomnia.io/game/pl:1
If it doesn't, your browser might have WebRTC disabled.

@hpx7
Copy link
Author

hpx7 commented Jun 19, 2024

I see the server on the list, but still can't connect
image

I can confirm that https://hypersomnia.io/game/pl:1 works for me in my browser

@hpx7
Copy link
Author

hpx7 commented Jun 19, 2024

Here's a link to the server logs in case that's helpful: https://drive.google.com/file/d/1T9X350mc9ydjSH4YBcaXdKUnAttqG_R5/view?usp=sharing

I am using the default codebase from master, with the exception of the server name override. The only two ports I have exposed are 8412 and 9000, but both those ports are mapped to random external ports on the host (ingress proxy). Would that cause a problem?

@geneotech
Copy link
Member

geneotech commented Jun 19, 2024

both those ports are mapped to random external ports on the host (ingress proxy). Would that cause a problem?

As far as I can tell all currently running dedicated servers are port-preserving cones, so the internal port matches the external port (incl. the other Server that runs from the Dockerfile) - I would definitely investigate if Dockerfile's EXPOSE works as expected in your case, or force the internal/external pairs for just 8412 and 9000 to be identical.

How about the native clients? Can they connect? If not, then it's almost surely a problem with how 8412 and 9000 are being exposed - I'm 99.99% sure that the game does not need any more than just 8412 port for the native connection.

@geneotech
Copy link
Member

geneotech commented Jun 19, 2024

I think even if native clients could connect, the WebRTC backend might require that the external ports aren't random so it performs the STUN mapping and SDP exchange without issues (it has to even for public servers without routers). Definitely do try to map internal 9000 to external 9000 somewhere in your configuration.

@geneotech
Copy link
Member

A small update: the server now uses JSON instead of Lua files, but this is already reflected in the latest Dockerfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants