Cvat: Unable to remote connect

Created on 10 Dec 2019  路  16Comments  路  Source: openvinotoolkit/cvat

Hello. I've reinstalled my Ubuntu 18.04 and CVAT. I can log in locally, but when I'm trying to do it remotely I get the error: ERR_CONNECTION_REFUSED to localhost 7080.
I'm trying to connect to CVAT by address of my mashine 192.168.0.1:8080, but I always redirect to port 7080.
My docker-compose.override.yml file:
version: "2.3"
services:
cvat:
environment:
ALLOWED_HOSTS: '*'
ports:
- "8080:8080"

question

Most helpful comment

To help anyone out there with complete solution:
Create in cvat home directory file docker-compose.override.yml and place there this:

version: "2.3"

services:
  cvat:
    environment:
      ALLOWED_HOSTS: '*'
      UI_SCHEME: http
      UI_HOST: 192.168.1.74
      UI_PORT: 7080 

  cvat_ui:
    build:
      args:
        REACT_APP_API_PROTOCOL: http
        REACT_APP_API_HOST: 192.168.1.74
        REACT_APP_API_PORT: 8080

replace IP with your own.
After that rebuild everything with

docker-compose -f docker-compose.yml -f components/auto_segmentation/docker-compose.auto_segmentation.yml -f docker-compose.override.yml build

then execute docker-compose up -d and with chrome incognito mode window open your_ip:8080

All 16 comments

@DufeRob

Hi,
You have installed CVAT on the first machine and you are using it on the second, are you?
CVAT now uses a separated server with UI (old dashboard was completely removed from develop). Annotation view will be redesigned too.
Probably you haven't setup scheme/host/port for UI server.
Please, look into these parameters in your docker-compose file

  cvat:
    environment:
      UI_SCHEME: http
      UI_HOST: localhost
      UI_PORT: 7080 

  cvat_ui:
    build:
      args:
        REACT_APP_API_PROTOCOL: http
        REACT_APP_API_HOST: localhost
        REACT_APP_API_PORT: 8080
  • The first 3 parameters setup CORS and CSRF on the REST server (in order to you can get access it from UI placed on another server)
  • The second 3 parameters speak where new UI should find REST server.

Hi @bsekachev , thank you for the answer. I really installed CVAT on the first machine with a docker and I try to use it on the second.
I'm trying to understand haw can I edit docker-compose.yml to get access from another PC.
Now I have:
` environment:
ALLOWED_HOSTS: "*"

  DJANGO_MODWSGI_EXTRA_ARGS: ""
  UI_SCHEME: http
  UI_HOST: 192.168.0.81
  UI_PORT: 7080

...
REACT_APP_API_PROTOCOL: http
REACT_APP_API_HOST: localhost
REACT_APP_API_PORT: 8080`
I can get access to a login form, but I have a error message in browser: "Could not check authorization on the server. Error: Network Error."
And I can't log in to the system. But locally I have no this problem.
Thanks.

@DufeRob
You haven't setup these vars -> UI doesn't know where REST API server is:

REACT_APP_API_PROTOCOL: http
REACT_APP_API_HOST: localhost
REACT_APP_API_PORT: 8080

Probably they should be:

REACT_APP_API_PROTOCOL: http # if you use default scheme for rest api
REACT_APP_API_HOST: 192.168.0.81
REACT_APP_API_PORT: 8080 # if you use default port for rest api

@bsekachev , I've already tried it. Doesn't work, the same error. And I clear the browser cash etc.

@DufeRob
What is code of the error? You can see it in the Browser Console or on the Network tab in browser developer tools.

Hi, @bsekachev

cvat-app.tsx:145 Error: Network Error.
e @ cvat-app.tsx:145
showErrors @ cvat-app.tsx:168
componentDidUpdate @ cvat-app.tsx:72
Hs @ react-dom.production.min.js:251
n.unstable_runWithPriority @ scheduler.production.min.js:18
Gr @ react-dom.production.min.js:120
Ds @ react-dom.production.min.js:244
xs @ react-dom.production.min.js:223
(anonymous) @ react-dom.production.min.js:121
n.unstable_runWithPriority @ scheduler.production.min.js:18
Gr @ react-dom.production.min.js:120
Zr @ react-dom.production.min.js:121
Xr @ react-dom.production.min.js:120
ks @ react-dom.production.min.js:224
notify @ Subscription.js:23
n.notifyNestedSubs @ Subscription.js:65
n.handleChangeWrapper @ Subscription.js:70
p @ redux.js:220
(anonymous) @ index.js:11
dispatch @ redux.js:636
(anonymous) @ auth-actions.ts:165
async function (async)
(anonymous) @ auth-actions.ts:163
(anonymous) @ index.js:8
verifyAuthorized @ index.tsx:76
componentDidMount @ cvat-app.tsx:54
Hs @ react-dom.production.min.js:251
n.unstable_runWithPriority @ scheduler.production.min.js:18
Gr @ react-dom.production.min.js:120
Ds @ react-dom.production.min.js:244
xs @ react-dom.production.min.js:223
bs @ react-dom.production.min.js:214
rc @ react-dom.production.min.js:279
(anonymous) @ react-dom.production.min.js:285
_s @ react-dom.production.min.js:224
uc @ react-dom.production.min.js:285
render @ react-dom.production.min.js:286
(anonymous) @ index.tsx:95
t @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ cvat-ui.min.js:1
xhr.js:160 OPTIONS http://localhost:8080/api/v1/users/self net::ERR_CONNECTION_REFUSED
(anonymous) @ xhr.js:160
e.exports @ xhr.js:11
e.exports @ dispatchRequest.js:57
Promise.then (async)
l.request @ Axios.js:51
r.forEach.l.<computed> @ Axios.js:61
(anonymous) @ bind.js:9
getSelf @ server-proxy.js:423
authorized @ server-proxy.js:188
e.server.authorized.implementation @ api-implementation.js:93
apiWrapper @ plugins.js:34
async function (async)
apiWrapper @ plugins.js:17
authorized @ api.js:191
(anonymous) @ auth-actions.ts:163
(anonymous) @ index.js:8
verifyAuthorized @ index.tsx:76
componentDidMount @ cvat-app.tsx:54
Hs @ react-dom.production.min.js:251
n.unstable_runWithPriority @ scheduler.production.min.js:18
Gr @ react-dom.production.min.js:120
Ds @ react-dom.production.min.js:244
xs @ react-dom.production.min.js:223
bs @ react-dom.production.min.js:214
rc @ react-dom.production.min.js:279
(anonymous) @ react-dom.production.min.js:285
_s @ react-dom.production.min.js:224
uc @ react-dom.production.min.js:285
render @ react-dom.production.min.js:286
(anonymous) @ index.tsx:95
t @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ cvat-ui.min.js:1

@DufeRob, try to restart CVAT server with docker-compose down, docker-compose up

UPD:
In your logs I see, UI is trying to get Data from http://localhost:8080/api/v1/users/self
Probably you still haven't setup CVAT properly

I tried all compositions of addresses. Now I have:

  environment:
      ALLOWED_HOSTS: '*'
      DJANGO_MODWSGI_EXTRA_ARGS: ""
      UI_SCHEME: http
      UI_HOST: 192.168.0.81
      UI_PORT: 7080

...

cvat_ui:
    container_name: cvat_ui
    image: nginx
    restart: always
    build:
      context: .
      args:
        http_proxy:
        https_proxy:
        no_proxy:
        socks_proxy:
        REACT_APP_API_PROTOCOL: http
        REACT_APP_API_HOST: 192.168.0.81
        REACT_APP_API_PORT: 8080
      dockerfile: Dockerfile.ui

I restarted CVAT server one more time and have the same error.

Just pitching in to confirm that with the *HOST fields overridden localhost->[local network ip4] I still get redirects to localhost between ui and backend.

Would love to get this working easily :)

you need to rebuild the docker since the args of cvat_ui are parsed at build time

@hunter-87 , you are right. It works! Thank you!

@to266

Permanent redirect can be cached by your browser. Try to clear cache or open CVAT in a private tab.

To help anyone out there with complete solution:
Create in cvat home directory file docker-compose.override.yml and place there this:

version: "2.3"

services:
  cvat:
    environment:
      ALLOWED_HOSTS: '*'
      UI_SCHEME: http
      UI_HOST: 192.168.1.74
      UI_PORT: 7080 

  cvat_ui:
    build:
      args:
        REACT_APP_API_PROTOCOL: http
        REACT_APP_API_HOST: 192.168.1.74
        REACT_APP_API_PORT: 8080

replace IP with your own.
After that rebuild everything with

docker-compose -f docker-compose.yml -f components/auto_segmentation/docker-compose.auto_segmentation.yml -f docker-compose.override.yml build

then execute docker-compose up -d and with chrome incognito mode window open your_ip:8080

@Luonic what if the IP is a dynamic one, e.g., running cvat on k8s, external ip is not known until the service is ready.

@valiantljk to run this on kubernetes you will have, probably, heavily rewrite dockerfiles and make address configurable on run. My post was summary of this thread for fast and easy problem solving

@valiantljk to run this on kubernetes you will have, probably, heavily rewrite dockerfiles and make address configurable on run. My post was summary of this thread for fast and easy problem solving

Hi, if I have cvat and cvat-ui on different host, say cvat-host, and cvat-ui-host, what should be the
REACT_APP_API_HOST and UI_HOST?

Was this page helpful?
0 / 5 - 0 ratings