nunofgs / docker-octoprint

Dockerfile to set up Octoprint with x86, armv6, armv7 and arm64 support!
https://hub.docker.com/r/nunofgs/octoprint/
GNU Affero General Public License v3.0
58 stars 32 forks source link

Installation troubles and solutions #6

Closed reloxx13 closed 5 years ago

reloxx13 commented 5 years ago

Heya,

for everyone who got installation troubles of this docker imager, here is my exp so far:

pi 3b+ rasbian

this is my docker run command:

take a note at the --device lines which is unclear in the readme.

#install OctoPrint
docker run -d  \
  --restart=unless-stopped \
  --name=OctoPrint \
  -p 1337:80 \
  --device=/dev/video0:/dev/video0 \
  --device=/dev/ttyUSB0:/dev/ttyUSB0 \
  -v /home/pi/Docker/OctoPrint/data:/data \
  -e STREAMER_FLAGS="-y -n -r 1280x720 -f 10" \
  nunofgs/octoprint:latest 

i use a logitech c920 webcam, you can get your STREAMER_FLAGS config from here: https://github.com/foosel/OctoPrint/wiki/Webcams-known-to-work

Unfortunately the resolution is fixed in the supervisord.conf and the webcam ( mjpg_streamer ) is off by default.

orginal:

[program:mjpeg-streamer]
autostart=false
command=mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so %(ENV_STREAMER_FLAGS)s -r 640x480 -d %(ENV_CAMERA_DEV)s" -o "/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/www -p 8080"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

to change that, i copied the https://github.com/nunofgs/docker-octoprint/blob/master/supervisord.conf into /home/pi/Docker/OctoPrint/data. than i added the autostart=true and removed the -r arg. this is how it looks now:

 [program:mjpeg-streamer]
autostart=true
command=mjpg_streamer -i "/usr/local/lib/mjpg-streamer/input_uvc.so %(ENV_STREAMER_FLAGS)s -d %(ENV_CAMERA_DEV)s" -o "/usr/local/lib/mjpg-streamer/output_http.so -w /usr/local/www -p 8080"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0

now i start the container with this: '/usr/bin/supervisord' '-c' '/data/supervisord.conf'

but i changed this with Portainer, dunno how to add this to the run command.

grafik

now i could start octoprint.

after that i added the system command to start/stop the webcam by adding this lines in the config.yml

system:
  actions:
  - action: streamon
    command: supervisorctl start mjpeg-streamer
    confirm: false
    name: Start Webcam
  - action: streamoff
    command: supervisorctl stop mjpeg-streamer
    confirm: false
    name: Stop Webcam
temperature:
  profiles:
  - bed: 70
    extruder: 210
    name: PLA
webcam:
  ffmpeg: /usr/bin/ffmpeg
  snapshot: http://127.0.0.1:8080/?action=snapshot
  stream: /webcam/?action=stream
  watermark: false

after the docker restart the quick system menu showed up: grafik

nunofgs commented 5 years ago

Thanks for the detailed issue. The fact that mjpeg-streamer was autostarted to false was due to my own use case: I don't like to have cameras turned on inside my house 24/7, which is why I only turned on the camera during the print.

I've added a new environment variable to allow you to choose the behavior, as well as removed the default resolution from the supervisorctl.conf file.

You should now be able to remove your modifications and simply start this container with your initial command (unchanged copy-paste):

docker run -d  \
  --restart=unless-stopped \
  --name=OctoPrint \
  -p 1337:80 \
  --device=/dev/video0:/dev/video0 \
  --device=/dev/ttyUSB0:/dev/ttyUSB0 \
  -v /home/pi/Docker/OctoPrint/data:/data \
  -e STREAMER_FLAGS="-y -n -r 1280x720 -f 10" \
  nunofgs/octoprint:latest 
nunofgs commented 5 years ago

Also as a sidenote, /dev/ttyUSB0 shouldn't be needed. Is this for something else in your setup?

reloxx13 commented 5 years ago

heya,

ttyUSB0 was just to be sure by trying to get it run. found it in the old bitbucket repo.

ill just let it in, than the container wont start without ttyUSB0 (giving a device not found error msg in docker log).