From 20ad3d699bf479f5a5dae1aa4a2788558e387616 Mon Sep 17 00:00:00 2001 From: mpl Date: Wed, 21 Oct 2015 01:46:33 +0200 Subject: [PATCH] pkg/deploy/gce: use WIP tarball if WIP=1 in request URL That way I don't have to constantly edit deploy.go (and fix it before committing a CL) when debugging for GCE. Change-Id: Ie4f75443e4356c5ce1a59931f3cb9e34344350be --- pkg/deploy/gce/deploy.go | 11 ++++++++++- pkg/deploy/gce/handler.go | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/deploy/gce/deploy.go b/pkg/deploy/gce/deploy.go index a73829ca1..f1c019f2a 100644 --- a/pkg/deploy/gce/deploy.go +++ b/pkg/deploy/gce/deploy.go @@ -116,6 +116,8 @@ type InstanceConf struct { blobDir string // bucketBase() + "/blobs" Ctime time.Time // Timestamp for this configuration. + + WIP bool // Whether to use the camlistored-WORKINPROGRESS.tar.gz tarball instead of the "production" one } func (conf *InstanceConf) bucketBase() string { @@ -454,6 +456,13 @@ OpLoop: func cloudConfig(conf *InstanceConf) string { config := strings.Replace(baseInstanceConfig, "INNODB_BUFFER_POOL_SIZE=NNN", "INNODB_BUFFER_POOL_SIZE="+strconv.Itoa(innodbBufferPoolSize(conf.Machine)), -1) + camlistoredTarball := "https://storage.googleapis.com/camlistore-release/docker/" + if conf.WIP { + camlistoredTarball += "camlistored-WORKINPROGRESS.tar.gz" + } else { + camlistoredTarball += "camlistored.tar.gz" + } + config = strings.Replace(config, "CAMLISTORED_TARBALL", camlistoredTarball, 1) if conf.SSHPub != "" { config += fmt.Sprintf("\nssh_authorized_keys:\n - %s\n", conf.SSHPub) } @@ -759,7 +768,7 @@ coreos: [Service] ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin camlistore/systemd-docker - ExecStartPre=/bin/bash -c '/usr/bin/curl https://storage.googleapis.com/camlistore-release/docker/camlistored.tar.gz | /bin/gunzip -c | /usr/bin/docker load' + ExecStartPre=/bin/bash -c '/usr/bin/curl CAMLISTORED_TARBALL | /bin/gunzip -c | /usr/bin/docker load' ExecStart=/opt/bin/systemd-docker run --rm -p 80:80 -p 443:443 --name %n -v /run/camjournald.sock:/run/camjournald.sock -v /var/lib/camlistore/tmp:/tmp --link=mysql.service:mysqldb camlistore/server RestartSec=1s Restart=always diff --git a/pkg/deploy/gce/handler.go b/pkg/deploy/gce/handler.go index 317440e14..a2a4ac4da 100644 --- a/pkg/deploy/gce/handler.go +++ b/pkg/deploy/gce/handler.go @@ -703,6 +703,7 @@ func (h *DeployHandler) confFromForm(r *http.Request) (*InstanceConf, error) { SSHPub: formValueOrDefault(r, "sshPub", ""), Password: formValueOrDefault(r, "password", project), Ctime: time.Now(), + WIP: r.FormValue("WIP") == "1", }, nil }