keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
187 stars 44 forks source link

Eureka could not find dockerized service #87

Closed mnwato closed 1 month ago

mnwato commented 1 month ago

Here is eureka_client.init:

eureka_client.init(
    eureka_server="http://<EUREKA_SERVER_IP>:8070/eureka",
    app_name="<EUREKA_APPNAME>",
    instance_port="<API_PORT",
    instance_ip="<MACHINE_IP>",
)

At the first my fastapi application registered with docker range ip address (172.19...) in eureka. After setting instance_ip it registered with my machine ip address but still does not work when loading service from gateway. Unfortunatly i have not access to eureka server machine.

py-eureka-client 0.11.10
python 3.10

Any help is appriciated

mnwato commented 1 month ago

Solved with bellow eureka client config:

# Eureka client configuration
eureka_client.init(
    eureka_server=envs["EUREKA_URL"],
    app_name=envs["EUREKA_APPNAME"],
    instance_port=int(envs["API_PORT"]),
    instance_ip=envs["HOST_IP_ADDRESS"],
    instance_host=envs["HOST_IP_ADDRESS"],
    renewal_interval_in_secs=5
)