Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docker-socket-proxy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Tecnativa
docker-socket-proxy
Commits
ce81071d
Unverified
Commit
ce81071d
authored
1 year ago
by
salty
Browse files
Options
Downloads
Patches
Plain Diff
add config templating
parent
87428842
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+3
-1
3 additions, 1 deletion
Dockerfile
docker-entrypoint.sh
+33
-0
33 additions, 0 deletions
docker-entrypoint.sh
haproxy.cfg
+1
-1
1 addition, 1 deletion
haproxy.cfg
with
37 additions
and
2 deletions
Dockerfile
+
3
−
1
View file @
ce81071d
...
...
@@ -9,6 +9,7 @@ ENV ALLOW_RESTARTS=0 \
COMMIT=0 \
CONFIGS=0 \
CONTAINERS=0 \
DISABLE_IPV6=0 \
DISTRIBUTION=0 \
EVENTS=1 \
EXEC=0 \
...
...
@@ -30,4 +31,5 @@ ENV ALLOW_RESTARTS=0 \
TASKS=0 \
VERSION=1 \
VOLUMES=0
COPY
haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
COPY
docker-entrypoint.sh /usr/local/bin/
COPY
haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg.template
This diff is collapsed.
Click to expand it.
docker-entrypoint.sh
0 → 100755
+
33
−
0
View file @
ce81071d
#!/bin/sh
set
-e
# Normalize the input for DISABLE_IPV6 to lowercase
DISABLE_IPV6_LOWER
=
$(
echo
"
$DISABLE_IPV6
"
|
tr
'[:upper:]'
'[:lower:]'
)
# Check for different representations of 'true' and set BIND_CONFIG
case
"
$DISABLE_IPV6_LOWER
"
in
1|true|yes
)
BIND_CONFIG
=
":2375"
;;
*
)
BIND_CONFIG
=
"[::]:2375 v4v6"
;;
esac
# Process the HAProxy configuration template using sed
sed
"s/
\$
{BIND_CONFIG}/
$BIND_CONFIG
/g"
/usr/local/etc/haproxy/haproxy.cfg.template
>
/usr/local/etc/haproxy/haproxy.cfg
# first arg is `-f` or `--some-option`
if
[
"
${
1
#-
}
"
!=
"
$1
"
]
;
then
set
--
haproxy
"
$@
"
fi
if
[
"
$1
"
=
'haproxy'
]
;
then
shift
# "haproxy"
# if the user wants "haproxy", let's add a couple useful flags
# -W -- "master-worker mode" (similar to the old "haproxy-systemd-wrapper"; allows for reload via "SIGUSR2")
# -db -- disables background mode
set
--
haproxy
-W
-db
"
$@
"
fi
exec
"
$@
"
This diff is collapsed.
Click to expand it.
haproxy.cfg
+
1
−
1
View file @
ce81071d
...
...
@@ -44,7 +44,7 @@ backend docker-events
timeout
server
0
frontend
dockerfrontend
bind
:::2375
v4v6
bind
${BIND_CONFIG}
http-request
deny
unless
METH_GET
||
{
env(POST)
-m
bool
}
http-request
allow
if
{
path,url_dec
-m
reg
-i
^(/v
[\d\.]
+)?/containers/
[a-zA-Z0-9_.-]
+/((stop)|(restart)|(kill))
}
{
env(ALLOW_RESTARTS)
-m
bool
}
http-request
allow
if
{
path,url_dec
-m
reg
-i
^(/v
[\d\.]
+)?/containers/
[a-zA-Z0-9_.-]
+/start
}
{
env(ALLOW_START)
-m
bool
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment