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. 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 Need help with octoprint_deploy? You can open issues here or ask on Discord: https://discord.gg/6vgSjgvR6u
# octoprint_deploy # 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 # BIG CHANGES
As of 02/22 there is no longer a need to download a specific image file. 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`. * run the command `sudo octoprint_deploy/octoprint_deploy.sh`.
* Choose `Prepare System` from the menu. * 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. * 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. * Setup admin user by connecting to http://octopi.local via browser.
* Back in the ssh session, choose `Add Instance` and follow the instructions. * 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. * 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

@@ -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 '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 'If you intend to use this machine only for OctoPrint, it is safe to select yes.'
echo echo
echo
if prompt_confirm "Use haproxy?"; then if prompt_confirm "Use haproxy?"; then
echo 'haproxy: true' >> /etc/octoprint_deploy echo 'haproxy: true' >> /etc/octoprint_deploy
systemctl stop haproxy systemctl stop haproxy
@@ -759,7 +760,7 @@ prepare () {
fi fi
if [ $VID -eq 3 ]; then 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 fi
#Fedora has SELinux on by default so must make adjustments? Don't really know what these do... #Fedora has SELinux on by default so must make adjustments? Don't really know what these do...
@@ -785,6 +786,7 @@ prepare () {
systemctl enable octoprint_default.service systemctl enable octoprint_default.service
echo echo
echo echo
#this restart seems necessary in some cases
systemctl restart octoprint_default.service systemctl restart octoprint_default.service
fi fi
fi fi
@@ -815,6 +817,11 @@ remove_everything() {
rm /etc/systemd/system/cam_$instance.service rm /etc/systemd/system/cam_$instance.service
echo "Removing instance..." echo "Removing instance..."
rm -rf /home/$user/.$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 done
echo "Removing system stuff" echo "Removing system stuff"
rm /etc/systemd/system/octoprint_default.service rm /etc/systemd/system/octoprint_default.service
@@ -829,11 +836,6 @@ remove_everything() {
rm -rf /home/$user/.octoprint rm -rf /home/$user/.octoprint
rm -rf /home/$user/OctoPrint rm -rf /home/$user/OctoPrint
systemctl daemon-reload 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
fi fi
} }
@@ -849,7 +851,7 @@ main_menu() {
if [ -f "/etc/octoprint_instances" ]; then if [ -f "/etc/octoprint_instances" ]; then
options=("New instance" "Delete instance" "Add Camera" "USB port testing" "Quit") options=("New instance" "Delete instance" "Add Camera" "USB port testing" "Quit")
else else
options=("Prepare system" "New instance" "Delete instance" "Add Camera" "USB port testing" "Quit") options=("Prepare system" "USB port testing" "Quit")
fi fi
select opt in "${options[@]}" select opt in "${options[@]}"