Skip to content

Instantly share code, notes, and snippets.

@ramr
Created November 18, 2015 23:27
Show Gist options
  • Save ramr/aa82782e8e7cad2fda23 to your computer and use it in GitHub Desktop.
Save ramr/aa82782e8e7cad2fda23 to your computer and use it in GitHub Desktop.
Build a custom OpenShift Origin HAProxy router image.
mkdir -p /tmp/custom-router && cd /tmp/custom-router
# For OSE, replace openshift/origin-haproxy-router with the appropriate OSE image:
# Example: registry.access.redhat.com/openshift3/ose-haproxy-router:v3.0.2.0
docker run --rm --interactive=true --tty --entrypoint=cat openshift/origin-haproxy-router haproxy-config.template > haproxy-config.template
# Customization to bind to only the IP on the external if (/etc/hosts has an entry for extif).
sed -i 's/bind :\([80,443]\)/bind extif:\1/g' haproxy-config.template
echo '
FROM openshift/origin-haproxy-router
ADD haproxy-config.template /var/lib/haproxy/conf/
ENV TEMPLATE_FILE=/var/lib/haproxy/conf/haproxy-config.template \
RELOAD_SCRIPT=/var/lib/haproxy/reload-haproxy
ENTRYPOINT ["/usr/bin/openshift-router"]
' > Dockerfile
docker build -t os3/custom-haproxy-router ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment