-
-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of how to integrate haproxy (#239)
* add: haproxy scripts * add: haproxy readme I am really bad at writing instructions.
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
CONTAINER=haproxy | ||
|
||
# Starts a cloudflare ddns container that is deleted after it is stopped. | ||
# All configs stored in /mnt/data/cloudflare-ddns | ||
if podman container exists "$CONTAINER"; then | ||
podman start "$CONTAINER" | ||
else | ||
podman run -d --net=host --restart always \ | ||
--name haproxy \ | ||
--hostname ha.proxy \ | ||
-v "/mnt/data/haproxy/:/usr/local/etc/haproxy/" \ | ||
haproxy:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Run haproxy on your UDM | ||
|
||
## Features | ||
|
||
1. Load balance services on your UDM, because why not?. | ||
2. Persists through reboots and firmware updates. | ||
|
||
## Requirements | ||
|
||
1. You have successfully setup the on boot script described [here](https://github.com/boostchicken/udm-utilities/tree/master/on-boot-script) | ||
2. You have to have services you want to load-balance, an example would be a multi-master k3s cluster. | ||
|
||
## Steps | ||
|
||
1. Pull your image with `podman pull docker.io/library/haproxy`. | ||
1. (Optional) Configure a network using the generic cni network [20-dns.conflist](../cni-plugins/20-dns.conflist) and update its values to reflect your environment | ||
1. Copy [50-haproxy.sh](./50-haproxy.sh) to `/mnt/data/on_boot.d/50-haproxy.sh`. | ||
1. Create a persistant directory and config for haproxy to use: | ||
|
||
```sh | ||
mkdir -p /mnt/data/haproxy | ||
touch /mnt/data/haproxy/haproxy.cfg | ||
``` | ||
|
||
1. Add your config to `/mnt/data/haproxy/haproxy.cfg`. Each configuration is unique, so check out some resouces like [haproxy.com](https://www.haproxy.com/documentation/hapee/latest/configuration/config-sections/) for basics. | ||
1. Run `/mnt/data/on_boot.d/50-haproxy.sh` | ||
|
||
## Upgrading Easily (if at all) | ||
|
||
1. Edit [update-pihole.sh](./update-pihole.sh) to use the same command you used at installation (if changed). | ||
2. Copy the [update-pihole.sh](./update-pihole.sh) to `/mnt/data/scripts` | ||
3. Anytime you want to update your installation, simply run `/mnt/data/scripts/update-pihole.sh` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
podman pull haproxy | ||
podman stop haproxy | ||
podman rm haproxy | ||
podman run -d --net=host --restart always \ | ||
--name haproxy \ | ||
--hostname ha.proxy \ | ||
-v "/mnt/data/haproxy/:/usr/local/etc/haproxy/" \ | ||
haproxy:latest |