Skip to content

Repository files navigation

HAProxy

Build Status Last Commit

Reliable, high performance TCP/HTTP load balancer and reverse proxy.

Port 80
Registry ghcr.io/daemonless/haproxy
Source https://github.com/haproxy/haproxy
Website https://www.haproxy.org/

Version Tags

Tag Description Best For
3.4 / 3.4-pkg-latest / 3.4.1 / latest / pkg / pkg-latest HAProxy 3.4 release branch installed from FreeBSD latest packages. Most users — recommended.
3.3 / 3.3-pkg-latest / 3.3.11 HAProxy 3.3 release branch installed from FreeBSD latest packages. Alternative build.
3.2 / 3.2-pkg-latest / 3.2.20 / lts HAProxy 3.2 LTS release branch installed from FreeBSD latest packages. Alternative build.
3.0 / 3.0-pkg-latest / 3.0.24 HAProxy 3.0 LTS release branch installed from FreeBSD latest packages. Alternative build.
2.8 / 2.8-pkg-latest / 2.8.25 HAProxy 2.8 LTS release branch installed from FreeBSD latest packages. Alternative build.
2.6 / 2.6-pkg-latest / 2.6.30 HAProxy 2.6 LTS release branch installed from FreeBSD latest packages. Alternative build.
2.4 / 2.4-pkg-latest / 2.4.35 HAProxy 2.4 LTS release branch installed from FreeBSD latest packages. Alternative build.
devel / devel-pkg-latest HAProxy development edge release branch installed from FreeBSD latest packages. Alternative build.
3.4-lua / 3.4-lua-pkg-latest / 3.4.1-lua / lua HAProxy 3.4 release branch with Lua scripting enabled. Alternative build.
3.3-lua / 3.3-lua-pkg-latest / 3.3.11-lua HAProxy 3.3 release branch with Lua scripting enabled. Alternative build.
3.2-lua / 3.2-lua-pkg-latest / 3.2.20-lua HAProxy 3.2 LTS release branch with Lua scripting enabled. Alternative build.
3.0-lua / 3.0-lua-pkg-latest / 3.0.24-lua HAProxy 3.0 LTS release branch with Lua scripting enabled. Alternative build.
2.8-lua / 2.8-lua-pkg-latest / 2.8.25-lua HAProxy 2.8 LTS release branch with Lua scripting enabled. Alternative build.
2.6-lua / 2.6-lua-pkg-latest / 2.6.30-lua HAProxy 2.6 LTS release branch with Lua scripting enabled. Alternative build.
2.4-lua / 2.4-lua-pkg-latest / 2.4.35-lua HAProxy 2.4 LTS release branch with Lua scripting enabled. Alternative build.
3.4-wolfssl / 3.4-wolfssl-pkg-latest / 3.4.1-wolfssl / wolfssl HAProxy 3.4 release branch built with WolfSSL TLS engine. Alternative build.
3.3-wolfssl / 3.3-wolfssl-pkg-latest / 3.3.11-wolfssl HAProxy 3.3 release branch built with WolfSSL TLS engine. Alternative build.
3.2-wolfssl / 3.2-wolfssl-pkg-latest / 3.2.20-wolfssl HAProxy 3.2 LTS release branch built with WolfSSL TLS engine. Alternative build.
3.0-wolfssl / 3.0-wolfssl-pkg-latest / 3.0.24-wolfssl HAProxy 3.0 LTS release branch built with WolfSSL TLS engine. Alternative build.

Prerequisites

Before deploying, ensure your host environment is ready. See the Quick Start Guide for host setup instructions.

Deployment

Podman Compose

services:
  haproxy:
    image: "ghcr.io/daemonless/haproxy:latest"
    container_name: haproxy
    environment:
      - PUID=1000  # User ID for the application process
      - PGID=1000  # Group ID for the application process
      - TZ=UTC  # Timezone for the container
    volumes:
      - "/path/to/containers/haproxy:/config"
    ports:
      - "80:80"
      - "443:443"
      - "8404:8404"
    # always (not unless-stopped) so FreeBSD's podman rc.d auto-starts it at boot
    restart: always

Save as compose.yaml, then run podman-compose up -d.

AppJail Director

.env:

# .env

DIRECTOR_PROJECT=haproxy
PUID=1000
PGID=1000
TZ=UTC

appjail-director.yml:

# appjail-director.yml

options:
  - virtualnet: ':<random> default'
  - nat:
services:
  haproxy:
    name: haproxy
    options:
      - container: 'boot args:--pull'
      - expose: '80:80 proto:tcp'
      - expose: '443:443 proto:tcp'
      - expose: '8404:8404 proto:tcp'
    oci:
      user: root
      environment:
        - PUID: !ENV '${PUID}'
        - PGID: !ENV '${PGID}'
        - TZ: !ENV '${TZ}'
    volumes:
      - haproxy: /config
volumes:
  haproxy:
    device: '/path/to/containers/haproxy'

Makejail:

# Makejail

ARG tag=latest

OPTION overwrite=force
OPTION from=ghcr.io/daemonless/haproxy:${tag}

Save the files above, then run appjail-director up.

Note: Exposing ports in AppJail means that your service can be reached from remote hosts. If that is not your intention, do not expose the ports and communicate with the service using the IPv4 address assigned by the virtual network.

Podman CLI

podman run -d --name haproxy \
  -p 80:80 \
  -p 443:443 \
  -p 8404:8404 \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=UTC \
  -v /path/to/containers/haproxy:/config \
  ghcr.io/daemonless/haproxy:latest

Save as run.sh, then run sh run.sh.

AppJail

appjail oci run -Pd \
  -o overwrite=force \
  -o container="args:--pull" \
  -o virtualnet=":<random> default" \
  -o nat \
  -o expose="80:80 proto:tcp" \
  -o expose="443:443 proto:tcp" \
  -o expose="8404:8404 proto:tcp" \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=UTC \
  -o fstab="/path/to/containers/haproxy /config <pseudofs>" \
  ghcr.io/daemonless/haproxy:latest haproxy

Save as run.sh, then run sh run.sh.

Note: Exposing ports in AppJail means that your service can be reached from remote hosts. If that is not your intention, do not expose the ports and communicate with the service using the IPv4 address assigned by the virtual network.

Bastille

Warning

Bastille's OCI support is experimental. It requires buildah, shares the host network stack (inherit), and persists image-declared volumes under --data-path.

services:
  haproxy:
    image: "ghcr.io/daemonless/haproxy:latest"
    container_name: haproxy
    network_mode: host  # jail shares host networking
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=UTC

Save as podman-compose.yml, then run bastille up. Or via CLI:

bastille create -O \
  --env PUID=1000 \
  --env PGID=1000 \
  --env TZ=UTC \
  --data-path /path/to/containers/haproxy \
  haproxy ghcr.io/daemonless/haproxy:latest inherit

Ansible

- name: Deploy haproxy
  containers.podman.podman_container:
    name: haproxy
    image: "ghcr.io/daemonless/haproxy:latest"
    state: started
    restart_policy: always
    env:
      PUID: "1000"
      PGID: "1000"
      TZ: "UTC"
    ports:
      - "80:80"
      - "443:443"
      - "8404:8404"
    volumes:
      - "/path/to/containers/haproxy:/config"

Save as haproxy-deploy.yaml, then run ansible-playbook haproxy-deploy.yaml.

Parameters

Environment Variables

Variable Default Description
PUID 1000 User ID for the application process
PGID 1000 Group ID for the application process
TZ UTC Timezone for the container

Volumes

Path Description
/config Configuration directory containing haproxy.conf

Ports

Port Protocol Description
80 TCP HTTP Listener
443 TCP HTTPS Listener (optional)
8404 TCP HAProxy Stats Page (optional)

Architectures: amd64 User: bsd (UID/GID via PUID/PGID, defaults to 1000:1000) Base: FreeBSD 15.1


Need help? Join our Discord community.

About

Reliable, high performance TCP/HTTP load balancer and reverse proxy.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages