Closed hoganXYZ closed 6 months ago
Most obvious thing off the bat is the CAM_IP, check out this code:
connect_str
tacks on the "rtsp" stuff and rest of connection string used at runtime. Try setting CAM_IP=192.168.1.1
... I haven't tested w/ other cameras, note how connect_str2
is hardcoded to port :554
. You may need to edit that code (in main.py
) to match what your camera accepts.
Let me know if that doesn't fix it, and what other errors you run into
I'll take a look and troubleshoot for a bit, thanks again
Thanks for above, i have managed to properly add my cam ip. However, how do i start the webapp, pointing to serverip isnt starting the webapp 192.168.xx.xxx (pc ip where i ran docker compose). Also i get Bounds not set, not running AI Logic. Any advice?
@angad305 do you mind running docker logs <container_id>
try to find error logs and paste them here?
Regarding "Bounds not set", the current implementation requires the user to set the "bounds" before it starts attempting to recognize babies. This tells me that the backend image processing service is ready and waiting, which is good.
This clip demonstrates setting the bounds within the web app: https://youtu.be/8i0wHA_knKc?si=X_ACNMS9ev5wpvsn
Once you do that within the app, the log "Bounds not set" should go away. But it sounds like we gotta get the app portion working first before you can do that lol
Sure, running the logs result below:
docker-compose up baby-sleep-coach is up-to-date Attaching to baby-sleep-coach baby-sleep-coach | yarn run v1.22.19 baby-sleep-coach | $ react-scripts start& baby-sleep-coach | /bin/sh: 1: react-scripts: not found baby-sleep-coach | Done in 0.03s. baby-sleep-coach | WARNING: No module named 'pexpect' baby-sleep-coach | INFO: Created TensorFlow Lite XNNPACK delegate for CPU. baby-sleep-coach | reading focusRegionArr: [''] baby-sleep-coach | Initializing... baby-sleep-coach | baby-sleep-coach | Initialization complete. baby-sleep-coach | Start receiving frames. baby-sleep-coach | Serving Flask app 'main' baby-sleep-coach | Debug mode: on baby-sleep-coach | Bounds not set, not running AI logic. baby-sleep-coach | Bounds not set, not running AI logic.
Initialization complete. Start receiving frames.
reinstalling node and npm package fixed the issue. its up and working..
Ah, outside of docker you ran npm install
or yarn install
?
Been following this thread as I've encountered both of the same issues listed here. Updating the python code to just use connect_str = cam_ip (after the block shown above) , and then putting the full RTSP url into the config file on that line fixed the camera issue for me (my stream doesn't have a pw on it). I still can't get the UI to show up though. I'm running this on a server that has a webUI already located on port 80 and I can't seem to get it configured to use an alternate IP. I also saw the "no module named pexpect", and react-script not found lines. I'm also curious as to what reinstall command @angad305 ran (and where)
Been following this thread as I've encountered both of the same issues listed here. Updating the python code to just use connect_str = cam_ip (after the block shown above) , and then putting the full RTSP url into the config file on that line fixed the camera issue for me (my stream doesn't have a pw on it). I still can't get the UI to show up though. I'm running this on a server that has a webUI already located on port 80 and I can't seem to get it configured to use an alternate IP. I also saw the "no module named pexpect", and react-script not found lines. I'm also curious as to what reinstall command @angad305 ran (and where)
@djuniah , experienced exactly the same issue while getting the webapp on port 80 (react-script) , so basically i did the following:
as for port 80, please update the docker-compose.yml, dockerfile. @calebolson123 could guide you better in this.
Ah annoying, I think the weirdness is around a last minute sloppy change I made to mount the local dir into the docker container. Some .txt & .csv files are used to preserve state in case the app crashes, your you reboot your machine, etc.. I'll find some time to push through a PR which mounts just those relevant files.
I think it's mounting everything into the docker container and overwriting the yarn install
which you can see happens in the Dockerfile.
For now I'd suggest copying what @angad305 did to get it working, and I'll clean this up soon. Thanks for sharing your steps @angad305
Appreciate the info guys! I'll give that a shot. I'm running this on an unraid machine so the setup was a little bit more involved as compose can be a little tricky there. Pretty sure i'm close, i've got it using the correct network now and the UI is showing that the container is looking at the correct ports. The servers hosting 8000 and 8001 are both showing up and responding properly, but the webUI port (80) however isn't connecting at all. I've tried changing the port in the env file, and tried adjusting it in the compose as well (changing both to 8002, changing just env to 8002 and keeping the internal port at 80, etc.) but nothing has worked yet. I'll try the npm reinstall to see if that fixes it, thanks.
@djuniah try changing the PORT
in your .env to 81 or whatever you want it to run on and relaunch
... misread, you already did this. Another thing you can try is updating the Dockerfile to expose port 81, instead of 80. Also, mind running docker logs <container_id>
and looking for errors? Maybe it's crashing and not booting up, thus not a port/access issue
So, here's a current log. Note that I went into the main.py file and commented out the print lines for "bounds not set" so that it wouldn't fill the logs (once i adjusted the camera URL code i was getting them in the logs which i assume means it found the camera). I'll probably uncomment those once i can go in and actually set it.
/bin/sh: 1: react-scripts: not found
/usr/app/babysleepcoach/main.py:71: SyntaxWarning: "is" with a literal. Did you mean "=="?
if focusRegionArr[0] is '':
WARNING: No module named 'pexpect'
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
yarn run v1.22.19
$ react-scripts start&
Done in 0.07s.
reading focusRegionArr: ['']
Initializing...
Initialization complete.
Start receiving frames.
* Serving Flask app 'main'
* Debug mode: on
I currently have the port set to 8002 in the env file and the compose is set to - "0.0.0.0:${PORT}:80". In the webUI for docker I do see it mapping the port correctly after it launches (8002 externally visible and 80 inside the container: 172.17.0.6:80/TCP <-> 192.168.X.XXX:8002).
EDIT: I also tried to adjust the dockerfile to match and that didn't seem to affect it.
Similar log i experienced: /bin/sh: 1: react-scripts: not found. - Please check your node version, it should be >14 . Mine was 12, when i updated to 18, this was fixed.
/usr/app/babysleepcoach/main.py:71: SyntaxWarning: "is" with a literal. Did you mean "=="? you can update the line 71, replace is with ==
reading focusRegionArr: [''] - once your web app is live, there you can select a focus region, basically first thing i did, and this goes away.
Node version is 20 for me, still getting that error. I also tried editing line 71 to have "==" and that did solve the warning but didn't help with the issue i'm seeing. I still haven't re-installed node/npm yet, having some difficulty figuring out where/how to do that. I've opened a bash shell into the container and tried it there but apt isn't auto completing the package name for node properly so i'm not sure which line i need to exactly use to uninstall it. In a little while i'll try to have it list all packages to see if i can find it that way.
sudo apt remove nodejs
sudo apt remove npm
sudo apt remove--autoremove yarn
sudo apt update
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash
wait 60 seconds
then paste:
sudo apt-get install nodejs
then finally :
npm install --global yarn
Ok this is odd. If i run "apt remove nodejs" it says it's not installed, and if i check the package list for apt, it's definitely not in there. However, if i run "node -v" I get "Welcome to Node.js v20.7.0". npm and yarn are also in a similar situation.
Are you running these inside the running container?
no, i did outside the container, and then i rebuild it using:
docker-compose stop baby-sleep-coach
docker-compose rm -f baby-sleep-coach
docker-compose up --build -d baby-sleep-coach
Ah, i was running it inside the container. Why would the host system's node setup affect what's happening inside the container? I don't have node at all on the host.
my bad, it should not.
so best i could help is below:
docker exec -it <container-id> /bin/bash
if ubuntu then apt remove nodejs
if centos then yum remove nodejs
or dnf remove nodejs
According to the dockerfile this container is based on node:slim which appears to be using ubuntu. It definitely has apt, but when i ask it to remove nodejs it says it's not installed, however running "node -v" shows the version number, so it's definitely in there somewhere. Odd that this would behave differently for you and I since it should be the same container (even yours having V12 and mine having V20)
EDIT: And again, thanks for all of the replies/help
EDIT2: Tried adding "RUN npm install react-scripts" to the dockerfile just below the requirements.txt install and it did run but the "react -scripts: not found" error still persists.
Hi all. Did anyone figure out how to fix this? I am getting the same error:
babysleepcoach-baby-sleep-coach-1 | yarn run v1.22.19 babysleepcoach-baby-sleep-coach-1 | $ react-scripts start& babysleepcoach-baby-sleep-coach-1 | /bin/sh: 1: react-scripts: not found babysleepcoach-baby-sleep-coach-1 | Done in 0.09s. babysleepcoach-baby-sleep-coach-1 | WARNING: No module named 'pexpect' babysleepcoach-baby-sleep-coach-1 | INFO: Created TensorFlow Lite XNNPACK delegate for CPU. babysleepcoach-baby-sleep-coach-1 | reading focusRegionArr: [''] babysleepcoach-baby-sleep-coach-1 | Initializing... babysleepcoach-baby-sleep-coach-1 | babysleepcoach-baby-sleep-coach-1 | Initialization complete. babysleepcoach-baby-sleep-coach-1 | Start receiving frames. babysleepcoach-baby-sleep-coach-1 | Connecting to camera at: rtsp://192.168.xx.xx:7447/xxxxxxxxxx babysleepcoach-baby-sleep-coach-1 | Serving Flask app 'main' babysleepcoach-baby-sleep-coach-1 | Debug mode: on babysleepcoach-baby-sleep-coach-1 | Bounds not set, not running AI logic. babysleepcoach-baby-sleep-coach-1 | Bounds not set, not running AI logic.
I tried to remove nodejs as suggested within the container but 'apt remove nodejs' returns 'Package 'nodejs' is not installed, so not removed'
I believe that the error '/bin/sh: 1: react-scripts: not found' is preventing the webapp from launching therefore I'm unable to access the it.
Figured out the solution which I documented here: https://github.com/calebolson123/BabySleepCoach/issues/24#issuecomment-1831600730
Thanks for above, i have managed to properly add my cam ip. However, how do i start the webapp, pointing to serverip isnt starting the webapp 192.168.xx.xxx (pc ip where i ran docker compose). Also i get Bounds not set, not running AI Logic. Any advice?
I also encountered this problem. I didn't know how to open the web page after running the "docker compose up" command. I tried for two days and finally found the solution:
no, i did outside the container, and then i rebuild it using:
docker-compose stop baby-sleep-coach
docker-compose rm -f baby-sleep-coach
docker-compose up --build -d baby-sleep-coach
@angad305 Mind taking a look at my issue? My webapp shows up, but no video feed available. #35
https://github.com/calebolson123/BabySleepCoach/pull/36 brings in changes suggested by others to address these startup config issues. I think the core of the awkwardness is around mounting the whole project into the container. This is bad practice and should get cleaned up.
However after the changes merged in https://github.com/calebolson123/BabySleepCoach/pull/36, i was able to run the app on a fresh system w/ just updating .env. Those having issues, try again w/ the latest from main.
Hey Caleb, I posted a question on your video about properly configuring my IPs. Here's the content of my .env file: