Public Repository

Last pushed: 3 days ago
Short Description
HAProxy (alpine) based image built with supervisor and confd to allow dynamic configuration updates.
Full Description

HAProxy docker container insightsoftware/haproxy which includes supervisor and confd to allow dynamic configuration updates.

  • Based on haproxy:alpine
  • Includes confd to configure services
  • Includes supervisor to ensure services are running.

ENV Variables

HAPROXY_SERVERS
Default: n/a
This is a JSON value of the following schema:
{ "servers":[ { "server":server1_ip }, { "server":server2_ip } ] }

Usage

Basic

docker run -d -e HAPROXY_SERVERS='{"servers":[{"server":"server1_ip"},{"server":"server2_ip"}]}' -p 80:80 insightsoftware/haproxy

Stats

The default URL for stats is http://CONTAINER_IP/haproxy?stats with username:password set to admin:password.

Dockerfile:

FROM haproxy:alpine

MAINTAINER Hubble Infrastructure <hubble.infrastructure@insighsoftware.com>

ENV CONFD_VERSION 0.12.0-alpha3
ENV CONFD_SHA1 437524fe3334bd9d0424ed0ece265472e789d19e
ENV PYTHON_VERSION=2.7.12-r0
ENV PY_PIP_VERSION=8.1.2-r0
ENV SUPERVISOR_VERSION=3.3.0
ENV SUPERVISOR_CONF='{"programs": [{"program": "haproxy", "command": "haproxy -f /etc/haproxy/haproxy.cfg", "priotity": "2", "autostart": "true", "autorestart": "true", "startsecs": "20", "stdout_logfile": "/var/log/supervisor/haproxy.log"}]}'
ENV CONFD_BACKEND='env'

#Install confd and Supervisor
RUN set -ex && \
apk --no-cache add --virtual .build-dependencies wget ca-certificates && wget https://github.com/kelseyhightower/confd/releases/download/v$CONFD_VERSION/confd-$CONFD_VERSION-linux-amd64 -O /usr/local/bin/confd && \ 
chmod +x /usr/local/bin/confd && \
#echo $CONFD_SHA1 /usr/local/bin/confd | sha1sum -c - && \
apk del .build-dependencies && \
\
apk update && apk add -u python=$PYTHON_VERSION py-pip=$PY_PIP_VERSION && \
pip install supervisor==$SUPERVISOR_VERSION && \
rm -rf /etc/supervisor/supervisor.conf && \
mkdir /var/log/supervisor

#Configure confd
COPY ./confd /etc/confd

#Configure Supervisor
COPY ./supervisor /etc/supervisor

########### CUSTOM INSTRUCTIONS ###########

EXPOSE 80

RUN mkdir /etc/haproxy

####### END OF CUSTOM INSTRUCTIONS ########

#Entrypoint
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Docker Pull Command
Owner
insightsoftware

Comments (0)