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

Accessing CVAT from local network #3982

Closed
D4nyi opened this issue Dec 2, 2021 · 16 comments
Closed

Accessing CVAT from local network #3982

D4nyi opened this issue Dec 2, 2021 · 16 comments
Labels
question Further information is requested

Comments

@D4nyi
Copy link

D4nyi commented Dec 2, 2021

My actions before raising this issue

Expected Behaviour

I would like to host a CVAT site from a server at my workplace to my colleagues, but I cannot acces it from outside of the machine (only localhost)

Current Behaviour

From outside - using the servers IP address - I only get a "404 page not found" error
I ran through install guide,

Steps to Reproduce (for bugs)

  1. Follow the steps in the Install guide - Ubuntu section
  2. Try to acces the site from another machine connected to the same network as the server
  3. I also tried to manually create the stack in docker, but the cvat-server container always stopped immediately with the following error:
Error: Format string '%(ENV_HOME)s/wait-for-it.sh db:5432 -t 0 -- bash -ic \\n"/usr/bin/python3 ~/manage.py migrate && \\n/usr/bin/python3 ~/manage.py collectstatic --no-input && \\nexec /usr/bin/python3 $HOME/manage.py runmodwsgi --log-to-terminal --port 8080 \\n--limit-request-body 1073741824 --log-level INFO --include-file ~/mod_wsgi.conf \\n%(ENV_DJANGO_MODWSGI_EXTRA_ARGS)s --locale %(ENV_LC_ALL)s"' for 'program:runserver.command' contains names ('ENV_DJANGO_MODWSGI_EXTRA_ARGS') which cannot be expanded. Available names: ENV_CUDA_SUPPORT, ENV_DEXTR_MODEL_DIR, ENV_DJANGO_CONFIGURATION, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_LC_ALL, ENV_OPENVINO_TOOLKIT, ENV_PATH, ENV_REID_MODEL_DIR, ENV_TERM, ENV_TF_ANNOTATION, ENV_TF_ANNOTATION_MODEL_PATH, ENV_USER, ENV_WITH_DEXTR, ENV_http_proxy, ENV_https_proxy, ENV_no_proxy, ENV_socks_proxy, group_name, here, host_node_name, process_num, program_name in section 'program:runserver' (file: 'supervisord.conf')
For help, use /usr/bin/supervisord -h

Your Environment

  • Git hash commit (git log -1): commit 9d21b20845e59863488c4a5bbd049721fe897610 (HEAD -> develop, origin/develop, origin/HEAD)
  • Docker version docker version (e.g. Docker 17.0.05): Version: 20.10.11
  • Are you using Docker Swarm or Kubernetes?: No
  • Operating System and version (e.g. Linux, Windows, MacOS): Ubuntu Server 20.04.3 LTS
@azhavoro
Copy link
Contributor

azhavoro commented Dec 2, 2021

https://openvinotoolkit.github.io/cvat/docs/faq/#how-to-change-default-cvat-hostname-or-port
Just set env variable export CVAT_HOST=<YOUR_HOSTNAME_OR_IP> and restart docker containers with docker-compose down && docker-compose up -d

@azhavoro azhavoro added the question Further information is requested label Dec 2, 2021
@D4nyi
Copy link
Author

D4nyi commented Dec 3, 2021

Thank you but it only worked for like 10 minutes and I was not able to login with the admin user I created.
Now I have the same problem 404 page not found and a new one sometimes Gateway Timeout.

What I did:

  • Wit all my tries in the docker-compose.yml file I uncommented the configuration for the Traefik dashboard
  • set the mentioned env variable export CVAT_HOST=<YOUR_HOSTNAME_OR_IP> and restarted the containers with sudo docker-compose down && sudo docker-compose up -d
  • After that UI came up but it could not connect to the backend
  • I suspected that I might have messed up something so I did a full clean reinstall
    • deleted the conatiners, images and volumes
    • with sudo docker container | image | volume rm
  • then I recloned the repo and installed the containers: sudo -E docker-compose up -d

I also tried:

  • changing the branch from the default develop to release-1.7.0 and did a full clean install
  • install the containers: sudo docker-compose up -d like mentioned here
    • also with and without the -E flag on sudo
  • also those suggestions that can be found this issue: Could not login on the server #1532

Am I doing something wrong?
Can it be a problem that the server does not have a static IP address (DHCP)?

Env

containers started with: sudo -E docker-compose -f docker-compose.yml up -d
env var: CVAT_HOST=<SERVER_IP>

$ git log -1
commit 2bb8643c1aba53b9ee4fd836b0955340f61d80ed (HEAD -> release-1.7.0, origin/release-1.7.0)
Author: Nikita Manovich <[email protected]>
Date:   Tue Nov 9 09:23:15 2021 +0300

    Updated release date, froze CHANGELOG

$ sudo docker version
Client: Docker Engine - Community
 Version:           20.10.11
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        dea9396
 Built:             Thu Nov 18 00:37:06 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.11
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       847da18
  Built:            Thu Nov 18 00:35:15 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

$ sudo docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

A part from cvat server's log that may help:

WARNINGS:
?: (urls.W005) URL namespace 'v1' isn't unique. You may not be able to reverse all URLs in this namespace

2021-12-03 08:53:14,200 DEBG 'runserver' stdout output:
Server URL         : http://localhost:8080/
Server Root        : /tmp/cvat-server
Server Conf        : /tmp/cvat-server/httpd.conf
Error Log File     : /dev/stderr (INFO)
Request Capacity   : 5 (1 process * 5 threads)
Request Timeout    : 60 (seconds)
Startup Timeout    : 15 (seconds)
Queue Backlog      : 100 (connections)
Queue Timeout      : 45 (seconds)
Server Capacity    : 20 (event/worker), 20 (prefork)
Server Backlog     : 500 (connections)
Locale Setting     : C.UTF-8

2021-12-03 08:53:14,237 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.236778 2021] [mpm_event:notice] [pid 16:tid 139813010869312] AH00489: Apache/2.4.41 (Ubuntu) mod_wsgi/4.7.1 Python/3.8 configured -- resuming normal operations
[Fri Dec 03 08:53:14.236849 2021] [mpm_event:info] [pid 16:tid 139813010869312] AH00490: Server built: 2021-10-14T16:24:43
[Fri Dec 03 08:53:14.236853 2021] [core:notice] [pid 16:tid 139813010869312] AH00094: Command line: 'apache2 (mod_wsgi-express) -f /tmp/cvat-server/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND'

2021-12-03 08:53:14,237 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.236932 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731): Starting process 'localhost:8080' with threads=5.

2021-12-03 08:53:14,237 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.237730 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731): Python home /opt/venv.

2021-12-03 08:53:14,238 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.237828 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731): Initializing Python.

2021-12-03 08:53:14,277 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.277291 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731): Attach interpreter ''.

2021-12-03 08:53:14,282 DEBG 'runserver' stderr output:
[Fri Dec 03 08:53:14.282239 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731): Imported 'mod_wsgi'.
[Fri Dec 03 08:53:14.282288 2021] [wsgi:info] [pid 1731:tid 139813010869312] mod_wsgi (pid=1731, process='localhost:8080', application=''): Loading Python script file '/tmp/cvat-server/handler.wsgi'.

@azhavoro
Copy link
Contributor

azhavoro commented Dec 8, 2021

Can it be a problem that the server does not have a static IP address (DHCP)?

Definitely yes, if SERVER_IP has changed, you need to restart containers with new configuration, is it possible in your case to use hostname instead of IP?

@DavidAdamczyk
Copy link

I have the same issue. The env variable CVAT_HOST was set to hostname or IP address but this still does not work. 👎🏻

@azhavoro
Copy link
Contributor

azhavoro commented Dec 8, 2021

I have the same issue. The env variable CVAT_HOST was set to hostname or IP address but this still does not work. 👎🏻

What exactly is the http error code in your case? Make sure the output of docker inspect -f '{{ index .Config.Labels "traefik.http.routers.cvat.rule" }}' cvat contains the expected IP or hostname. Have you tried accessing cvat from the host machine with curl -Lv localhost:8080?

@macimovic
Copy link

macimovic commented Dec 8, 2021

In addition to setting the CVAT_HOST enviroment variable I also needed to modify the docker-compose.yml like so

    image: traefik:v2.4
    container_name: traefik
    restart: always
    command:
      - "--providers.docker.exposedByDefault=false"
      - "--providers.docker.network=cvat"
      - "--entryPoints.web.address=:80"
    # Uncomment to get Traefik dashboard
      - "--entryPoints.dashboard.address=:8090"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      - "--api.debug=true"
      - "--log.level=DEBUG"
    labels:
      - traefik.enable=true
      - traefik.http.routers.dashboard.entrypoints=dashboard
      - traefik.http.routers.dashboard.service=api@internal
      - traefik.http.routers.dashboard.rule=Host(`${CVAT_HOST:-localhost}`)
    ports:
      - 80:80
      - 8080:8080
      - 8090:8090
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - cvat

@azhavoro
Copy link
Contributor

azhavoro commented Dec 9, 2021

In addition to setting the CVAT_HOST enviroment variable I also needed to modify the docker-compose.yml like so

    image: traefik:v2.4
    container_name: traefik
    restart: always
    command:
      - "--providers.docker.exposedByDefault=false"
      - "--providers.docker.network=cvat"
      - "--entryPoints.web.address=:80"
    # Uncomment to get Traefik dashboard
      - "--entryPoints.dashboard.address=:8090"
      - "--api.dashboard=true"
      - "--api.insecure=true"
      - "--api.debug=true"
      - "--log.level=DEBUG"
    labels:
      - traefik.enable=true
      - traefik.http.routers.dashboard.entrypoints=dashboard
      - traefik.http.routers.dashboard.service=api@internal
      - traefik.http.routers.dashboard.rule=Host(`${CVAT_HOST:-localhost}`)
    ports:
      - 80:80
      - 8080:8080
      - 8090:8090
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      - cvat

It doesn't matter which internal port traefik is listening on, it is enough to change only the external (host) port for the traefik service as described here. https://openvinotoolkit.github.io/cvat/docs/faq/#how-to-change-default-cvat-hostname-or-port

@D4nyi
Copy link
Author

D4nyi commented Dec 9, 2021

I did not get closer to the solution.
I checked the server IP and it hasn't changed since I'm trying to install CVAT.

What exactly is the http error code in your case? Make sure the output of docker inspect -f '{{ index .Config.Labels "traefik.http.routers.cvat.rule" }}' cvat contains the expected IP or hostname. Have you tried accessing cvat from the host machine with curl -Lv localhost:8080?

If I export CVAT_HOST=<SERVER_IP> and run CVAT like: sudo -E docker-compose up -d I get the following result:

Host(`<SERVER_IP>`) && PathPrefix(`/api/`, `/git/`, `/opencv/`, `/analytics/`, `/static/`, `/admin`, `/documentation/`, `/django-rq`)

And I'm no longer be able to reach the server on localhost, nor from outside, on any listed ports (80, 8080, 8090).

If I omit the -E flag from sudo I can reach the server on localhost:8080, but it still unreachable from outside.

I also tried what @macimovic mentioned; what it did is that the traefik dashboard came up on all three ports.

@azhavoro
Copy link
Contributor

azhavoro commented Dec 9, 2021

@D4nyi

And I'm no longer be able to reach the server on localhost, nor from outside, on any listed ports (80, 8080, 8090).

What is the exact http error code you are getting? Please attach output of curl -Lv server_ip:8080 next time

@D4nyi
Copy link
Author

D4nyi commented Dec 13, 2021

From the server to the server:

*   Trying <SERVER_IP>:8080...
* connect to <SERVER_IP> port 8080 failed: Connection timed out
* Failed to connect to <SERVER_IP> port 8080: Connection timed out
* Closing connection 0
curl: (28) Failed to connect to <SERVER_IP> port 8080: Connection timed out

From server to localhost:

$ curl -Lv localhost:8080
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.71.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Mon, 13 Dec 2021 08:51:27 GMT
< Content-Length: 19
<
404 page not found
* Connection #0 to host localhost left intact

From another machine to the server:

*   Trying <SERVER_IP>:8080...
* TCP_NODELAY set
* connect to 10.224.83.26 port 8080 failed: Connection timed out
* Failed to connect to <SERVER_IP> port 8080: Connection timed out
* Closing connection 0
curl: (28) Failed to connect to <SERVER_IP> port 8080: Connection timed out

@eduardocarnunes
Copy link

@D4nyi
did you solve the problem? I'm also having the same problem :(

@bkbilly
Copy link

bkbilly commented Jul 12, 2022

If anyone is interested, I found a way to access CVAT from any hostname. It is very useful for me because I can now access it with the machine IP, as localhost or even as a tunnel using ngrok.

I've modified the traefik rules on the official docker-compose.yml file.
You can find the file here.

@bsekachev
Copy link
Member

Sorry for lack of response from our side. There are too many issues opened. I am trying to reduce them now and I will close this issue.

Please, if the question is still relevant, let us know and do not hesitate to reopen.

Generally, if you want to change default host/port, please try to follow the manual first: https://opencv.github.io/cvat/docs/faq/#how-to-change-default-cvat-hostname-or-port

@ArminLee
Copy link

@D4nyi
Hi, did you solve this issue? I also have the same problem.

@narbhar
Copy link

narbhar commented Nov 21, 2022

If anyone is interested, I found a way to access CVAT from any hostname. It is very useful for me because I can now access it with the machine IP, as localhost or even as a tunnel using ngrok.

I've modified the traefik rules on the official docker-compose.yml file. You can find the file here.

This solved it. Thanks!

@rainkissthesun
Copy link

I messed up the cvat host, and I got 404 page not found. Then I was struggling to reset to default of the cvat host. export CVAT_HOST=localhost did not solve the issue. Luckily, after running curl -Lv localhost:8080, I can not see the login page from chrome. What I did:

  1. turn off all containers: docker compose down
  2. export CVAT_HOST=localhost
  3. docker compose up -d
  4. curl -Lv localhost:8080
    Please know that you should use docker-compose if dock compose does not work.

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

10 participants