C-lightning doesn't really run with API exposed over TCP?
gijswijs opened this issue · 4 comments
If I look at the docker compose configuration for the c-lightning container, the EXPOSE_TCP
parameter is set to true. So I expected the API to be reachable over tcp.
But when I run socat from the Docker host, it just closes directly with no error message, after running the following command:
socat - tcp:127.0.0.1:14300
If I run ./dc ps
it shows that the ports are mapped correctly.
0.0.0.0:14300->9835/tcp
If I run socat - UNIX-CONNECT:/home/simnet/.lightning/lightning-rpc
on the container itself, the API works as expected.
I figured that the API wasn't really exposed after all, so I tried to expose it manually with:
socat -d -d TCP-LISTEN:9835,fork,reuseaddr UNIX-CONNECT:/home/simnet/.lightning/lightning-rpc
Low and behold, now I could access the API over tcp from the host, or any other computer in my network.
I'm not sure whether this is an issue with simverse or with c-lightning. I would be interested in hearing if you could reproduce this behavior.
I just briefly tested it here on my macOS. I confirm that it does not work out of the box. So far it looks like our containerized lightningd does not respect EXPOSE_TCP
(which is being set in container's env).
I tried socat - tcp:127.0.0.1:9835
inside the container and it returned socat[1121] E connect(5, AF=2 127.0.0.1:9835, 16): Connection refused
. It means that 9835 port is not accessible even from inside the container. This rules out docker.
By the way I assume you have set SIMVERSE_HOST_BIND=0.0.0.0
, by default it should bind only to localhost
and simverse services should not be visible on the network.
Ah, now I see. EXPOSE_TCP
is implemented in their docker script:
https://github.com/ElementsProject/lightning/blob/2945b25b57db37dca31c10da34a4b1ca33d697c3/Dockerfile#L103
https://github.com/ElementsProject/lightning/blob/master/tools/docker-entrypoint.sh
I don't use this script in simverse a that explains it.
The question is whether I should incorporate it somehow or implement something similar.
That's an awesome beginning of my week. Thanks for taking care of this.