doc: Upgrade the crashpad-home App Engine app to the Go 1.11 runtime

App Engine’s Go 1.9 runtime is no longer functional. See
https://cloud.google.com/appengine/docs/deprecations and
https://cloud.google.com/appengine/docs/standard/go111/go-differences.

Note that this doesn’t migrate away from the App Engine SDK per
https://cloud.google.com/appengine/docs/standard/go111/go-differences#migrating-appengine-sdk,
as this service does use App Engine APIs. Newer Go runtimes are
available, currently including 1.12, 1.13, and a beta version of 1.14,
but 1.12 and newer do not support App Engine APIs per
https://cloud.google.com/appengine/docs/standard/go112/go-differences,
so this upgrade targets the Go 1.11 runtime.

Change-Id: Ia9c28cfb1abe5f226ae8c07de90cd2e9b6e19a48
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2328805
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
Mark Mentovai 2020-07-30 19:26:23 -04:00 committed by Commit Bot
parent 4ae896bad0
commit 9cd1a4dadb
4 changed files with 60 additions and 33 deletions

View File

@ -1,39 +1,51 @@
This is the App Engine app that serves https://crashpad.chromium.org/.
To work on this app, obtain the App Engine SDK for Go from
https://cloud.google.com/appengine/docs/go/download. Unpacking it produces a
go_appengine directory. This may be added to your $PATH for convenience,
although it is not necessary.
To work on this app, obtain the following packages:
- Go, from https://golang.org/dl/. This is only necessary for local development
and testing. The directory containing the “go” executable, such as
/usr/local/go/bin, must appear in $PATH. It does not appear critical for the
Go version used to match the Go runtime version used (for example, these
instructions were tested with Go 1.14 locally but a Go 1.11 runtime when
deployed), but if problems are encountered, it would be wise to use the same
version for both local development and AppEngine deployment.
- The Google Cloud SDK from, https://cloud.google.com/sdk/docs. This is
necessary for both local development and for AppEngine deployment. Unpacking
this package produces a google-cloud-sdk directory, whose bin child directory
may be added to $PATH for convenience, although this is not strictly
necessary.
The commands in this README are expected to be run from the directory containing
app.yaml.
it. $GOPATH must also be set to include this directory:
The App Engine SDK for Go provides App Engine packages at the “appengine” import
path, but not the newer “google.golang.org/appengine” path. The Crashpad app
uses the newer paths. See
https://github.com/golang/appengine#2-update-import-paths and
https://code.google.com/p/googleappengine/issues/detail?id=11670. To make these
available, obtain a Go release from https://golang.org/dl/, and run:
$ GOROOT=…/go_appengine/goroot GOPATH=…/go_appengine/gopath go get -d
% export GOPATH="$(go env GOPATH):$(pwd)"
To test locally:
$ …/go_appengine/goapp serve
% go get -d crashpad-home
% …/google-cloud-sdk/bin/dev_appserver.py src/crashpad-home
Look for the “Starting module "default" running at: http://localhost:8080” line,
which tells you the URL of the local running instance of the app.
which tells you the URL of the local running instance of the app. Test
http://localhost:8080/ and http://localhost:8080/doxygen to ensure that they
work.
To deploy:
$ version=$(git rev-parse --short=12 HEAD)
$ [[ -n "$(git status --porcelain)" ]] && version+=-dirty
$ …/go_appengine/goapp deploy -version "${version}"
% version=$(git rev-parse --short=12 HEAD)
% [[ -n "$(git status --porcelain)" ]] && version+=-dirty
% …/google-cloud-sdk/bin/gcloud app deploy \
--project=crashpad-home --version="${version}" --no-promote \
"$(pwd)/src/crashpad-home"
Note that app.yaml does not name a “version” to encourage you to use a git hash
as the version, as above.
(Note: the $(pwd) is necessary for “gcloud app deploy” to recognize that the
application is in GOPATH, putting it into “GOPATH mode”. This normally happens
correctly on its own even with a relative path, but will fail for relative
paths when $(pwd) is a symbolic link. Using an absolute path here will save you
from this frustration, freeing you up to undoubtedly experience other
frustrations.)
Activate a newly-deployed version by visiting the App Engine console at
https://appengine.google.com/deployment?&app_id=s~crashpad-home, selecting it,
and choosing “Make Default”. It is also possible to delete old versions from
this page when they are no longer needed.
https://console.cloud.google.com/appengine/versions?project=crashpad-home,
selecting it, and choosing “Migrate Traffic”. It is also possible to delete old
versions from this page when they are no longer needed.

View File

@ -1,8 +0,0 @@
application: crashpad-home
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
secure: always

View File

@ -0,0 +1,20 @@
# Copyright 2015 The Crashpad Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
runtime: go111
handlers:
- url: /.*
script: auto
secure: always

View File

@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// Package crashpad mirrors crashpad documentation from Chromiums git repo.
package crashpad
package main
import (
"encoding/base64"
@ -31,6 +30,10 @@ import (
"google.golang.org/appengine/urlfetch"
)
func main() {
appengine.Main()
}
func init() {
http.HandleFunc("/", handler)
}