haproxy option
This commit is contained in:
@@ -276,7 +276,7 @@ new_instance () {
|
|||||||
echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg
|
echo "#$INSTANCE start" >> /etc/haproxy/haproxy.cfg
|
||||||
echo "backend $INSTANCE" >> /etc/haproxy/haproxy.cfg
|
echo "backend $INSTANCE" >> /etc/haproxy/haproxy.cfg
|
||||||
if [ $HAversion -gt 1 ]; then
|
if [ $HAversion -gt 1 ]; then
|
||||||
echo " http-request replace-path ^([^\ :]*)\ /$INSTANCE/(.*) \1\ /\2" >> /etc/haproxy/haproxy.cfg
|
echo " http-request replace-path /$INSTANCE/(.*) /\1" >> /etc/haproxy/haproxy.cfg
|
||||||
echo " acl needs_scheme req.hdr_cnt(X-Scheme) eq 0" >> /etc/haproxy/haproxy.cfg
|
echo " acl needs_scheme req.hdr_cnt(X-Scheme) eq 0" >> /etc/haproxy/haproxy.cfg
|
||||||
echo " http-request add-header X-Scheme https if needs_scheme { ssl_fc }" >> /etc/haproxy/haproxy.cfg
|
echo " http-request add-header X-Scheme https if needs_scheme { ssl_fc }" >> /etc/haproxy/haproxy.cfg
|
||||||
echo " http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }" >> /etc/haproxy/haproxy.cfg
|
echo " http-request add-header X-Scheme http if needs_scheme !{ ssl_fc }" >> /etc/haproxy/haproxy.cfg
|
||||||
@@ -659,7 +659,11 @@ prepare () {
|
|||||||
sudo -u $user mkdir /home/$user/.octoprint
|
sudo -u $user mkdir /home/$user/.octoprint
|
||||||
sudo -u $user cp -p $SCRIPTDIR/config.basic /home/$user/.octoprint/config.yaml
|
sudo -u $user cp -p $SCRIPTDIR/config.basic /home/$user/.octoprint/config.yaml
|
||||||
#Add this is as an option
|
#Add this is as an option
|
||||||
echo 'Updating haproxy'
|
echo
|
||||||
|
echo
|
||||||
|
echo 'You 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.'
|
||||||
|
if prompt_confirm "Use haproxy?" then
|
||||||
systemctl stop haproxy
|
systemctl stop haproxy
|
||||||
#get haproxy version
|
#get haproxy version
|
||||||
HAversion=$(haproxy -v | sed -n 's/^.*version \([0-9]\).*/\1/p')
|
HAversion=$(haproxy -v | sed -n 's/^.*version \([0-9]\).*/\1/p')
|
||||||
@@ -671,6 +675,10 @@ prepare () {
|
|||||||
fi
|
fi
|
||||||
systemctl start haproxy
|
systemctl start haproxy
|
||||||
systemctl enable haproxy
|
systemctl enable haproxy
|
||||||
|
else
|
||||||
|
systemctl stop haproxy
|
||||||
|
systemctl disable haproxy
|
||||||
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user