* split

* split2

* more splitting

* working

* towards working

* menu changes

* run through prepare

* minorfix

* octoprint_generic

* break in template

* replace daemonpath with octoexec

* move first install to instance

* move BASE to instance

* instance fix

* double period

* damn loop!

* add camera to deploy

* fix camera

* toward functional

* main_menu if not ready

* not equal or  -ne?

* template copy

* clean ups

* byid camera detect

* do byid detect by default

* classwebcam

* classicwebcam

* appned_value camera work

* use users for modification in cameras

* fancy colors

* updating colors

* status menu colors and cams

* surpress errors on no files

* remove most logging

* dnf mods

* selinux

* redirect error output to /dev/null

* package cleanup

* remove udev, cloud

* octopi update

* resource prepare from menu

* quick fix

* pacman fix

* more echos

* add udev flag in /etc/octoprint_deploy

* opensuse fixes

* zypper, minor fixes

* change_streamer

* diagnostics, octoprint_cameras, etc

* diagnostic menu

* logging for diagnostics

* add config.yaml to diagnostics

* add logging for config.yaml

* readme work, add deb_pacakges for octopi,

* README

* port fixing

* port fixes

* add deb_packages command for troubleshooting

* fix ports

* add octopi flag, I fucking hate octopi

* udev rule work

* add/remove udev

* menu fix

* menu fixes

* add detect printer for add_udev

* better detection for remove_udev

* remove udev

* working on sed for udev

* fixed udev remove

* camera udev

* add instace to add_udev_camera

* readme, cleanup

* choose what parts of template to copy

* rsync as user

* additionalPorts

* remove cameras from camera list
This commit is contained in:
paukstelis
2023-06-25 17:09:01 -04:00
committed by GitHub
parent fdf750cd6e
commit 8d57a478be
11 changed files with 1861 additions and 1882 deletions

View File

@@ -1,74 +1,60 @@
Updated May 24, 2023.
Updated June 24, 2023.
Want to support this work? Buy Me a Coffee. https://www.buymeacoffee.com/ppaukstelis.
Need help with octoprint_deploy? Ask on Discord: https://discord.gg/6vgSjgvR6u
# octoprint_deploy
These files provide a bash script for quickly deploying multiple octoprint instances on a single computer. For Linux systems (Ubuntu, Fedora, etc.) it will also install OctoPrint and a video streamer (mjpg-streamer or ustreamer). No need for lots of file editing or complicated Docker compose scripts! A background video on how it works from my ERRF2022 talk can be found here: https://www.youtube.com/watch?v=q0iCNl8-kJI&t=15378s
# octoprint_deploy 1.0.0 - ALL NEW
* These files provide a bash script for quickly deploying multiple octoprint instances on a single computer. For Linux systems (Ubuntu, Fedora, etc.) it will also install OctoPrint and a video streamer (ustreamer). No need for lots of file editing or complicated Docker compose scripts! A background video on how it generally works from my ERRF2022 talk can be found here: https://www.youtube.com/watch?v=q0iCNl8-kJI&t=15378s
* octoprint_deploy and octoprint_install are being merged! Maintaining two separate scripts was close to twice the amount of work. By merging the scripts many new features have been included, while also providing greater simplicity in setup. For now, the merged script will be called octoprint_deploy and at some point the octoprint_install repository will point here.
* The biggest change is that there is no longer the notion of a single 'template' OctoPrint instance. Now, _any_ previously configured instance can be used as a template when a new instance is created. The choice is up to the user.
* Unfortunately, octoprint_deploy > 1.0.0 is not directly compatible with older versions, as so much has changed. If you want to use the new version of octoprint_deploy with an older setup, create backups (either with OctoPrint UI or with octoprint_deploy), then use the `remove` commandline argument before updating octoprint_deploy. Re-make your instances using the same instance names, then recover your backups.
# How to use
* OctoPi
* Slightly dated YouTube video for OctoPi setup here: https://www.youtube.com/watch?v=J5VzI4AFav4&lc
* Put the latest OctoPi image on your SD card.
* OctoPi is intended as a single printer environment. This script makes adding multiple instances easy, but it cannot take into account everything OctoPi does (mostly surrounding cameras). You have been warned.
* ssh into your Pi (pi@octopi.local; good idea to change your password now!).
* run the command `git clone https://github.com/paukstelis/octoprint_deploy.git`.
* run the command `git clone https://github.com/paukstelis/octoprint_deploy`.
* run the command `sudo octoprint_deploy/octoprint_deploy.sh`.
* Choose `Prepare System` from the menu.
* If you have already been using this system for some time, you will be prompted that files will be moved in order to generate a template instance.
* You will be prompted if you want to switch from mjpeg-streamer to ustreamer.
* You will be prompted if you want to setup the admin user and do the first run wizard using the commandline. If you do this now you can start making new instances when the system preparation is complete.
* You will be prompted if you want to install recommended plugins and cloud plugins. This can be useful if you want to configure plugins in your template instance, before adding new instances.
* If you did not setup admin user in the script, setup admin user by connecting to http://octopi.local via browser.
* Back in the ssh session, choose `New Instance` and follow the instructions.
* Do not plug your printer in by USB until you are asked to do so.
* This will register the OctoPi-created instance in octoprint_deploy.
* You will be prompted for udev detection (only needed if you are adding multiple printers).
* You will be prompted for installing a new streamer. This will be the default streamer for any _additional_ cameras that are installed.
* To add more printers choose `Add Instance` and follow the instructions.
* You will be asked if you want to use an existing instance as a template. This will copy all files from this existing instance to your new instance.
* If your printer does not have a serial number (all Creality printers), it will detect and use the physical USB address for udev entries.
* Continue until you have added all the printers you want to use.
* haproxy entries are updated so you can connect via http://octopi.local/instancename
* To add more printers at a later date, just run the script again!
* Want to use a Pi camera? After you have made your instance(s), run the script with `sudo octoprint_deploy/octoprint_deploy.sh picam` and follow the instructions (VERY EXPERIMENTAL).
* General Linux (Ubuntu/Mint/RPiOS/Debian/Fedora/Arch/etc.)
* __You do not need to install OctoPrint using any Wiki instructions, snap, etc. The script will do it for you.__
* __You do not need to install OctoPrint using any Wiki instructions, snap, etc. The script will do it all for you.__
* octoprint_deploy uses systemd services, so avoid distros that do not use systemd by default (MX Linux or chroot based systems like Chrome+crouton)
* SELinux (Fedora) casues issues, particularly with camera services. Use at your own risk (or disable SELinux).
* Basic guide video here: https://youtu.be/1YINWQ5fNn0
* All commands assume you are operating out of your home directory.
* Install Ubuntu 20+, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, Fedora35+, or ArchLinux on your system (make sure your user is admin for sudo).
* Install git if it isn't already: `sudo apt install git` or `sudo dnf install git` or `sudo pacman -S git`.
* run the command `git clone https://github.com/paukstelis/octoprint_deploy.git`.
* Install Ubuntu 20+, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, Fedora35+, ArchLinux, or openSUSE on your system (make sure your user is admin for sudo).
* Install git if it isn't already: `sudo apt install git` or `sudo dnf install git` or `sudo pacman -S git` or `sudo zypper in git`.
* run the command `git clone https://github.com/paukstelis/octoprint_deploy`.
* run the command `sudo octoprint_deploy/octoprint_deploy.sh`.
* Choose `Prepare System` from the menu. Select your distribution type. All deb-based system use the same selection. This will install necessary packages, install OctoPrint, and start a template instance.
* Choose `Prepare System` from the menu. Select your distribution type. All deb-based system use the same selection. This will install necessary packages, install OctoPrint, and prompt you to create the first instance.
* You will be asked if you want to use haproxy. This will make your instances available on port 80 e.g. http://hostname.local/instancename/
* You will be asked which streamer you would like to install (mjpg-streamer or ustreamer).
* You will be prompted if you want to setup the admin user and do the first run wizard via the commandline. If you do this now you can start making new instances as soon as the system preparation is complete.
* You will be prompted if you want to install recommended plugins and cloud plugins. This can be useful if you want to configure plugins in your template instance, before adding new instances.
* If you didn't setup admin user in the step above, setup admin user by connecting to your system (either http://localhost:5000 or http://[hostname]:5000 via a browser
* __This instance is just a generic template used for making all your other instances. You need to make at least one instance using the script when this is done.__
* Continue with octoprint_deploy script, choose `New Instance` and follow the instructions.
* Do not plug the printer in by USB until you are asked to do so.
* You will be asked which streamer you would like to install (ustreamer, mjpg-streamer or camera-streamer). Please note, not all distributions will be compatible with camera-streamer.
* You will be prompted if you want to setup the admin user and do the first run wizard via the commandline.
* You will be prompted if you want to install recommended plugins.
* Continue with octoprint_deploy script, choose `Add Instance` and follow the instructions.
* If your printer does not have a serial number (all Creality printers) it will be detected by the USB port you plugged it in to.
* After adding the first instance, the template instance will be shutdown. This is normal.
* You can also setup a camera for the instance at this time. Follow the instructions.
* Add as many instances as you have printers, following the instructions.
* To add more printers at a later date, or to add cameras to an instance, simply run the script again (`sudo octoprint_deploy/octoprint_deploy.sh`) and choose the appropriate options.
* Remember, camera installed with this script are experimental and always will be. The script makes some basic assumptions that you may need to change later. Cameras suck up quite a bit of USB bandwidth so while it is quite straightforward to run 10 printers with a modest computer, you can't also run 10 cameras.
* What else can you do?
* Remove instances
* Add USB webcams AFTER you've created the instance
* Test USB connections
* Write udev rules without deploying instances (udev_rules.sh)
* To add more printers at a later date, or to add cameras to an instance later, simply run the script again (`sudo octoprint_deploy/octoprint_deploy.sh`) and choose the appropriate option.
* Other features from commandline arguments
* Want to get rid of everything? `sudo octoprint_deploy/octoprint_deploy.sh remove`
* Backup and restore files for an instance from the menu, or backup all instances with `sudo octoprint_deploy/octoprint_deploy backup`
* Restart all non-template instances from the command line: `sudo octoprint_deploy/octoprint_deploy.sh restart_all`
* Change udev rules for an instance with `sudo octoprint_deploy/octoprint_deploy.sh replace`
* Always a good idea to update octoprint_deploy from time-to-time with `git -C octoprint_deploy pull`
* Restart all instances from the command line: `sudo octoprint_deploy/octoprint_deploy.sh restart_all`
# Recent Changes
* Adjustments for OctoPrint 1.9.x with classic webcam now as a plugin.
* Remove cloud plugin setup for template. This causes more issues than it helps. Cloud plugins should typically be installed manually and configured for each instance.
* Verify that OctoPrint gets installed in virtual environment. Opens remove_everything prompt of executable does not exist.
* Remove path double slashes that seemed to prevented deletion of timelapse videos.
* Check for spaces in instance name, admin user, and password
* Force camera port to be greater than 7000
* Allow removal of individual camera services. Improvements to instance and camera removal.
* Haproxy fixed! No more trailing slash required! Running new octoprint_deploy on an older installation automatically update these entries.
* Multi-camera support (experimental). Clean-up of haproxy.cfg on instance removal still needs work.
* If haproxy is used, cameras stream can be placed behind it. PLEASE NOTE: if cameras are used with haproxy a relative stream path is used. This means that your stream will not show up in the Control tab unless you access with the haproxy path (http://host/instancename/) (remember, trailing slash is required!)
* Lots of changes, now octoprint_deploy 1.0.0
* Udev utility menu
* Diagnostic information from menu provides a variety of useful information about the system.
* Cameras have additional fallback detection (/dev/v4l/by-id entries)
# TODO
* Integration with OctoPi new camera stack. This may or may not happen.
* Detection of existing instances/binaries that can be used instead of a full install (preserves plugins)