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
This commit is contained in:
mpl 2015-10-21 01:46:33 +02:00
parent 8f31f48fe1
commit 20ad3d699b
2 changed files with 11 additions and 1 deletions

View File

@ -116,6 +116,8 @@ type InstanceConf struct {
blobDir string // bucketBase() + "/blobs" blobDir string // bucketBase() + "/blobs"
Ctime time.Time // Timestamp for this configuration. 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 { func (conf *InstanceConf) bucketBase() string {
@ -454,6 +456,13 @@ OpLoop:
func cloudConfig(conf *InstanceConf) string { func cloudConfig(conf *InstanceConf) string {
config := strings.Replace(baseInstanceConfig, "INNODB_BUFFER_POOL_SIZE=NNN", "INNODB_BUFFER_POOL_SIZE="+strconv.Itoa(innodbBufferPoolSize(conf.Machine)), -1) 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 != "" { if conf.SSHPub != "" {
config += fmt.Sprintf("\nssh_authorized_keys:\n - %s\n", conf.SSHPub) config += fmt.Sprintf("\nssh_authorized_keys:\n - %s\n", conf.SSHPub)
} }
@ -759,7 +768,7 @@ coreos:
[Service] [Service]
ExecStartPre=/usr/bin/docker run --rm -v /opt/bin:/opt/bin camlistore/systemd-docker 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 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 RestartSec=1s
Restart=always Restart=always

View File

@ -703,6 +703,7 @@ func (h *DeployHandler) confFromForm(r *http.Request) (*InstanceConf, error) {
SSHPub: formValueOrDefault(r, "sshPub", ""), SSHPub: formValueOrDefault(r, "sshPub", ""),
Password: formValueOrDefault(r, "password", project), Password: formValueOrDefault(r, "password", project),
Ctime: time.Now(), Ctime: time.Now(),
WIP: r.FormValue("WIP") == "1",
}, nil }, nil
} }