From afd28ae2796eef141bd53823ba013c6b470f7349 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 11 Nov 2015 14:45:50 +0000 Subject: [PATCH] website: name the demo blobserver container, kill on start-up --- pkg/cloudlaunch/cloudlaunch.go | 2 +- website/camweb.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/cloudlaunch/cloudlaunch.go b/pkg/cloudlaunch/cloudlaunch.go index 0b4169b50..d150457d6 100644 --- a/pkg/cloudlaunch/cloudlaunch.go +++ b/pkg/cloudlaunch/cloudlaunch.go @@ -66,7 +66,7 @@ coreos: [Service] Type=simple - ExecStartPre=/bin/sh -c 'mkdir -p /opt/bin && /usr/bin/curl -f -o /opt/bin/$NAME $URL?$(date +%s) && chmod +x /opt/bin/$NAME' + ExecStartPre=/bin/sh -c 'mkdir -p /opt/bin && /usr/bin/curl --silent -f -o /opt/bin/$NAME $URL?$(date +%s) && chmod +x /opt/bin/$NAME' ExecStart=/opt/bin/$NAME RestartSec=10 Restart=always diff --git a/website/camweb.go b/website/camweb.go index f6413eb5d..0d730ccec 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -470,9 +470,16 @@ func runDemoBlobserverLoop() { if _, err := exec.LookPath("docker"); err != nil { return } + const name = "demoblob3179" + if err := exec.Command("docker", "kill", name).Run(); err == nil { + // It was actually running. + exec.Command("docker", "rm", name).Run() + log.Printf("Killed, removed old %q container.", name) + } for { cmd := exec.Command("docker", "run", "--rm", + "--name="+name, "-e", "CAMLI_ROOT="+prodSrcDir+"/website/blobserver-example/root", "-e", "CAMLI_PASSWORD="+randHex(20), "-v", camSrcDir()+":"+prodSrcDir,