This repository has been archived by the owner on Jun 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
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 #85 from LLParse/metadata-loop-hack
etcd v2.3.7-11 Metadata loop hack
- Loading branch information
Showing
7 changed files
with
729 additions
and
0 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,21 @@ | ||
FROM alpine:3.3 | ||
|
||
WORKDIR /opt/rancher | ||
ENV PATH $PATH:/opt/rancher | ||
|
||
RUN \ | ||
apk add --update bash ca-certificates && \ | ||
rm -rf /var/cache/apk/* && \ | ||
wget -q -O /opt/rancher/giddyup https://github.com/cloudnautique/giddyup/releases/download/v0.13.0/giddyup && \ | ||
chmod +x /opt/rancher/giddyup | ||
|
||
RUN \ | ||
wget -q -O - https://github.com/coreos/etcd/releases/download/v2.3.7/etcd-v2.3.7-linux-amd64.tar.gz | tar xzf - -C /tmp && \ | ||
mv /tmp/etcd-*/etcd /opt/rancher/etcd && \ | ||
mv /tmp/etcd-*/etcdctl /opt/rancher/etcdctl && \ | ||
rm -rf /tmp/etcd-* && rm -f /etcd-*.tar.gz | ||
|
||
ADD etcdwrapper run.sh disaster delete /opt/rancher/ | ||
|
||
ENTRYPOINT ["/opt/rancher/run.sh"] | ||
CMD ["node"] |
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,11 @@ | ||
FROM golang:alpine | ||
|
||
RUN apk update && apk add git | ||
RUN go get github.com/urfave/cli | ||
RUN go get github.com/Sirupsen/logrus | ||
|
||
RUN mkdir -p /go/src/etcdwrapper | ||
WORKDIR /go/src/etcdwrapper | ||
ADD wrapper.go . | ||
|
||
RUN go build |
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,18 @@ | ||
#!/bin/bash -e | ||
|
||
ACCT=${ACCT:-llparse} | ||
VERSION=${VERSION:-v2.3.7-11} | ||
|
||
docker build -t etcdwrapper -f Dockerfile.wrapper . | ||
id=$(docker run -d --entrypoint=/bin/sh --name etcdwrapper etcdwrapper sleep 15) | ||
docker cp etcdwrapper:/go/src/etcdwrapper/etcdwrapper . | ||
docker rm -f $id | ||
|
||
docker build -t $ACCT/etcd:$VERSION . | ||
docker push $ACCT/etcd:$VERSION | ||
|
||
rm -f etcdwrapper | ||
|
||
if [ "$(which gsync)" ]; then | ||
gsync $ACCT/etcd:$VERSION | ||
fi |
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,12 @@ | ||
#!/bin/bash | ||
|
||
echo "Deleting persistent data..." | ||
|
||
rm -rf /pdata/* | ||
rm -rf /data/* | ||
|
||
PID=$(pidof etcd) | ||
while kill -0 $PID &> /dev/null; do | ||
kill $PID | ||
sleep 1 | ||
done |
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,18 @@ | ||
#!/bin/bash | ||
|
||
DATA_DIR=/pdata | ||
DR_FLAG=${DATA_DIR}/DR | ||
|
||
cd $DATA_DIR | ||
|
||
echo 'data.current' > $DR_FLAG | ||
echo -e "Disaster flag set.\n\nTriggering disaster recovery...this will automatically restart the container." | ||
|
||
sleep 5 | ||
|
||
# Continuously send SIGTERM | ||
PID=$(pidof etcd) | ||
while kill -0 $PID &> /dev/null; do | ||
kill $PID | ||
sleep 1 | ||
done |
Oops, something went wrong.