Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #85 from LLParse/metadata-loop-hack
Browse files Browse the repository at this point in the history
etcd v2.3.7-11 Metadata loop hack
  • Loading branch information
cloudnautique authored Feb 9, 2017
2 parents df516fc + 6457e9f commit f0bc9c4
Show file tree
Hide file tree
Showing 7 changed files with 729 additions and 0 deletions.
21 changes: 21 additions & 0 deletions etcd/containers/0.12.0/etcd/Dockerfile
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"]
11 changes: 11 additions & 0 deletions etcd/containers/0.12.0/etcd/Dockerfile.wrapper
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
18 changes: 18 additions & 0 deletions etcd/containers/0.12.0/etcd/build
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
12 changes: 12 additions & 0 deletions etcd/containers/0.12.0/etcd/delete
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
18 changes: 18 additions & 0 deletions etcd/containers/0.12.0/etcd/disaster
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
Loading

0 comments on commit f0bc9c4

Please sign in to comment.