website: record version with buildinfo

So now when we get the e-mail on a website restart, we'll actually
know what version of it is running.

Also,
make.go: skip gopherjs checks when we only build the website or
camnetdns.

Change-Id: I3f6985afc8931fe478cc4f7caba2b1fc31bc815b
This commit is contained in:
mpl 2019-03-27 23:07:28 +01:00
parent 9bafcb9592
commit 52e4df095d
2 changed files with 12 additions and 1 deletions

View File

@ -794,6 +794,10 @@ func verifyGoVersion() {
log.Fatalf("Your version of Go (%s) is too old. Perkeep requires Go 1.%d or later.", string(out), goVersionMinor) log.Fatalf("Your version of Go (%s) is too old. Perkeep requires Go 1.%d or later.", string(out), goVersionMinor)
} }
if *website || *camnetdns {
return
}
if minorVersion != gopherJSGoMinor { if minorVersion != gopherJSGoMinor {
verifyGopherjsGoroot(fmt.Sprintf("1.%d", minorVersion)) verifyGopherjsGoroot(fmt.Sprintf("1.%d", minorVersion))
} }

View File

@ -43,6 +43,7 @@ import (
"perkeep.org/internal/netutil" "perkeep.org/internal/netutil"
"perkeep.org/internal/osutil" "perkeep.org/internal/osutil"
"perkeep.org/pkg/buildinfo"
"perkeep.org/pkg/deploy/gce" "perkeep.org/pkg/deploy/gce"
"perkeep.org/pkg/types/camtypes" "perkeep.org/pkg/types/camtypes"
@ -81,6 +82,7 @@ var (
alsoRun = flag.String("also_run", "", "[optiona] Path to run as a child process. (Used to run perkeep.org's ./scripts/run-blob-server)") alsoRun = flag.String("also_run", "", "[optiona] Path to run as a child process. (Used to run perkeep.org's ./scripts/run-blob-server)")
devMode = flag.Bool("dev", false, "in dev mode") devMode = flag.Bool("dev", false, "in dev mode")
flagStaging = flag.Bool("staging", false, "Deploy to a test GCE instance. Requires -cloudlaunch=true") flagStaging = flag.Bool("staging", false, "Deploy to a test GCE instance. Requires -cloudlaunch=true")
flagVersion = flag.Bool("version", false, "show version")
gceProjectID = flag.String("gce_project_id", "", "GCE project ID; required if not running on GCE and gce_log_name is specified.") gceProjectID = flag.String("gce_project_id", "", "GCE project ID; required if not running on GCE and gce_log_name is specified.")
gceLogName = flag.String("gce_log_name", "", "GCE Cloud Logging log name; if non-empty, logs go to Cloud Logging instead of Apache-style local disk log files") gceLogName = flag.String("gce_log_name", "", "GCE Cloud Logging log name; if non-empty, logs go to Cloud Logging instead of Apache-style local disk log files")
@ -759,7 +761,7 @@ func sendStartingEmail() {
return return
} }
mailGun = mailgun.NewMailgun(cfg.Domain, cfg.APIKey, cfg.PublicAPIKey) mailGun = mailgun.NewMailgun(cfg.Domain, cfg.APIKey, cfg.PublicAPIKey)
contents := `Perkeep website starting with binary XXXXTODO and content at git rev ` + string(contentRev) contents := `Perkeep website starting with binary ` + buildinfo.Summary() + ` and content at git rev ` + string(contentRev)
m := mailGun.NewMessage( m := mailGun.NewMessage(
"noreply@perkeep.org (Perkeep Website)", "noreply@perkeep.org (Perkeep Website)",
"Perkeep camweb restarting", "Perkeep camweb restarting",
@ -839,6 +841,11 @@ func initStaging() error {
func main() { func main() {
flag.Parse() flag.Parse()
if *flagVersion {
fmt.Fprintf(os.Stderr, "pk-web version: %s\nGo version: %s (%s/%s)\n",
buildinfo.Summary(), runtime.Version(), runtime.GOOS, runtime.GOARCH)
return
}
if err := initStaging(); err != nil { if err := initStaging(); err != nil {
log.Fatalf("Error setting up staging: %v", err) log.Fatalf("Error setting up staging: %v", err)
} }