website: name the demo blobserver container, kill on start-up

This commit is contained in:
Brad Fitzpatrick 2015-11-11 14:45:50 +00:00
parent 321272d65c
commit afd28ae279
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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,