I have a Micronaut application deployed on Azure, and I recently upgraded it from version v3 to v4. However, after the update, the application failed to start, and the startup process halted with the message:
Waiting for response to warmup request for container (...)
After searching for differences between Micronaut v3 and v4, I noticed that before the update, the Micronaut server was listening on 0.0.0.0:port
, but after the update it was set to localhost:port
.
To resolve the startup issue, I modified the server host configuration in application.yml
as follows:
micronaut:
server:
host: 0.0.0.0
This change allowed the application to start successfully. While this fixes the issue, I'd like to know why it became necessary to listen on all devices (0.0.0.0
) instead of just localhost. Is there a specific Azure configuration I might be missing, or is this the recommended approach for Micronaut applications on Azure?
Posting my comments as an answer for the benefit of community:-
Listening on 0.0.0.0
implies the server is accessible through all available network interfaces, whereas listening on localhost restricts access to the loopback interface only. In your situation, the need to listen on all devices (0.0.0.0)
instead of just localhost arose because the application failed to start following an update. This might be due to the change in the network settings within Azure.
I have observed this limitation in Django, streamlit based python apps, and Quarkus apps. Where only if I specify the host to 0.0.0.0
and port the App starts and it does not load when I specify localhost:port
, Its also recommended in this MS Document.
Looks like Micronaut app requires specific host to start in azure web app and it won't run on localhost:port
Micronaut logic is similar to running quarkus app, In quarkus app too mentioning 0.0.0.0
host is mandatory Refer here.
Quarkus startup command:-
Change the last two commands in the Dockerfile.native file and make it read like this: EXPOSE 80 CMD ["./application","-Dquarkus.http.host=0.0.0.0", "-Dquarkus.http.port=80"]
For example, Refer my streamlit SO answer here- Where I had to mention server-address to 0.0.0.0
for the app to work.