bbernhard / signal-cli-rest-api

Dockerized Signal Messenger REST API
https://bbernhard.github.io/signal-cli-rest-api/
MIT License
1.26k stars 151 forks source link

Wrong IP address #565

Open emonfejm opened 1 month ago

emonfejm commented 1 month ago

The problem

It is picking wrong IP addres:

export HOST_IP=$(hostname -I | awk '{print $1}')

If I have 2 IP addresses it is picking dynamic one which means it will be changed every time I restart machine. I want to use my static IP address: 192.168.1.230

+ [ native = json-rpc ]
+ hostname -I
+ awk {print $1}
+ export HOST_IP=172.30.32.1 
+ exec setpriv --reuid=1000 --r

and after restart

+ [ native = json-rpc ]
+ hostname -I
+ awk {print $1}
+ export HOST_IP=172.30.33.2
+ exec setpriv --reuid=1000 --r

Is there an option to chose the IP address? If not what is the reason for that?

Are you using the latest released version?

Have you read the troubleshooting page?

What type of installation are you running?

Home Assistant Signal Addon

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

bbernhard commented 1 month ago

You can use the SWAGGER_IP environment variable to override that (see https://github.com/bbernhard/signal-cli-rest-api?tab=readme-ov-file#advanced-settings)

pmalek commented 1 month ago

I'm also struggling with this problem (running docker daemon in VM on Mac, separate network unreachable from host).

Setting SWAGGER_IP doesn't help:

docker inspect signal-api | jq ".[0].Config.Env"
[
  "MODE=native",
  "SWAGGER_IP=192.168.1.95",
  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "GIN_MODE=release",
  "PORT=8080",
  "BUILD_VERSION=0.85",
  "SIGNAL_CLI_CONFIG_DIR=/home/.local/share/signal-cli",
  "SIGNAL_CLI_UID=1000",
  "SIGNAL_CLI_GID=1000"
]
docker logs signal-api -f
+ set -e
+ [ -z /home/.local/share/signal-cli ]
+ usermod -u 1000 signal-api
usermod: no changes
+ groupmod -g 1000 signal-api
+ chown 1000:1000 -R /home/.local/share/signal-cli
+ cat
+ cap_prefix=-cap_
+ cat /proc/sys/kernel/cap_last_cap
+ seq -s ,-cap_ 0 40
+ caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37,-cap_38,-cap_39,-cap_40
+ [ native = json-rpc ]
+ hostname -I
+ awk {print $1}
+ export HOST_IP=172.17.0.2
+ exec setpriv --reuid=1000 --regid=1000 --init-groups --inh-caps=-cap_0,-cap_1,-cap_2,-cap_3,-cap_4,-cap_5,-cap_6,-cap_7,-cap_8,-cap_9,-cap_10,-cap_11,-cap_12,-cap_13,-cap_14,-cap_15,-cap_16,-cap_17,-cap_18,-cap_19,-cap_20,-cap_21,-cap_22,-cap_23,-cap_24,-cap_25,-cap_26,-cap_27,-cap_28,-cap_29,-cap_30,-cap_31,-cap_32,-cap_33,-cap_34,-cap_35,-cap_36,-cap_37,-cap_38,-cap_39,-cap_40 signal-cli-rest-api -signal-cli-config=/home/.local/share/signal-cli
time="2024-07-26T11:51:53Z" level=info msg="Started Signal Messenger REST API"
[GIN] 2024/07/26 - 11:52:07 | 200 |  871.332174ms |      172.17.0.1 | GET      "/v1/qrcodelink?device_name=signal-api"
[GIN] 2024/07/26 - 11:52:37 | 200 |   664.77195ms |      172.17.0.1 | GET      "/v1/qrcodelink?device_name=signal-api"