This repository has been archived by the owner on Feb 1, 2020. It is now read-only.
forked from gliderlabs/docker-consul
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using consul 0.3.0, now installs the webui, returned to consul TLD, i…
…ncluding bash and setting it as the intended SHELL, and added a docker run convenience command generator
- Loading branch information
Showing
5 changed files
with
99 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
FROM progrium/busybox | ||
MAINTAINER Jeff Lindsay <[email protected]> | ||
|
||
ADD https://dl.bintray.com/mitchellh/consul/0.2.1_linux_amd64.zip /tmp/consul.zip | ||
RUN cd /bin && unzip /tmp/consul.zip && chmod +x /bin/consul | ||
ADD https://dl.bintray.com/mitchellh/consul/0.3.0_linux_amd64.zip /tmp/consul.zip | ||
RUN cd /bin && unzip /tmp/consul.zip && chmod +x /bin/consul && rm /tmp/consul.zip | ||
|
||
RUN opkg-install curl | ||
ADD https://dl.bintray.com/mitchellh/consul/0.3.0_web_ui.zip /tmp/webui.zip | ||
RUN cd /tmp && unzip /tmp/webui.zip && mv dist /ui && rm /tmp/webui.zip | ||
|
||
RUN opkg-install curl bash | ||
|
||
ADD ./config /config/ | ||
ONBUILD ADD ./config /config/ | ||
|
||
ADD ./start /bin/start | ||
|
||
EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 53/udp | ||
VOLUME ["/data"] | ||
|
||
ENTRYPOINT ["/bin/consul", "agent", "-config-dir=/config"] | ||
ENV SHELL /bin/bash | ||
|
||
ENTRYPOINT ["/bin/start"] | ||
CMD [] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
build: | ||
docker build --no-cache -t consul . | ||
docker build -t consul . | ||
|
||
tag: | ||
docker tag consul progrium/consul |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"data_dir": "/data", | ||
"ui_dir": "/ui", | ||
"client_addr": "0.0.0.0", | ||
"domain": "cluster", | ||
"ports": { | ||
"dns": 53 | ||
}, | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
readonly IMAGE="progrium/consul" | ||
|
||
cmd-run() { | ||
local ip_def="$1"; shift | ||
local args="$@" | ||
|
||
declare external_ip join_ip bridge_ip run_mode | ||
|
||
IFS=':' read external_ip join_ip <<< "${ip_def/::/:}" | ||
if [[ -z "$join_ip" ]]; then | ||
run_mode="-bootstrap" | ||
else | ||
run_mode="-join $join_ip" | ||
fi | ||
|
||
bridge_ip="$(ip ro | grep ^default | awk '{print $3}')" | ||
cat <<EOF | ||
eval docker run --name consul -h \$HOSTNAME \ | ||
-p $external_ip:8300:8300 \ | ||
-p $external_ip:8301:8301 \ | ||
-p $external_ip:8301:8301/udp \ | ||
-p $external_ip:8302:8302 \ | ||
-p $external_ip:8302:8302/udp \ | ||
-p $external_ip:8400:8400 \ | ||
-p $external_ip:8500:8500 \ | ||
-p $bridge_ip:53:53/udp \ | ||
$args \ | ||
$IMAGE -server -advertise $external_ip $run_mode | ||
EOF | ||
} | ||
|
||
main() { | ||
set -eo pipefail | ||
case "$1" in | ||
cmd:run) shift; cmd-run $@;; | ||
*) /bin/consul agent -config-dir=/config $@;; | ||
esac | ||
} | ||
|
||
main "$@" |