mirror of
https://github.com/unifi-utilities/unifios-utilities.git
synced 2024-08-30 18:32:21 +00:00
.. | ||
21-haproxy.conflist | ||
50-haproxy.sh | ||
README.md | ||
update-haproxy.sh |
Run haproxy on your UDM
Features
- Load balance services on your UDM, because why not?.
- Persists through reboots and firmware updates.
Requirements
- You have successfully setup the on boot script described here
- You have to have services you want to load-balance, an example would be a multi-master k3s cluster.
Steps
-
Check if you either have
/mnt/data
or/data/
and adjust below accordingly -
Pull your image with
podman pull docker.io/library/haproxy
. -
Copy 50-haproxy.sh to
/data/on_boot.d/50-haproxy.sh
. -
Choose network configuration - You can run either on the host network or on a seperate docker network. Running on the host network is easier but does mean you can't clash with the ports already in use on the UDM.
- If you want to run on the host network
- You don't have to do anything extra to run on the host network all the instructions / scripts assume this setup.
- If you want to run on a custom docker network do the following:
- Setup the network - there are some instructions in the Customizations setting of the pihole instructions: https://github.com/unifi-utilities/unifios-utilities/tree/main/run-pihole#customizations
- Copy 21-haproxy.conflist to
/data/podman/cni/
and update its values to reflect your environment. - Execute the
/data/on_boot.d/05-install-cni-plugins.sh
script to create the network. - Edit
/data/on_boot.d/50-haproxy.sh
and change--net=host
to--network haproxy
- If you want to run on the host network
-
Create a persistant directory and config for haproxy to use:
mkdir -p /data/haproxy touch /data/haproxy/haproxy.cfg
-
Add your config to
/data/haproxy/haproxy.cfg
. Each configuration is unique, so check out some resouces like haproxy.com for basics. -
Run
/data/on_boot.d/50-haproxy.sh
Upgrading Easily (if at all)
- Edit update-haproxy.sh to use the same command you used at installation (if changed). If you added your own network config ensure you change the
--net=host
to--network haproxy
- Copy the update-haproxy.sh to
/data/scripts
- Anytime you want to update your installation, simply run
/data/scripts/update-haproxy.sh