blakeblackshear / frigate

NVR with realtime local object detection for IP cameras
https://frigate.video
MIT License
18.95k stars 1.73k forks source link

Local VSCode Dev Container Fails #4957

Closed mitchross closed 1 year ago

mitchross commented 1 year ago

Describe the problem you are having

Tying to load local VS code dev container to contribute to code base.

Following the contribution guide. Already ran make.

Version

Dev Branch Jan 7 2023

Frigate config file

NA

Relevant log output

2023-01-08T02:28:34.962Z] [+] Building 2.7s (9/9) FINISHED                                                
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 157B                                          0.0s
 => [internal] load build definition from Dockerfile-with-features         0.0s
 => => transferring dockerfile: 11.99kB                                    0.0s
 => resolve image config for docker.io/docker/dockerfile:1.2               0.6s
 => CACHED docker-image://docker.io/docker/dockerfile:1.2@sha256:e2a8561e  0.0s
 => => resolve docker.io/docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2  0.0s
 => [internal] load build definition from Dockerfile-with-features         0.0s
[2023-01-08T02:28:34.963Z]  => [internal] load .dockerignore                                          0.0s
 => ERROR [internal] load metadata for docker.io/library/dev_container_fe  1.8s
 => CANCELED [internal] load metadata for docker.io/library/debian:11      1.8s
 => CANCELED [internal] load metadata for docker.io/library/debian:11-sli  1.8s
------
 > [internal] load metadata for docker.io/library/dev_container_feature_content_temp:latest:
------
failed to solve: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
[2023-01-08T02:28:34.975Z] Stop (3618 ms): Run: docker-compose --project-name frigate -f /Users/mitchross/Documents/Programming/frigate/docker-compose.yml -f /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1673144911356.yml build
[2023-01-08T02:28:34.976Z] Error: Command failed: docker-compose --project-name frigate -f /Users/mitchross/Documents/Programming/frigate/docker-compose.yml -f /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data/docker-compose/docker-compose.devcontainer.build-1673144911356.yml build
[2023-01-08T02:28:34.976Z]     at pF (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1850:431)
[2023-01-08T02:28:34.976Z]     at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[2023-01-08T02:28:34.976Z]     at async foe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1850:2457)
[2023-01-08T02:28:34.977Z]     at async loe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1832:2396)
[2023-01-08T02:28:34.977Z]     at async Poe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:2301)
[2023-01-08T02:28:34.978Z]     at async Zf (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:3278)
[2023-01-08T02:28:34.978Z]     at async aue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15276)
[2023-01-08T02:28:34.978Z]     at async oue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15030)
[2023-01-08T02:28:34.985Z] Stop (9418 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-08T02:28:34.986Z] Exit code 1
[2023-01-08T02:28:34.993Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true
[2023-01-08T02:28:34.993Z] Exit code 1

FFprobe output from your camera

NA

Frigate stats

BAS

Operating system

Other

Install method

Docker Compose

Coral version

USB

Network connection

Wired

Camera make and model

NA

Any other information that may be helpful

Just Local Dev Container in Mac OS.

NickM-27 commented 1 year ago

If you're running on macOS you need to comment out the dev/dri and dev/usb lines for the device and volume mounts.

If you're running an m1 you also need to comment out the ov-converter in Dockerfile

mitchross commented 1 year ago

Even when I comment out the usb line in docker compose, the VS code dev container fails to load.

NOTE - This is a issue with the vscode dev container

[2023-01-08T17:26:49.073Z] Dev Containers 0.266.1 in VS Code 1.74.2 (e8a3071ea4344d9d48ef8a4df2c097372b0c5161). [2023-01-08T17:26:49.072Z] Start: Resolving Remote [2023-01-08T17:26:49.144Z] Setting up container for folder or workspace: /Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.153Z] Start: Check Docker is running [2023-01-08T17:26:49.156Z] Start: Run: docker version --format {{.Server.APIVersion}} [2023-01-08T17:26:49.408Z] Stop (252 ms): Run: docker version --format {{.Server.APIVersion}} [2023-01-08T17:26:49.409Z] Server API version: 1.41 [2023-01-08T17:26:49.409Z] Stop (256 ms): Check Docker is running [2023-01-08T17:26:49.410Z] Start: Run: docker volume ls -q [2023-01-08T17:26:49.605Z] Stop (195 ms): Run: docker volume ls -q [2023-01-08T17:26:49.622Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=/Users/mitchross/Documents/Programming/frigate --filter label=vsch.quality=stable [2023-01-08T17:26:49.746Z] Stop (124 ms): Run: docker ps -q -a --filter label=vsch.local.folder=/Users/mitchross/Documents/Programming/frigate --filter label=vsch.quality=stable [2023-01-08T17:26:49.747Z] Start: Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.860Z] Stop (113 ms): Run: docker ps -q -a --filter label=devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate [2023-01-08T17:26:49.861Z] Start: Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2023-01-08T17:26:50.289Z] (node:94782) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. [2023-01-08T17:26:50.290Z] (Use Code Helper --trace-deprecation ... to show where the warning was created) [2023-01-08T17:26:50.292Z] @devcontainers/cli 0.25.2. Node.js v16.14.2. darwin 22.3.0 x64. [2023-01-08T17:26:50.292Z] Start: Run: docker buildx version [2023-01-08T17:26:50.494Z] Stop (202 ms): Run: docker buildx version [2023-01-08T17:26:50.495Z] github.com/docker/buildx v0.9.1 ed00243a0ce2a0aee75311b06e32d33b44729689 [2023-01-08T17:26:50.496Z] [2023-01-08T17:26:50.496Z] Start: Resolving Remote [2023-01-08T17:26:50.503Z] Running the initializeCommand from devcontainer.json...

[2023-01-08T17:26:50.503Z] Start: Run: /bin/sh -c .devcontainer/initialize.sh [2023-01-08T17:26:51.093Z] config/config.yml already exists, skipping initialization [2023-01-08T17:26:51.095Z] Stop (592 ms): Run: /bin/sh -c .devcontainer/initialize.sh [2023-01-08T17:26:51.096Z] [2023-01-08T17:26:51.097Z] Start: Run: docker-compose version --short [2023-01-08T17:26:51.295Z] Stop (198 ms): Run: docker-compose version --short [2023-01-08T17:26:51.295Z] Docker Compose version: 2.13.0 [2023-01-08T17:26:51.296Z] Start: Run: docker ps -q -a --filter label=com.docker.compose.project=frigate --filter label=com.docker.compose.service=devcontainer [2023-01-08T17:26:51.485Z] Stop (189 ms): Run: docker ps -q -a --filter label=com.docker.compose.project=frigate --filter label=com.docker.compose.service=devcontainer [2023-01-08T17:26:51.486Z] Start: Run: docker inspect --type container 0933e41210e1 [2023-01-08T17:26:51.619Z] Stop (133 ms): Run: docker inspect --type container 0933e41210e1 [2023-01-08T17:26:51.622Z] Start: Inspecting container [2023-01-08T17:26:51.623Z] Start: Run: docker inspect --type container 0933e41210e113809006117bee55e91530284d738958fa17a562c8c25f32549b [2023-01-08T17:26:51.781Z] Stop (158 ms): Run: docker inspect --type container 0933e41210e113809006117bee55e91530284d738958fa17a562c8c25f32549b [2023-01-08T17:26:51.781Z] Stop (159 ms): Inspecting container [2023-01-08T17:26:51.782Z] Start: Run in container: /bin/sh [2023-01-08T17:26:51.792Z] Start: Run in container: uname -m [2023-01-08T17:26:51.926Z] Stop (144 ms): Run in container: /bin/sh [2023-01-08T17:26:51.927Z] Shell server terminated (code: 126, signal: null) [2023-01-08T17:26:51.927Z] unable to find user vscode: no matching entries in passwd file [2023-01-08T17:26:51.926Z] Start: Run in container: cat /etc/passwd [2023-01-08T17:26:51.927Z] Stdin closed! [2023-01-08T17:26:51.928Z] Error: An error occurred setting up the container. [2023-01-08T17:26:51.928Z] at loe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1832:2820) [2023-01-08T17:26:51.928Z] at process.processTicksAndRejections (node:internal/process/task_queues:96:5) [2023-01-08T17:26:51.928Z] at async Poe (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:2301) [2023-01-08T17:26:51.928Z] at async Zf (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:1899:3278) [2023-01-08T17:26:51.928Z] at async aue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15276) [2023-01-08T17:26:51.928Z] at async oue (/Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js:2020:15030) [2023-01-08T17:26:51.936Z] Stop (2075 ms): Run: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2023-01-08T17:26:51.937Z] Exit code 1 [2023-01-08T17:26:51.942Z] Command failed: /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node /Users/mitchross/.vscode/extensions/ms-vscode-remote.remote-containers-0.266.1/dist/spec-node/devContainersSpecCLI.js up --user-data-folder /Users/mitchross/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-containers/data --workspace-folder /Users/mitchross/Documents/Programming/frigate --workspace-mount-consistency cached --id-label devcontainer.local_folder=/Users/mitchross/Documents/Programming/frigate --log-level debug --log-format json --config /Users/mitchross/Documents/Programming/frigate/.devcontainer/devcontainer.json --default-user-env-probe loginInteractiveShell --mount type=volume,source=vscode,target=/vscode,external=true --skip-post-create --update-remote-user-uid-default on --mount-workspace-git-root true [2023-01-08T17:26:51.942Z] Exit code 1

NickM-27 commented 1 year ago

There's multiple usb lines and also the dockerfile lines. I run on macOS and commenting those out works as expected

What mac are you running on? I run MacBook Pro M1 Pro 14"

mitchross commented 1 year ago

x86 macbook pro .... which lines in docker file specifically? I see quite a bit of usb related items in the docker file and dont want to over comment out and break integrity of the image.

image

NickM-27 commented 1 year ago

that looks correct as far as comments go. Just remembered you may need to run docker buildx use default to fix a compatibility issue

NickM-27 commented 1 year ago

also be sure that you are rebuilding the dev container in vscode and not just refreshing the window, refreshing the window will not bring in the new docker compose file

mitchross commented 1 year ago

also be sure that you are rebuilding the dev container in vscode and not just refreshing the window, refreshing the window will not bring in the new docker compose file

is there a special command to rebuild dev container in vscode? Or are you just referring to running "Make"..

I'll also try "docker buildx use default" too ....

NickM-27 commented 1 year ago

Yes in the top menu there is the command palette menu which has the option to rebuild container. By the way running make in the CLI won't do anything, the dev container builds the image inside anyway.

mitchross commented 1 year ago

Yes in the top menu there is the command palette menu which has the option to rebuild container. By the way running make in the CLI won't do anything, the dev container builds the image inside anyway.

Thanks.. I am following this verbatium.. does it need to be updated maybe?

image

NickM-27 commented 1 year ago

you are following the stable contributor docs which would be applicable for master. The dev branch has many changes and the contributor docs would be the preview docs https://deploy-preview-4055--frigate-docs.netlify.app/development/contributing

mitchross commented 1 year ago

That might explain quite a bit... alright im trying rebuild container from command pallet.. I didnt know that was a thing till now...

mitchross commented 1 year ago

ok the combo of

usb comment out, docker buildx use default, and command pallet docker dev container rebuild resolved this. Thanks!

NickM-27 commented 1 year ago

Feel free to create a PR to update the docs.

mitchross commented 1 year ago

Yea I think the web docs need updating too. There is no more npm start from what I can tell. Looks like the swtich to vite means we need to run ' npm run dev '

mitchross commented 1 year ago

@NickM-27 any tips for starting web local? Im getting CORS issues and 403 issues

NickM-27 commented 1 year ago

npm run dev should do it, then access on localhost:5173

mitchross commented 1 year ago
image
NickM-27 commented 1 year ago

Did you start frigate by running python3 -m frigate

mitchross commented 1 year ago

yup

NickM-27 commented 1 year ago

Is it still running (didn't error out)? I've never seen that when frigate is running.

mitchross commented 1 year ago
image image image image
NickM-27 commented 1 year ago

weird, I'd make sure you don't have any firewalls up or anything, never had any issues with that. If you run curl http://localhost:5000/api what do you get?

mitchross commented 1 year ago

@NickM-27

image
NickM-27 commented 1 year ago

Maybe restart vscode again, seems the nginx service may not the running or else there's some other issue not allowing access to that port.

mitchross commented 1 year ago

Maybe restart vscode again, seems the nginx service may not the running or else there's some other issue not allowing access to that port.

Thats after a fresh restart ^

Docker hub shows no ports exposed for the dev container... Is the docker compose supposed to expose ports here? or even the vs code container? Cause they are definately not exposed outside docker.

NickM-27 commented 1 year ago

The ports are all defined here: https://github.com/blakeblackshear/frigate/blob/5b7cd9ce64df6032f97ef7b7f01e1da1fd287aa1/.devcontainer/devcontainer.json#L14

When I look in vscode I can see all the ports in the ports tab next to terminal

mitchross commented 1 year ago
image
mitchross commented 1 year ago
image
mitchross commented 1 year ago

it seems 5000 / nginix is the issue? 5001 seems ok?

image
NickM-27 commented 1 year ago

interesting, not sure why nginx wouldn't be running

mitchross commented 1 year ago

Is there a way I can force it up in the container?

NickM-27 commented 1 year ago

You can try running exec nginx

NickM-27 commented 1 year ago

I've gone ahead and done a fresh vscode dev image build and all is still working well for me, just to confirm that the recent nginx changes don't seem to be the issue

mitchross commented 1 year ago

I have tried several macs, several linux pcs, and It still fails to builds the vs code container. Would you mind posting step by step process to get frigate dev containers working? Id love to contribute to this project but it just wont work on a single PC regardless of OS. The getting started contribution guide must be missing a step. @NickM-27

NickM-27 commented 1 year ago

What issue are you running into at this point?

NickM-27 commented 1 year ago

Also want to confirm you're following the latest dev docs and not the outdated stable docs https://deploy-preview-4055--frigate-docs.netlify.app/development/contributing

mitchross commented 1 year ago

step 1 pull dev branch step 2 comment out nvidia/usb in docker compose step 3 open dev branch in vs code step 4 command P , rebuild container and open step 5. errors out

ive tried on mac os, ubuntu, popOS, wsl2, etc

blakeblackshear commented 1 year ago

What errors are you getting? Is it failing to build the dev container? You should be able to see the logs.

mitchross commented 1 year ago

Here are the logs https://gist.github.com/mitchross/9c62536d7f8f3c504e878c8793e956fa

NickM-27 commented 1 year ago

So to confirm, you are running on the dev branch correct? Maybe @felipecrs might have an idea, I've not seen the container fail there before

mitchross commented 1 year ago

Yup fresh git pull dev branch

~/frigate$ git status On branch dev Your branch is up to date with 'origin/dev'.

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: docker-compose.yml

no changes added to commit (use "git add" and/or "git commit -a")

felipecrs commented 1 year ago

You have to poll the logs for the frigate container:

docker logs -f frigate-devcontainer

Try to get the logs for when it fails.

felipecrs commented 1 year ago

Actually, @NickM-27, I think this may be fixed by #5545 (otherwise go2rtc in the devcontainer fails to start, which causes the container to exit).

mitchross commented 1 year ago

image

NickM-27 commented 1 year ago

Oh, I know why that happens

felipecrs commented 1 year ago

@mitchross yeah, that's the problem. You can try to checkout PR 5545 and try again. It should work.

NickM-27 commented 1 year ago

@felipecrs it is a problem with logic in create_go2rtc_config and will need to be fixed separately

felipecrs commented 1 year ago

@NickM-27, it's fixed already by:

https://github.com/blakeblackshear/frigate/pull/5545/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R210-R212

NickM-27 commented 1 year ago

@NickM-27, it's fixed already by:

https://github.com/blakeblackshear/frigate/pull/5545/files#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R210-R212

Ah, beautiful

mitchross commented 1 year ago

Will the PR merge any time soon? if it merges today, I can wait to re-test