Open zscgeek opened 2 months ago
FYI this is the networking config inside the container
eth0 Link encap:Ethernet HWaddr 0A:58:A9:FE:AC:02
inet addr:169.254.172.2 Bcast:0.0.0.0 Mask:255.255.252.0
inet6 addr: fe80::84ba:a9ff:fece:e4bc/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:140 errors:0 dropped:0 overruns:0 frame:0
TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:104206 (101.7 KiB) TX bytes:13576 (13.2 KiB)
eth1 Link encap:Ethernet HWaddr 02:ED:BD:8A:60:07
inet addr:10.0.193.0 Bcast:0.0.0.0 Mask:255.255.192.0
inet6 addr: fe80::ed:bdff:fe8a:6007/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:607402 errors:0 dropped:0 overruns:0 frame:0
TX packets:48312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:985259937 (939.6 MiB) TX bytes:17929481 (17.0 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:75090 errors:0 dropped:0 overruns:0 frame:0
TX packets:75090 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8727188 (8.3 MiB) TX bytes:8727188 (8.3 MiB)
/opt/app #
What the PR in place we then can correctly configure things upon startup using the AWS API's (snippet below). This also allows on-premise advanced networking configurations where auto detection fails.
metadata=$(wget -qO- $ECS_CONTAINER_METADATA_URI_V4)
# Parse the JSON and extract IP addresses using jq
export HTTP_IP=$(echo $metadata | jq -r '.Networks[].IPv4Addresses[]' | tail -1)
We were running into a problem where if the feature server was running on AWS fargate ECS it would get the wrong ip address returned. The issue is the first network card in a fargate container is amazon's metadata network. The result is that the node ip.address() function would return that IP, instead of the IP that is on the VPC. We need a way to override the IP that gets registered and published.
See https://github.com/jambonz/jambonz-feature-server/pull/875 for the fix.