Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit a68f66b

Browse files
committed
make user and group configurable thru envvar
1 parent c0bbe57 commit a68f66b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Settings in this part is immutable, you have to redeploy HAProxy service to make
198198

199199
|Environment Variable|Default|Description|
200200
|:-----:|:-----:|:----------|
201-
|ADDITIONAL_BACKENDS| |list of additional backends to balance. The format is `backend name, FORCE_SSL(True|False), server name, host:port, options`|
201+
|ADDITIONAL_BACKEND_\<NAME\>| |add an additional backend with the name set in <NAME>. Possible values include:`balance source, server 127.0.0.1:8080`|
202202
|ADDITIONAL_SERVICES| |list of additional services to balance (es: `prj1:web,prj2:sql`). Discovery will be based on `com.docker.compose.[project|service]` container labels. This environment variable only works on compose v2, and the referenced services must be on a network resolvable and accessible to this containers.|
203203
|BALANCE|roundrobin|load balancing algorithm to use. Possible values include: `roundrobin`, `static-rr`, `source`, `leastconn`. See:[HAProxy:balance](https://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4-balance)|
204204
|CA_CERT_FILE| |the path of a ca-cert file. This allows you to mount your ca-cert file directly from a volume instead of from envvar. If set, `CA_CERT` envvar will be ignored. Possible value: `/cacerts/cert0.pem`|
@@ -228,6 +228,8 @@ Settings in this part is immutable, you have to redeploy HAProxy service to make
228228
|STATS_PORT|1936|port for the HAProxy stats section. If this port is published, stats can be accessed at `http://<host-ip>:<STATS_PORT>/`
229229
|TIMEOUT|connect 5000, client 50000, server 50000|comma-separated list of HAProxy `timeout` entries to the `default` section.|
230230
|NBPROC|1|sets the `nbproc` entry to the `global` section. By default, only one process is created, which is the recommended mode of operation.|
231+
|HAPROXY_USER|haproxy|sets the user of the UNIX sockets to the designated system user name|
232+
|HAPROXY_GROUP|haproxy|sets the group of the UNIX sockets to the designated system group name|
231233

232234
### Settings in linked application services###
233235

haproxy/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def parse_additional_backend_settings(envvars):
8585
TIMEOUT = os.getenv("TIMEOUT", "connect 5000, client 50000, server 50000")
8686
NBPROC = int(os.getenv("NBPROC", 1))
8787
SWARM_MODE_POLLING_INTERVAL = int(os.getenv("SWARM_MODE_POLLING_INTERVAL", 5))
88+
HAPROXY_USER=os.getenv("HAPROXY_USER", "haproxy")
89+
HAPROXY_GROUP=os.getenv("HAPROXY_GROUP", "haproxy")
8890

8991
# global
9092
RUNNING_MODE = None

haproxy/haproxycfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ def _config_global_section():
242242
"log-send-hostname",
243243
"maxconn %s" % MAXCONN,
244244
"pidfile /var/run/haproxy.pid",
245-
"user haproxy",
246-
"group haproxy",
245+
"user %s" % HAPROXY_USER,
246+
"group %s" % HAPROXY_GROUP,
247247
"daemon",
248248
"stats socket /var/run/haproxy.stats level admin"]
249249

0 commit comments

Comments
 (0)