I have a python application that needs monitoring. So, I decided to deploy application using flask and monitor health with pyctuator. My app.py is
from pyctuator.pyctuator import Pyctuator
app_name = "Flask App with Pyctuator"
app = Flask(__name__)
@app.route("/")
def hello_world():
"""Function to test the functionality of the API"""
return "Hello, world!"
Pyctuator(
app,
app_name,
app_url="http://host.docker.internal:5000",
pyctuator_endpoint_url="http://host.docker.internal:5000/pyctuator",
registration_url="http://localhost:8080/instances"
)
if __name__ == '__main__':
app.run(debug=True, port=8080)
I have mentioned to expose 8080 port in docker file
EXPOSE 8080
But when I deploy my application to gcp, I get this error
WARNING:root:Failed registering with boot-admin, [Errno 99] Cannot assign requested address (<class 'OSError'>)
PS: When i try to deply using uvicorn (without pyctuator), i don't see any issue of running in localhost.
CMD ["uvicorn", "service.app:app", "--port", "8080"]