haproxy in remove all

This commit is contained in:
paukstelis
2022-05-28 09:25:27 -04:00
parent fd9e39ce27
commit bc0507ee06
2 changed files with 14 additions and 11 deletions

View File

@@ -2,7 +2,7 @@ Updated May 2022.
Want to support this work? Buy Me a Coffee. https://www.buymeacoffee.com/ppaukstelis.
Need help with octoprint_deploy? You can open issues here or ask on Discord: https://discord.gg/6vgSjgvR6u
# octoprint_deploy
These files provide a simple 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).
These files provide a simple 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!
# BIG CHANGES
As of 02/22 there is no longer a need to download a specific image file.
@@ -15,6 +15,7 @@ As of 02/22 there is no longer a need to download a specific image file.
* 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.
* Setup admin user by connecting to http://octopi.local via browser.
* Back in the ssh session, choose `Add Instance` and follow the instructions.
* If your printer does not have a serial number (all Creality printers), it will time out and use the physical USB address for udev entries.

View File

@@ -266,7 +266,7 @@ new_instance () {
sed -i "s/upnpUuid: .*/upnpUuid: $(uuidgen)/" $OCTOCONFIG/.$INSTANCE/config.yaml
#Set port
sed -i "/serial:/a\ port: /dev/octo_$INSTANCE" $OCTOCONFIG/.$INSTANCE/config.yaml
if [[ -n $CAM || -n $USBCAM ]]; then
write_camera
fi
@@ -699,6 +699,7 @@ prepare () {
echo 'You now have the option of setting up haproxy. This binds instances to a name on port 80 instead of having to type the port.'
echo 'If you intend to use this machine only for OctoPrint, it is safe to select yes.'
echo
echo
if prompt_confirm "Use haproxy?"; then
echo 'haproxy: true' >> /etc/octoprint_deploy
systemctl stop haproxy
@@ -759,7 +760,7 @@ prepare () {
fi
if [ $VID -eq 3 ]; then
echo "You can install a streamer manually at a later time."
echo "Good for you! Cameras are just annoying anyway."
fi
#Fedora has SELinux on by default so must make adjustments? Don't really know what these do...
@@ -785,7 +786,8 @@ prepare () {
systemctl enable octoprint_default.service
echo
echo
systemctl restart octoprint_default.service
#this restart seems necessary in some cases
systemctl restart octoprint_default.service
fi
fi
main_menu
@@ -815,6 +817,11 @@ remove_everything() {
rm /etc/systemd/system/cam_$instance.service
echo "Removing instance..."
rm -rf /home/$user/.$instance
if [ -f /etc/haproxy/haproxy.cfg ]; then
sed -i "/use_backend $instance/d" /etc/haproxy/haproxy.cfg
sed -i "/#$instance start/,/#$instance stop/d" /etc/haproxy/haproxy.cfg
systemctl restart haproxy.service
fi
done
echo "Removing system stuff"
rm /etc/systemd/system/octoprint_default.service
@@ -828,12 +835,7 @@ remove_everything() {
echo "Removing template"
rm -rf /home/$user/.octoprint
rm -rf /home/$user/OctoPrint
systemctl daemon-reload
if [ -f /etc/haproxy/haproxy.cfg ]; then
sed -i "/use_backend $instance/d" /etc/haproxy/haproxy.cfg
sed -i "/#$instance start/,/#$instance stop/d" /etc/haproxy/haproxy.cfg
systemctl restart haproxy.service
fi
systemctl daemon-reload
fi
}
@@ -849,7 +851,7 @@ main_menu() {
if [ -f "/etc/octoprint_instances" ]; then
options=("New instance" "Delete instance" "Add Camera" "USB port testing" "Quit")
else
options=("Prepare system" "New instance" "Delete instance" "Add Camera" "USB port testing" "Quit")
options=("Prepare system" "USB port testing" "Quit")
fi
select opt in "${options[@]}"