processone / eturnal

STUN / TURN standalone server
https://eturnal.net
Apache License 2.0
237 stars 22 forks source link

Docker ARM64 image doesn't work #55

Closed FarisZR closed 1 year ago

FarisZR commented 1 year ago

it seems that the image wasn't compiled correctly, the same config works on an x86 machine.

/opt/eturnal/erts-14.0.2/bin/erlexec: line 4: syntax error: unexpected "("
sando38 commented 1 year ago

Hello,

we just tested the image and cannot reproduce it. I also used user 0 as in your compose file, to make sure, that it isn't the cause of the error.

# architecture of the docker container image
saarko@raspberrypi:~ $ sudo docker inspect ghcr.io/processone/eturnal:1.12.0 | grep arm64 
        "Architecture": "arm64",
# docker command
saarko@raspberrypi:~ $ sudo docker run --rm --user 0 ghcr.io/processone/eturnal:1.12.0
Cannot query stun.conversations.im:3478: can't assign requested address
Exec: /opt/eturnal/erts-14.0.2/bin/erlexec -noinput +Bd -boot /opt/eturnal/releases/1.12.0/start -mode embedded -boot_var SYSTEM_LIB_DIR /opt/eturnal/lib -config /opt/eturnal/releases/1.12.0/sys.config -args_file /opt/eturnal/releases/1.12.0/vm.args -erl_epmd_port 3470 -start_epmd false -- foreground
Root: /opt/eturnal
/opt/eturnal
2023-10-01 19:10:32.938606+00:00 [notice] Starting eturnal 1.12.0 on Erlang/OTP 26 (ERTS 14.0.2)
2023-10-01 19:10:32.938834+00:00 [info] Got no NOTIFY_SOCKET, notifications disabled
2023-10-01 19:10:32.938954+00:00 [info] Relay IPv4 address: xxx.xxx.xxx.xxx (port range: 49152-65535)
2023-10-01 19:10:32.939020+00:00 [info] Relay IPv6 address not configured
2023-10-01 19:10:32.939111+00:00 [info] Listening on 127.0.0.1:3470 (tcp) (Erlang protocol version 5)
2023-10-01 19:10:32.939467+00:00 [info] Started mod_log_stun
2023-10-01 19:10:32.940215+00:00 [info] Listening on [::]:3478 (udp) (STUN/TURN)
2023-10-01 19:10:32.940863+00:00 [info] Listening on [::]:3478 (tcp) (STUN/TURN)

Can you tell us a bit how we may reproduce it?

FarisZR commented 1 year ago

i am running it on an Oracle Cloud arm64 Ampere instance and BTW running it as user 0:0 didn't work, as the binary still runs as the Eturnal user(i need it run as root to be able to read the certificates from another container.

sando38 commented 1 year ago

What does sudo docker inspect ghcr.io/processone/eturnal:1.12.0 | grep Architecture yield? Maybe you need to change ghcr.io/processone/eturnal:1.12.0 to the image name how it is stored on your server.

FarisZR commented 1 year ago
sudo docker inspect ghcr.io/processone/eturnal:1.12.0 | grep Architecture
>        "Architecture": "arm64",

hmm i'm now trying to replicate it and it works, seemed to have fixed itself :)

should i open a separate issue about running as root? As i can't use Eturnal because of it, Caddy runs as root and its certs are owned by root.

sando38 commented 1 year ago

Author

Great. Yes, you can open another issue for that. As a workaround for now, just create a passwd file having:

root:x:0:0:root:/root:/bin/sh
eturnal:x:9000:9000:eturnal,,,:/opt/eturnal:/sbin/nologin

and run:

saarko@raspberrypi:~ $ sudo docker run --rm --user 0  --name eturnal -e ETURNAL_USER=root -v $PWD/passwd:/etc/passwd  -d ghcr.io/processone/eturnal:1.12.0
4210f6fd76385fce54ecdac2897f5824cfd931b9d4305e9f13323911453b99f1
saarko@raspberrypi:~ $ sudo docker exec eturnal ps aux
PID   USER     TIME  COMMAND
    1 root      0:00 /sbin/tini -- /bin/sh -c run.sh
    7 root      0:03 {beam.smp} /opt/eturnal/bin/eturnal -Bd -- -root /opt/eturnal -bindir /opt/eturnal/erts-14.0.2/bin -progname opt/eturnal/bin/eturnal -- -home /root -- -noshell -noinput -boot /opt/eturnal/releases/1.12.0/start -mode embedded -boot_var SYSTEM_LIB_DIR /opt/eturnal/lib -config /opt/eturnal/releases/1.12.0/sys.config -name eturnal@127.0.0.1 -kernel inet_dist_use_interface {127,0,0,1} -setcookie eturnal -- -erl_epmd_port 3470 -start_epmd false -- foreground --
  130 root      0:00 erl_child_setup 1048576
  153 root      0:00 /opt/eturnal/erts-14.0.2/bin/inet_gethost 4
  154 root      0:00 /opt/eturnal/erts-14.0.2/bin/inet_gethost 4
  155 root      0:00 ps aux