diff --git a/pkg/deploy/gce/deploy.go b/pkg/deploy/gce/deploy.go index 03644e32a..7b2d415ad 100644 --- a/pkg/deploy/gce/deploy.go +++ b/pkg/deploy/gce/deploy.go @@ -67,7 +67,7 @@ const ( configDir = "config" ConsoleURL = "https://console.developers.google.com" - HelpCreateProject = "Go to " + ConsoleURL + " to create a new Google Cloud project." + HelpCreateProject = "Go to " + ConsoleURL + " to create a new Google Cloud project" HelpEnableAPIs = `Enable the project APIs: in your project console, navigate to "APIs and auth", "APIs". In the list, enable "Google Cloud Storage", "Google Cloud Storage JSON API", and "Google Compute Engine".` helpDeleteInstance = `To delete an existing Compute Engine instance: in your project console, navigate to "Compute", "Compute Engine", and "VM instances". Select your instance and click "Delete".` HelpManageSSHKeys = `To manage/add SSH keys: in your project console, navigate to "Compute", "Compute Engine", and "VM instances". Click on your instance name. Scroll down to the SSH Keys section.` diff --git a/pkg/deploy/gce/handler.go b/pkg/deploy/gce/handler.go index b8bff5f92..c95e5086b 100644 --- a/pkg/deploy/gce/handler.go +++ b/pkg/deploy/gce/handler.go @@ -69,6 +69,22 @@ var ( "machine": Machine, "zone": Zone, } + // TODO(mpl): query for them, and cache them. + zoneValues = []string{ + "us-central1-a", + "us-central1-b", + "us-central1-f", + "europe-west1-b", + "europe-west1-c", + "asia-east1-a", + "asia-east1-b", + "asia-east1-c", + } + machineValues = []string{ + "g1-small", + "n1-highcpu-2", + } + // DevHandler: if true, use HTTP instead of HTTPS, force permissions prompt for OAuth, // do not actually create an instance. It has no effect if set after NewHandler is // called. @@ -201,9 +217,11 @@ func (h *DeployHandler) serveRoot(w http.ResponseWriter, r *http.Request) { h.tplMu.RLock() defer h.tplMu.RUnlock() if err := h.tpl.ExecuteTemplate(w, "withform", &TemplateData{ - Prefix: h.prefix, - Help: h.help, - Defaults: formDefaults, + Prefix: h.prefix, + Help: h.help, + Defaults: formDefaults, + ZoneValues: zoneValues, + MachineValues: machineValues, }); err != nil { h.Print(err) } @@ -404,11 +422,13 @@ func (h *DeployHandler) serveFormError(w http.ResponseWriter, err error, hints . h.tplMu.RLock() defer h.tplMu.RUnlock() if tplErr := h.tpl.ExecuteTemplate(w, "withform", &TemplateData{ - Prefix: h.prefix, - Help: h.help, - Err: err, - Hints: topHints, - Defaults: formDefaults, + Prefix: h.prefix, + Help: h.help, + Err: err, + Hints: topHints, + Defaults: formDefaults, + ZoneValues: zoneValues, + MachineValues: machineValues, }); tplErr != nil { h.Printf("Could not serve form error %q because: %v", err, tplErr) } @@ -460,6 +480,8 @@ func (h *DeployHandler) serveInstanceState(w http.ResponseWriter, r *http.Reques Project: conf.Project, Password: conf.Password, Defaults: formDefaults, + ZoneValues: zoneValues, + MachineValues: machineValues, }) return } @@ -703,6 +725,8 @@ type TemplateData struct { CertFingerprint string // SHA-256 fingerprint of the self-signed HTTPS certificate. ProjectConsoleURL string Password string // password provided by user. defaults to project ID. + ZoneValues []string + MachineValues []string } const toHyperlink = `$1$3` @@ -810,6 +834,7 @@ var tplHTML = ` {{if .InstanceIP}}
Success. Your Camlistore instance should be up at https://{{.InstanceIP}} (login: ` + camliUsername + `, password: {{.Password}}). It can take a couple of minutes to be ready.
+Please bookmark this page in case you need to come back for the instruction.
{{end}} {{if .ProjectConsoleURL}}@@ -850,25 +875,44 @@ var tplHTML = `
{{template "footer" .}}