From 66372fe5e80ff735bd6bfc29432140c17280406d Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 2 Jun 2016 17:55:34 +0100
Subject: [PATCH] Remove hupper and mobyconfig watch
Signed-off-by: Dave Tucker
---
alpine/Dockerfile | 3 -
alpine/packages/Makefile | 3 -
alpine/packages/diagnostics/diagnostics | 2 -
.../diagnostics/etc/init.d/diagnostics | 2 +-
alpine/packages/hupper/.gitignore | 1 -
alpine/packages/hupper/Dockerfile | 13 ---
alpine/packages/hupper/Makefile | 10 --
alpine/packages/hupper/etc/init.d/hupper | 41 -------
alpine/packages/hupper/main.go | 106 ------------------
alpine/packages/mobyconfig/mobyconfig | 20 +---
10 files changed, 3 insertions(+), 198 deletions(-)
delete mode 100644 alpine/packages/hupper/.gitignore
delete mode 100644 alpine/packages/hupper/Dockerfile
delete mode 100644 alpine/packages/hupper/Makefile
delete mode 100755 alpine/packages/hupper/etc/init.d/hupper
delete mode 100644 alpine/packages/hupper/main.go
diff --git a/alpine/Dockerfile b/alpine/Dockerfile
index 67d4b66d0..1309ca23a 100644
--- a/alpine/Dockerfile
+++ b/alpine/Dockerfile
@@ -56,8 +56,6 @@ COPY packages/ntp15m/etc /etc/
COPY packages/binfmt_misc/etc /etc/
COPY packages/dnsfix/etc /etc/
COPY packages/hostsettings/etc /etc/
-COPY packages/hupper/hupper /bin/
-COPY packages/hupper/etc /etc/
COPY packages/hvtools/hv_kvp_daemon /sbin/
COPY packages/hvtools/hv_vss_daemon /sbin/
COPY packages/hvtools/etc /etc/
@@ -109,7 +107,6 @@ RUN \
rc-update add binfmt_misc sysinit && \
rc-update add dnsfix boot && \
rc-update add hostsettings boot && \
- rc-update add hupper default && \
rc-update add hv_kvp_daemon default && \
rc-update add hv_vss_daemon default && \
rc-update add vsudd default && \
diff --git a/alpine/packages/Makefile b/alpine/packages/Makefile
index 82452cd3f..727332528 100644
--- a/alpine/packages/Makefile
+++ b/alpine/packages/Makefile
@@ -3,7 +3,6 @@ all:
$(MAKE) -C diagnostics OS=linux
$(MAKE) -C transfused OS=linux
$(MAKE) -C tap-vsockd OS=linux
- $(MAKE) -C hupper OS=linux
$(MAKE) -C hvtools OS=linux
$(MAKE) -C docker OS=Linux
$(MAKE) -C nc-vsock OS=linux
@@ -14,7 +13,6 @@ all:
arm:
$(MAKE) -C transfused OS=linux ARCH=arm
- $(MAKE) -C hupper OS=linux ARCH=arm
$(MAKE) -C docker arm OS=Linux ARCH=arm
# Not cross building at present (C code)
# $(MAKE) -C tap-vsockd OS=linux ARCH=arm
@@ -29,7 +27,6 @@ clean:
$(MAKE) -C transfused clean
$(MAKE) -C tap-vsockd clean
$(MAKE) -C docker clean
- $(MAKE) -C hupper clean
$(MAKE) -C hvtools clean
$(MAKE) -C nc-vsock clean
$(MAKE) -C vsudd clean
diff --git a/alpine/packages/diagnostics/diagnostics b/alpine/packages/diagnostics/diagnostics
index b0aaf4dfe..d1e3c562b 100755
--- a/alpine/packages/diagnostics/diagnostics
+++ b/alpine/packages/diagnostics/diagnostics
@@ -14,8 +14,6 @@ then
TAPVS=$(ps -eo args | grep '^/sbin/tap-vsockd')
[ $? -eq 0 ] && printf "✓ Process tap-vsockd running\n" || printf "✗ No tap-vsockd process\n"
fi
-HUPPER=$(ps -eo args | grep '^/bin/hupper')
-[ $? -eq 0 ] && printf "✓ Process hupper running: $HUPPER\n" || printf "✗ No hupper process\n"
DOCKER=$(ps -eo args | grep '^/usr/bin/docker')
[ $? -eq 0 ] && printf "✓ Process docker running: $DOCKER\n" || printf "✗ No docker process\n"
CONTAINERD=$(ps -eo args | grep '^docker-containerd')
diff --git a/alpine/packages/diagnostics/etc/init.d/diagnostics b/alpine/packages/diagnostics/etc/init.d/diagnostics
index c254b056b..ae04c0397 100755
--- a/alpine/packages/diagnostics/etc/init.d/diagnostics
+++ b/alpine/packages/diagnostics/etc/init.d/diagnostics
@@ -2,7 +2,7 @@
depend()
{
- after docker hupper
+ after docker
}
start()
diff --git a/alpine/packages/hupper/.gitignore b/alpine/packages/hupper/.gitignore
deleted file mode 100644
index ae59b0946..000000000
--- a/alpine/packages/hupper/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/hupper
diff --git a/alpine/packages/hupper/Dockerfile b/alpine/packages/hupper/Dockerfile
deleted file mode 100644
index ddc5f3b30..000000000
--- a/alpine/packages/hupper/Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM golang:alpine
-
-RUN mkdir -p /go/src/hupper
-WORKDIR /go/src/hupper
-
-COPY . /go/src/hupper/
-
-ARG GOARCH
-ARG GOOS
-
-RUN go install
-
-RUN [ -f /go/bin/*/hupper ] && mv /go/bin/*/hupper /go/bin/ || true
diff --git a/alpine/packages/hupper/Makefile b/alpine/packages/hupper/Makefile
deleted file mode 100644
index 66dca6924..000000000
--- a/alpine/packages/hupper/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: hupper
-
-hupper: Dockerfile main.go
- docker build --build-arg GOOS=$(OS) --build-arg GOARCH=$(ARCH) -t hupper:build .
- docker run --rm hupper:build cat /go/bin/hupper > hupper
- chmod 755 hupper
-
-clean:
- rm -f hupper
- docker images -q hupper:build | xargs docker rmi -f
diff --git a/alpine/packages/hupper/etc/init.d/hupper b/alpine/packages/hupper/etc/init.d/hupper
deleted file mode 100755
index cac794b47..000000000
--- a/alpine/packages/hupper/etc/init.d/hupper
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/sbin/openrc-run
-
-description="docker config update manager"
-
-depend()
-{
- after docker
-}
-
-start()
-{
- ebegin "Starting docker config update manager"
-
- PIDFILE=/run/hupper.pid
- DOCKERPIDFILE=/run/docker.pid
- WATCH_CONFIG=$(mobyconfig watch /etc/docker/daemon.json)
- WATCH_PROXY=""
- PROXY="$(mobyconfig watch proxy)"
- [ -n "${PROXY}" ] && WATCH_PROXY="-path ${PROXY}"
- [ -z "${WATCH_CONFIG}" ] && exit 1
-
- start-stop-daemon --start --quiet \
- --background \
- --exec /bin/hupper \
- --make-pidfile --pidfile ${PIDFILE} \
- -- -pidfile ${PIDFILE} -huppidfile ${DOCKERPIDFILE} \
- -path ${WATCH_CONFIG} ${WATCH_PROXY}
-
- eend $? "Failed to start hupper"
-}
-
-stop()
-{
- ebegin "Stopping docker config update manager"
-
- PIDFILE=/run/hupper.pid
-
- start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
-
- eend $? "Failed to stop hupper"
-}
diff --git a/alpine/packages/hupper/main.go b/alpine/packages/hupper/main.go
deleted file mode 100644
index 4019d12c7..000000000
--- a/alpine/packages/hupper/main.go
+++ /dev/null
@@ -1,106 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "os"
- "os/exec"
- "strconv"
- "sync"
- "syscall"
-)
-
-var (
- paths stringSlice
- huppidfile string
- pidfile string
-)
-
-type stringSlice []string
-
-func (s *stringSlice) String() string {
- return fmt.Sprintf("%s", *s)
-}
-
-func (s *stringSlice) Set(value string) error {
- *s = append(*s, value)
- return nil
-}
-
-func init() {
- flag.Var(&paths, "path", "paths of the files to watch")
- flag.StringVar(&huppidfile, "huppidfile", "", "pidfile for process to signal")
- flag.StringVar(&pidfile, "pidfile", "", "my pidfile")
-}
-
-func main() {
- log.SetFlags(0)
- flag.Parse()
-
- if len(paths) < 1 {
- log.Fatal("watch path not set")
- }
-
- if huppidfile == "" {
- log.Fatal("huppidfile not set")
- }
-
- if pidfile != "" {
- pid := os.Getpid()
- pidbytes := []byte(strconv.Itoa(pid))
- _ = ioutil.WriteFile(pidfile, pidbytes, 0644)
- }
-
- var wg sync.WaitGroup
- wg.Add(len(paths))
-
- for _, path := range paths {
- watch, err := os.Open(path)
- if err != nil {
- log.Fatalln("Failed to open file", path, err)
- }
- // 43 bytes is the record size of the watch
- buf := make([]byte, 43)
- // initial state
- _, err = watch.Read(buf)
- if err != nil && err != io.EOF {
- log.Fatalln("Error reading watch file", err)
- }
-
- go func() {
- for {
- _, err := watch.Read(buf)
- if err != nil && err != io.EOF {
- log.Fatalln("Error reading watch file", err)
- }
- if err == io.EOF {
- continue
- }
- // a few changes eg debug do not require a daemon restart
- // however at present we cannot check changes, and most do
- restart := true
- if restart {
- log.Println("Restarting docker")
- cmd := exec.Command("service", "docker", "restart")
- // not much we can do if it does not restart
- _ = cmd.Run()
- } else {
- bytes, err := ioutil.ReadFile(huppidfile)
- if err != nil {
- continue
- }
- pidstring := string(bytes[:])
- pid, err := strconv.Atoi(pidstring)
- if err != nil {
- continue
- }
- syscall.Kill(pid, syscall.SIGHUP)
- }
- }
- }()
- }
- wg.Wait()
-}
diff --git a/alpine/packages/mobyconfig/mobyconfig b/alpine/packages/mobyconfig/mobyconfig
index fdbfdb06f..c9ca32d6b 100755
--- a/alpine/packages/mobyconfig/mobyconfig
+++ b/alpine/packages/mobyconfig/mobyconfig
@@ -2,7 +2,7 @@
if [ $# -ne 2 ]
then
- printf "usage: $0 [get|exists|watch|path|dir|find] key\n"
+ printf "usage: $0 [get|exists|path|dir|find] key\n"
exit 0
fi
@@ -84,21 +84,5 @@ then
fi
fi
-# might be nicer if watch returned a file descriptor not a path
-# /Database/branch/master/watch/com.docker.driver.amd64-linux.node/etc.node/docker.node/daemon.json.node/tree.live
-if [ $1 == "watch" ]
-then
- WATCHBASE="/Database/branch/master/watch/${DATABASE}.node"
- WATCH="${WATCHBASE}/$(echo ${KEY} | sed 's@/@.node/@g').node/tree.live"
- if [ -f ${WATCH} ]
- then
- printf ${WATCH}
- exit 0
- else
- printf "No such watch: ${WATCH}\n" 2>&1
- exit 1
- fi
-fi
-
-printf "usage: $0 [get|exists|watch|path|dir|find] key\n"
+printf "usage: $0 [get|exists|path|dir|find] key\n"
exit 1