Last active
February 8, 2019 19:05
-
-
Save angryziber/e3511130d1ef0e9e7d2d6b9f9172f3b9 to your computer and use it in GitHub Desktop.
HAProxy in Docker with logging to stdout (because it's hard to figure out)
This file contains hidden or 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
# The trick here is to run syslogd, writing output to the stdout of PID1, which Docker daemon captures | |
# This may be a useful trick with other executables as well that can only write to syslog | |
version: '3' | |
services: | |
haproxy: | |
image: haproxy:1.9-alpine | |
entrypoint: '' | |
command: sh -c 'syslogd -O /proc/1/fd/1; /docker-entrypoint.sh haproxy -f /etc/haproxy/haproxy.cfg' | |
ports: | |
- 80:80 | |
volumes: | |
- .:/etc/haproxy:ro |
This file contains hidden or 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
# Include this in your haproxy config file | |
# It will log to /dev/log that syslogd provides | |
defaults | |
log /dev/log local0 | |
mode http | |
option httplog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment