-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from tgross/bootstrap-with-containerbuddy
Bootstrap with Containerbuddy
- Loading branch information
Showing
17 changed files
with
648 additions
and
393 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ MAINTAINER Casey Bisson <[email protected]> | |
# Note: glibc is required because the Consul binary we're using is built against it | ||
RUN apk --update \ | ||
add \ | ||
jq \ | ||
curl \ | ||
bash \ | ||
ca-certificates && \ | ||
|
@@ -29,10 +28,20 @@ RUN mkdir /ui && \ | |
mv dist/* . && \ | ||
rm -rf dist | ||
|
||
# get Containerbuddy release | ||
RUN export CB=containerbuddy-0.0.1-alpha &&\ | ||
mkdir -p /opt/containerbuddy && \ | ||
curl -Lo /tmp/${CB}.tar.gz \ | ||
https://github.com/joyent/containerbuddy/releases/download/0.0.1-alpha/${CB}.tar.gz && \ | ||
tar xzf /tmp/${CB}.tar.gz -C /tmp && \ | ||
mv /tmp/build/containerbuddy /opt/containerbuddy/ | ||
COPY containerbuddy.json /etc/ | ||
|
||
# Consul config | ||
COPY ./config /config/ | ||
ONBUILD ADD ./config /config/ | ||
|
||
# copy bootstrap scripts | ||
COPY ./bin/* /bin/ | ||
|
||
EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 53 53/udp | ||
|
@@ -43,6 +52,3 @@ VOLUME ["/data"] | |
|
||
ENV GOMAXPROCS 2 | ||
ENV SHELL /bin/bash | ||
|
||
ENTRYPOINT ["/bin/triton-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
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
#!/bin/bash | ||
|
||
# 1. check if member of a raft | ||
# 2a. yes? --> execute health check | ||
# 2b. no? --> check if BOOTSTRAP_HOST is set? | ||
# 3a. no? --> join self | ||
# 3b. yes? --> join raft | ||
|
||
log() { | ||
echo " $(date -u '+%Y-%m-%d %H:%M:%S') containerbuddy: $@" | ||
} | ||
|
||
if [ $(consul info | awk '/num_peers/{print $3}') == 0 ]; then | ||
log "No peers in raft" | ||
if [ -n "${BOOTSTRAP_HOST}" ]; then | ||
log "Joining raft at ${BOOTSTRAP_HOST}" | ||
consul join ${BOOTSTRAP_HOST} | ||
else | ||
log "Bootstrapping raft with self" | ||
consul join $(ip addr show eth0 | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') | ||
fi | ||
else | ||
consul info &> /dev/null | ||
exit $? | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Oops, something went wrong.