rinormaloku/k8s-mastery

Failed to load resource: net::ERR_CONNECTION_REFUSED

roamergu opened this issue · 4 comments

i follw the doc runing the java app and python app,but i can't get any thing then i input some words and click "SEND" on the frontend page,i use dev tools get the message "Failed to load resource: net::ERR_CONNECTION_REFUSED".i checked the host,8080and 5000 ports status is LISTEN.

Can you please copy the request as cURL and paste it here? Just want to make sure what url are you hitting. is it for real the localhost?

i build a vmware workstion env to runing all apps,include java app\python app and nginx,and via chrome with my windows host to access nginx on the vmware.btw,i runing a centos 7.2 to runing apps,and disabled selinux and firewalld.
so i can't paste a url in here.
thanks for your replay.

I've got the same issue during pressing "SEND" button on UI

docker logs of java container:
https://gist.github.com/itsNikolay/dda0055463db5d038b182a25ab2b3fde

before it I run

docker run -d -p 8080:8080 \
  -e SA_LOGIC_API_URL='http://localhost:5000' \
  rinormaloku/sentiment-analysis-web-app

docker ps:

~❯ docker ps
CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS              PORTS                    NAMES
aaa231b14eff        rinormaloku/sentiment-analysis-web-app   "java -jar sentiment…"   6 minutes ago       Up 6 minutes        0.0.0.0:8080->8080/tcp   unruffled_ardinghelli
e01367c273ba        itsnikolay/sentiment-analysis-logic      "python3 sentiment_a…"   23 minutes ago      Up 23 minutes       0.0.0.0:5050->5000/tcp   inspiring_hopper
9156aaea38f3        itsnikolay/sentiment-analysis-frontend   "nginx -g 'daemon of…"   39 minutes ago      Up 39 minutes       0.0.0.0:80->80/tcp       hardcore_hypatia

@itsNikolay I surmise that the Java and Python containers are not put in the same network.

A simple approach would be to get the Container IP of SA-Logic and use that instead of localhost

docker run -d -p 8080:8080 -e SA_LOGIC_API_URL='http://<container_ip or docker machine ip>:5000' $DOCKER_USER_ID/sentiment-analysis-web-app 

Use Docker Machine IP if you are running Docker in a VM (classic docker setup) otherwise if you have Docker for Windows (with Hyper-V) you need the container IP.

Further explanations are in the following file sa-webapp/README.md

Sorry for the late response, and thanks for asking :)