AWS Fargate hostname not doable?

agat90 :

I am trying to set up a simple app. It is dragged from https://budgetapp.docsapp.io/ and meant to be working somewhere in public. My task is to deploy it in most automate way and expose metrics of java machine to the public (remote jConsole). Eventually, it should be stood up in around 15 exact copies.

For this task I chose AWS Fargate. It sets up the app beautifully, it gives me back the Metrics on admin port (it is deployed by Dropwizard). What I struggle with is monitoring. It should be real live and showing at least CPU and mem usage. I am able to do it locally on docker, but Fargate is missing one crucial thing. Setting up hostname for deployed task.

Error that I am getting: Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: 578463faab0f: 578463faab0f: System error. It is due to missing entry in /etc/hosts file with container's uname -n. It seems like I cannot set it up! Is this possible to be done somehow?

I am running my java service like this: java -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=127.0.0.1 -Djava.rmi.server.useLocalHostname=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=5000 -Dcom.sun.management.jmxremote.rmi.port=5000 -jar budgetapp.jar server config.yml

I am happy to take any advice!

agat90 :

Thanks for all the help. The final answer was a combination of what I read in the internet and answers here.

The key was to change java.rmi.server.hostname value to its external IP address, which is the actual address that I will use while filling jConsole form. (It turns out that this value is not the interface's where service is bind, but the value of IP address that external monitoring tools will use to access it.)

As well, in entrypoint I need to add an external IP to container's hostname, just for the sake of the hostname being added to the /etc/hosts

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=468677&siteId=1