Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remote connect #930

Closed
DufeRob opened this issue Dec 10, 2019 · 17 comments
Closed

Unable to remote connect #930

DufeRob opened this issue Dec 10, 2019 · 17 comments
Labels
question Further information is requested

Comments

@DufeRob
Copy link

DufeRob commented Dec 10, 2019

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"

@bsekachev
Copy link
Member

@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.

@bsekachev bsekachev added the question Further information is requested label Dec 11, 2019
@DufeRob
Copy link
Author

DufeRob commented Dec 12, 2019

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.

@bsekachev
Copy link
Member

bsekachev commented Dec 12, 2019

@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

@DufeRob
Copy link
Author

DufeRob commented Dec 12, 2019

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

@bsekachev
Copy link
Member

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

@DufeRob
Copy link
Author

DufeRob commented Dec 13, 2019

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

@bsekachev
Copy link
Member

bsekachev commented Dec 13, 2019

@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

@DufeRob
Copy link
Author

DufeRob commented Dec 13, 2019

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.

@to266
Copy link

to266 commented Dec 13, 2019

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 :)

@matteo-bruni
Copy link

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

@DufeRob
Copy link
Author

DufeRob commented Dec 14, 2019

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

@DufeRob DufeRob closed this as completed Dec 14, 2019
@bsekachev
Copy link
Member

@to266

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

@Luonic
Copy link

Luonic commented Dec 25, 2019

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

@valiantljk
Copy link

@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.

@Luonic
Copy link

Luonic commented Dec 29, 2019

@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
Copy link

@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?

@cdinea
Copy link

cdinea commented Jan 31, 2023

@DufeRob @Luonic hi! Following up on this. I create a new docker file per #930 (comment) . And when I run the docker-compose command I ran into these errors:
docker-compose -f docker-compose.yml -f components/serverless/docker-compose.serverless.yml -f docker-compose.override.yml build
WARNING: The no_proxy variable is not set. Defaulting to a blank string.
ERROR: The Compose file is invalid because:
Service cvat_ui has neither an image nor a build context specified. At least one must be provided.

Can you kindly advise? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants