Closed nadrojisk closed 8 months ago
it appears it is a Windows issue, the API internally runs with IPv6 support, however it appears that Docker Desktop doesn't support IPv6 (which I found out about here)
I can see if I can put the IPv6 behind a feature flag though, I'll have to investigate
@nadrojisk could you try running the container with the following command and let me know if it works for you?
docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=false -p 4000:4000 helldivers2:latest
(note the addition of -e ENABLE_IPV6=false
I added in be19c29)
Hey so I ran into this exact same issue.
Version information:
Your command sadly still outputs the same result @dealloc, please see my terminal output below:
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE
_IPV6=false -p 4000:4000 helldivers2:latest
Protocol 'inet6_tcp': register/listen error: eaddrnotavail
However, I managed to get it running by changing a line inside of rel/env.sh.eex
from:
export ERL_AFLAGS="-proto_dist inet6_tcp"
to:
export ERL_AFLAGS="-proto_dist inet_tcp"
I have never worked with fly or elixir before, so not sure if this is a workaround or the intended way of solving this, but this should work for @nadrojisk aswell.
Semi unrelated, but I also added a really barebones docker-compose.yaml
so I can use a .env
file instead of having to give all the env vars in the command, if anyone is interested I'm willing to share it!
Good catch! The machine I'm running my containers on has IPv6 support so it's a little hard for me to test these as it would work regardless of IPv6 being on or off.
I'm pushing an update that should set ERL_AFLAGS
conditionally on the ENABLE_IPV6
parameter
Hey so I tested this again after pulling and rebuilding the image locally, I run the command with ENABLE_IPV6=true
This returns an unexpected output:
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=true -p 4000:4000 helldivers2:latest
./helldivers_2: 4: [: true: unexpected operator
16:02:08.147 [info] Launching war season 801
16:02:08.148 [info] Launching war season 805
16:02:08.150 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
##continues with loading text
This should've given me the Protocol 'inet6_tcp': register/listen error: eaddrnotavail
message, as I don't have IPV6 support.
No matter the value or how I re-write the command, I either get the ./helldivers_2: 4: [: {value}}}: unexpected operator
or no error but I always boot in IPV4.
The issue lies in the env.sh.eex
file, on the if statement on line 4: if [ "${ENABLE_IPV6}" == "true" ]
Changing this to if [ "${ENABLE_IPV6}" = "true" ]
fixes it.
I can try to explain, but this stackoverflow answer will do a better job (also the information I based this message on):
After I changed the line, I built the image again and ran these commands, their output is listed below:
Running with IPV6 enabled should give me a eaddrnotavail
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=true -p 4000:4000 helldivers2:latest
Protocol 'inet6_tcp': register/listen error: eaddrnotavail
Running with an incorrect value should start the API
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=wrong -p 4000:4000 helldivers2:latest
16:04:41.697 [info] Launching war season 801
16:04:41.699 [info] Launching war season 805
16:04:41.701 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
##continues with loading text
Running with no -e ENABLE_IPV6 should start the API
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -p 4000:4000 helldivers2:latest
16:23:55.449 [info] Launching war season 801
16:23:55.449 [info] Launching war season 805
16:23:55.452 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
##continues with loading text
edited the above message to have some clearer formatting, as it started to turn into a big wall of text
ah, when testing locally it seemed to work but SO confirms that ==
is indeed not POSIX compliant.
Fingers crossed that c5c7241 gets things working on your end!
Tested on my set-up, pulling changes and rebuilding the image
output with the IPV6 true flag
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=true -p 4000:4000 helldivers2:latest
Protocol 'inet6_tcp': register/listen error: eaddrnotavail
Error as expected, since no IPV6 support
output without value
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -p 4000:4000 helldivers2:latest
20:43:18.766 [info] Launching war season 801
20:43:18.767 [info] Launching war season 805
20:43:18.768 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
##continues with loading text
Starts with IPV4 as expected
output with incorrect value
jelle@Jelle:~/Documents/repo/helldivers2-api$ docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -e ENABLE_IPV6=wrong -p 4000:4000 helldivers2:latest
20:46:34.791 [info] Launching war season 801
20:46:34.791 [info] Launching war season 805
20:46:34.793 [notice] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
##continues with loading text
Starts with IPV4 as expected
Works for me!
alright, just waiting on confirmation from @nadrojisk and we can close this!
Works beautifully, thanks for your help on this!
nadrojisk@ENTERPRISE:~/Documents/helldivers2-api$ sudo docker run -e SECRET_KEY_BASE=JlU7vU9xt9uWbf82Z9HrUjAuNGtqwqG8h8AaUc3AOyH0a86wa5Q4DITNLorGmILv -e FLY_APP_NAME=helldivers-2 -e FLY_IMAGE_REF=0 -e FLY_PRIVATE_IP=127.0.0.1 -p 4000:4000 helldivers2:latest
04:40:16.111 [info] Launching war season 801
04:40:16.111 [info] Launching war season 805
04:40:16.117 [info] Running Helldivers2Web.Endpoint with Bandit 1.2.3 at :::4000 (http)
04:40:16.117 [info] Access Helldivers2Web.Endpoint at https://example.com
04:40:16.704 [info] Finished synchronizing API 805
04:40:16.721 [info] Finished synchronizing API 801
04:41:00.213 request_id=F7oTJXl90hd-bcwAAAAB [info] GET /api/swaggerui
04:41:00.213 request_id=F7oTJXl90hd-bcwAAAAB [info] Sent 200 in 188µs
04:41:00.442 request_id=F7oTJYchsMZ-bcwAAABB [info] GET /api/openapi
04:41:00.444 request_id=F7oTJYchsMZ-bcwAAABB [info] Sent 200 in 2ms
04:41:00.538 request_id=F7oTJYzWmAV-bcwAAACB [info] GET /api/favicon-32x32.png
04:41:00.538 request_id=F7oTJYzWmAV-bcwAAACB [info] Sent 404 in 155µs
04:41:00.544 request_id=F7oTJY0xCDV-bcwAAADB [info] GET /api/favicon-16x16.png
04:41:00.544 request_id=F7oTJY0xCDV-bcwAAADB [info] Sent 404 in 184µs
sounds like this is solved, thanks for the input people!
Having an issue on a fresh instance of Ubuntu 22.04.2.
Running the following command from the README produces an error:
I first attempted this on WSL but got the same error and assumed it may have been because of some weird Windows issue. However, I am still having this issue on a fresh VM.