Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions haproxy/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ that served the page changes, as HAProxy switches between them.
The stats page can be accessed at http://localhost:1936 where you have to log in
using the `STATS_AUTH` authentication details (default `admin:admin`).

You may want to set `STATS_REFRESH` option to let the statistics page auto update
i.e `STATS_REFRESH="5s"` to update every five seconds (default `0s`: no refresh)

Note that it may take **up to one minute** until backends are plugged-in due to the
minimum possible `DNS_TTL`.

Expand Down Expand Up @@ -129,6 +132,7 @@ either when running the container or in a `docker-compose.yml` file.

* `STATS_PORT` The port to bind statistics to - default `1936`
* `STATS_AUTH` The authentication details (written as `user:password` for the statistics page - default `admin:admin`
* `STATS_REFRESH` Refresh timing for the statistics page - default `0s` (no refresh)
* `FRONTEND_NAME` The label of the frontend - default `http-frontend`
* `FRONTEND_PORT` The port to bind the frontend to - default `5000`
* `FRONTEND_MODE` Frontend mode - default `http` or `BACKENDS_MODE` if declared
Expand Down
1 change: 1 addition & 0 deletions haproxy/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ if ! test -e /usr/local/etc/haproxy/haproxy.cfg; then
if [ -n "$SERVICE_NAMES" ]; then echo "export SERVICE_NAMES=\"$SERVICE_NAMES\"" >> /etc/environment; fi
if [ -n "$STATS_AUTH" ]; then echo "export STATS_AUTH=\"$STATS_AUTH\"" >> /etc/environment; fi
if [ -n "$STATS_PORT" ]; then echo "export STATS_PORT=\"$STATS_PORT\"" >> /etc/environment; fi
if [ -n "$STATS_REFRESH" ]; then echo "export STATS_REFRESH=\"$STATS_REFRESH\"" >> /etc/environment; fi
if [ -n "$TIMEOUT_CLIENT" ]; then echo "export TIMEOUT_CLIENT=\"$TIMEOUT_CLIENT\"" >> /etc/environment; fi
if [ -n "$TIMEOUT_CONNECT" ]; then echo "export TIMEOUT_CONNECT=\"$TIMEOUT_CONNECT\"" >> /etc/environment; fi
if [ -n "$TIMEOUT_SERVER" ]; then echo "export TIMEOUT_SERVER=\"$TIMEOUT_SERVER\"" >> /etc/environment; fi
Expand Down
6 changes: 5 additions & 1 deletion haproxy/src/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
PROXY_PROTOCOL_ENABLED = (os.environ.get('PROXY_PROTOCOL_ENABLED', 'false').lower() == "true")
STATS_PORT = os.environ.get('STATS_PORT', '1936')
STATS_AUTH = os.environ.get('STATS_AUTH', 'admin:admin')
STATS_REFRESH = os.environ.get('STATS_REFRESH', '0s')
BACKENDS = os.environ.get('BACKENDS', '').split(' ')
BACKENDS_PORT = os.environ.get('BACKENDS_PORT', '80')
BACKENDS_MODE = os.environ.get('BACKENDS_MODE', FRONTEND_MODE)
Expand All @@ -44,6 +45,7 @@
stats uri /
stats hide-version
stats auth $auth
stats refresh $refresh
""")

frontend_conf = Template("""
Expand Down Expand Up @@ -235,7 +237,9 @@

configuration.write(
listen_conf.substitute(
port=STATS_PORT, auth=STATS_AUTH
port=STATS_PORT,
auth=STATS_AUTH,
refresh=STATS_REFRESH
)
)

Expand Down