signal-cli-rest-api icon indicating copy to clipboard operation
signal-cli-rest-api copied to clipboard

Latest entrypoint.sh changes: export HOST_IP causing issues.

Open poggenpower opened this issue 2 years ago • 7 comments

The problem

https://github.com/bbernhard/signal-cli-rest-api/blob/master/entrypoint.sh#L32 is failing under certain IP configurations.

hostname -i can return more than one IP, e.g. if IPv6 is configured too. And the man page says it should not be used anymore. See https://stackoverflow.com/questions/13322485/how-to-get-the-primary-ip-address-of-the-local-machine-on-linux-and-os-x

In may case the container is not starting anymore with following error:

+ export HOST_IP=fd61:a8b9:a1ec:9e8e:8222:ec95:d130:f814 172.16.248.31
/entrypoint.sh: 32: export: 172.16.248.31: bad variable name

Are you using the latest released version?

  • [X] Yes

Have you read the troubleshooting page?

  • [X] Yes

What type of installation are you running?

signal-cli-rest-api Docker Container

In which mode are you using the docker container?

JSON-RPC Mode

What's the architecture of your host system?

x86-64

Additional information

No response

poggenpower avatar Mar 13 '22 20:03 poggenpower

I have the same problem. Since the container is not starting up anymore this should be labeld as a critical bug.

user410553 avatar Mar 14 '22 17:03 user410553

Thanks for the report. It should (hopefully) be fixed. In case you want to give it a try, here's a test image: bbernhard/signal-cli-rest-api:0.101-dev

bbernhard avatar Mar 14 '22 18:03 bbernhard

Yes, at least for me it is working again. Thanks for the quick fix!

user410553 avatar Mar 14 '22 18:03 user410553

This will also return more than one IPv4 address if multiple networks or interfaces are used (also breaking startup)

Firerouge avatar Mar 15 '22 15:03 Firerouge

This will also return more than one IPv4 address if multiple networks or interfaces are used (also breaking startup)

Could you please send me the output of hostname -I inside the docker container

bbernhard avatar Mar 15 '22 15:03 bbernhard

Here both outputs:

root@signal-cli-rest-api-75f5dbc698-69k65:/# hostname -I
172.16.58.246 fd61:a8b9:a1ec:9e8e:2edd:ae8c:173d:9824
root@signal-cli-rest-api-75f5dbc698-69k65:/# hostname -i
fd61:a8b9:a1ec:9e8e:2edd:ae8c:173d:9824 172.16.58.246

Following the man-page the order is random. I think gathering the IP is a complex thing following the stackoverflow article above.

I am not sure about the usecase you are following. Have you tried to use the hostname or 0.0.0.0 instead of a specific IP?

If I change https://github.com/bbernhard/signal-cli-rest-api/blob/master/src/main.go#L245 to

	// swaggerUrl := ginSwagger.URL("http://" + swaggerIp + ":" + string(port) + "/swagger/doc.json")
	router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

then it works out of the box with docker. In kubernetes I have to set env SWAGGER_IP to the exposed service name.

poggenpower avatar Mar 15 '22 21:03 poggenpower

This will also return more than one IPv4 address if multiple networks or interfaces are used (also breaking startup)

Could you please send me the output of hostname -I inside the docker container

This is what was put in the startup log with two networks, the first internal for Home Assistant, the other provides WAN. Seems fixed in latest-dev

signal           | + hostname -i
signal           | + export HOST_IP=172.25.0.6 172.24.0.3
signal           | /entrypoint.sh: 32: export: 172.24.0.3: bad variable name

Firerouge avatar Mar 15 '22 21:03 Firerouge