From c84a65a41622848b5563789d431551db642bb676 Mon Sep 17 00:00:00 2001 From: siddharthist Date: Mon, 26 Oct 2015 12:31:04 -0700 Subject: [PATCH] Make all samples work in Docker container Fixes #106 --- Dockerfile | 14 +++++--- samples/misc.json | 17 ++-------- samples/network.json | 60 +++++------------------------------ samples/packages.json | 14 +------- samples/systemctl.json | 25 --------------- samples/users-and-groups.json | 14 +------- 6 files changed, 21 insertions(+), 123 deletions(-) delete mode 100644 samples/systemctl.json diff --git a/Dockerfile b/Dockerfile index 31fe197..796a525 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM gliderlabs/alpine:3.2 +FROM ubuntu:wily MAINTAINER Langston Barrett (@siddharthist) # If this file doesn't immedately work for you, please submit a Github issue: @@ -10,7 +10,10 @@ MAINTAINER Langston Barrett (@siddharthist) # Note that Distributive doesn't have access to certain system information when # run in a container. -RUN apk update && apk add bash go git php-cli && rm -rf /var/cache/apk/* +RUN apt-get update +# network: net-tools +# misc: lm-sensors, php5-cli +RUN apt-get install -y bash golang git php5-cli lm-sensors net-tools && apt-get clean WORKDIR /gopath/src/github.com/CiscoCloud/distributive RUN mkdir -p /gopath/{bin,src} @@ -19,11 +22,12 @@ ENV GOBIN /gopath/bin ENV PATH $PATH:/gopath/bin RUN go get github.com/tools/godep ADD . /gopath/src/github.com/CiscoCloud/distributive -# Note: docker-machine on Windows / OS X sometimes gets its time out of sync, which can cause SSL verification failures. -# If this happens, `go get .`, will fail. If you run into this problem, run this command at your terminal: +# Note: docker-machine on Windows / OS X sometimes gets its time out of sync, +# which can cause SSL verification failures. If this happens, `go get .`, will +# fail. If you run into this problem, run this command at your terminal: # docker-machine ssh ${machine} 'sudo ntpclient -s -h pool.ntp.org' # After that, you can retry `docker build .`. RUN go get . RUN go build . -CMD ["distributive", "-f", "/gopath/src/github.com/CiscoCloud/distributive/samples/filesystem.json", "-d", "", "--verbosity", "info"] +CMD ["distributive", "-d", "/gopath/src/github.com/CiscoCloud/distributive/samples/", "--verbosity", "info"] diff --git a/samples/misc.json b/samples/misc.json index da05eeb..8ee3beb 100644 --- a/samples/misc.json +++ b/samples/misc.json @@ -2,22 +2,9 @@ "Name": "Miscellaneous system checks", "Checklist" : [ { - "Name": "CPU temperature threshold", - "ID": "temp", - "Parameters": ["80"] - }, - { - "Name": "/sbin/init check", + "Name": "shell running check", "ID" : "running", - "Parameters": ["/sbin/init"] - }, - { - "ID" : "module", - "Parameters" : ["ext4"] - }, - { - "ID" : "kernelParameter", - "Parameters" : ["kernel.ctrl-alt-del"] + "Parameters": ["ps"] }, { "ID" : "phpConfig", diff --git a/samples/network.json b/samples/network.json index a5b68c7..1b90aff 100644 --- a/samples/network.json +++ b/samples/network.json @@ -1,81 +1,37 @@ { "Name": "Network checks", "Checklist" : [ - { - "ID": "port", - "Parameters": ["80"] - }, - { - "ID": "portTCP", - "Parameters": ["80"] - }, - { - "ID": "portUDP", - "Parameters": ["80"] - }, { "ID" : "interfaceExists", - "Parameters" : ["docker0"] - }, - { - "ID" : "interfaceExists", - "Parameters" : ["wlp1s0"] - }, - { - "ID" : "interfaceExists", - "Parameters" : ["lo"] + "Parameters" : ["eth0"] }, { "ID" : "up", - "Parameters": ["wlp1s0"] - }, - { - "ID" : "ip4", - "Parameters" : ["wlp1s0", "10.60.91.12"] - }, - { - "ID" : "ip6", - "Parameters" : ["wlp1s0", "fe80::59bf:babe:f7bb:a327"] - }, - { - "ID" : "gateway", - "Parameters" : ["192.168.0.1"] - }, - { - "ID" : "gatewayInterface", - "Parameters" : ["wlp1s0"] + "Parameters": ["eth0"] }, { "ID" : "gatewayInterface", - "Parameters" : ["docker0"] + "Parameters" : ["eth0"] }, { "ID" : "host", - "Parameters" : ["google.com"] + "Parameters" : ["github.com"] }, { "ID" : "TCP", - "Parameters" : ["google.com:80"] + "Parameters" : ["github.com:80"] }, { "ID" : "UDP", - "Parameters" : ["google.com:80"] + "Parameters" : ["github.com:80"] }, { "ID" : "UDP", - "Parameters" : ["yahoo.com:80"] - }, - { - "ID" : "routingTableDestination", - "Parameters" : ["192.168.0.0"] + "Parameters" : ["github.com:80"] }, { "ID" : "routingTableInterface", - "Parameters" : ["docker0"] - }, - { - "ID" : "routingTableGateway", - "Parameters" : ["192.168.0.1"] + "Parameters" : ["eth0"] }, { "ID" : "tcpTimeout", diff --git a/samples/packages.json b/samples/packages.json index d368b4c..50d7a5f 100644 --- a/samples/packages.json +++ b/samples/packages.json @@ -3,19 +3,7 @@ "Checklist" : [ { "ID" : "installed", - "Parameters" : ["urxvt"] - }, - { - "ID" : "repoExistsUri", - "Parameters" : ["rpm", "http://apt.sw.be/fedora/$releasever/en/$basearch/dag/"] - }, - { - "ID" : "repoexists", - "Parameters" : ["rpm", "core"] - }, - { - "ID" : "pacmanIgnore", - "Parameters" : ["pulseaudio"] + "Parameters" : ["git"] } ] } diff --git a/samples/systemctl.json b/samples/systemctl.json deleted file mode 100644 index 13b5831..0000000 --- a/samples/systemctl.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "Name": "Systemd checks", - "Checklist" : [ - { - "ID" : "systemctlLoaded", - "Parameters" : ["docker.service"] - }, - { - "ID" : "systemctlActive", - "Parameters" : ["boot.automount"] - }, - { - "ID" : "systemctlSockListening", - "Parameters" : ["/var/run/docker.sock"] - }, - { - "ID" : "systemctlTimer", - "Parameters" : ["man-db.timer"] - }, - { - "ID" : "systemctlTimerLoaded", - "Parameters" : ["man-db.timer"] - } - ] -} diff --git a/samples/users-and-groups.json b/samples/users-and-groups.json index b545bfc..1fa7c49 100644 --- a/samples/users-and-groups.json +++ b/samples/users-and-groups.json @@ -3,11 +3,7 @@ "Checklist" : [ { "ID" : "groupExists", - "Parameters" : ["wheel"] - }, - { - "ID" : "userInGroup", - "Parameters" : ["root", "wheel"] + "Parameters" : ["sudo"] }, { "ID" : "groupExists", @@ -25,17 +21,9 @@ "ID" : "userHasUID", "Parameters" : ["root", "0"] }, - { - "ID" : "userHasGID", - "Parameters" : ["lb", "100"] - }, { "ID" : "UserHasHomeDir", "Parameters" : ["root", "/root"] - }, - { - "ID" : "UserHasHomeDir", - "Parameters" : ["lb", "/home/lb"] } ] }