1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:44:45 -07:00
go/cmd/godoc
Chris Broadfoot 837e80568c godoc/proxy: remove use of httputil.ReverseProxy for /share
ReverseProxy doesn't re-set the Request's Host field, only
Request.URL.Host.
The HTTP/2 client prefers Request.Host over Request.URL.Host, so this
results in the request being sent back to the host that originally
accepted the request.
This results in an infinite redirect (and consumption of many connections to
itself).
See Issue golang/go#28168 for details.

Replace it with a simple proxy that drops all the headers (except
Content-Type).

I tried setting the proxy.Director, but it still didn't work. Could do
with some more investigation.

Fixes golang/go#28134.

Change-Id: I5051ce72a379dcacfbe8484f58f8cf7d9385024d
Reviewed-on: https://go-review.googlesource.com/c/141718
Run-TryBot: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-12 17:29:21 +00:00
..
.gitignore cmd/godoc: simplify dev and prod environment for App Engine 2018-09-28 11:54:07 +00:00
app.dev.yaml cmd/godoc: simplify dev and prod environment for App Engine 2018-09-28 11:54:07 +00:00
app.prod.yaml cmd/godoc: re-enable host checking, allow test versions 2018-10-03 01:52:03 +00:00
appinit.go cmd/godoc: start RunIndexer synchronously when index is present 2018-11-12 23:23:51 +00:00
autocert.go cmd/godoc: support http-01 ACME challenge in optional autocert support 2018-04-11 21:25:11 +00:00
blog.go cmd/godoc: redirect to https instead of http for blog.golang.org 2018-08-22 02:22:54 +00:00
cloudbuild.yaml cmd/godoc: add cloud build config 2018-10-04 02:18:13 +00:00
codewalk.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
dl.go godoc: migrate to App Engine flexible 2018-10-02 04:34:10 +00:00
doc.go cmd/godoc: cleanup documentation for CLI mode 2018-10-18 18:24:39 +00:00
Dockerfile.prod cmd/godoc: add missing Dockerfile ARG 2018-10-10 15:29:03 +00:00
generate-index.bash godoc: migrate to App Engine flexible 2018-10-02 04:34:10 +00:00
godoc_test.go godoc, cmd/godoc: remove CLI support 2018-10-11 02:31:40 +00:00
goroot.go cmd/godoc: use same GOROOT discovery as Go 1.10's cmd/go 2018-06-12 01:24:34 +00:00
handlers.go godoc, cmd/godoc: remove CLI support 2018-10-11 02:31:40 +00:00
hg-git-mapping.bin godoc: migrate to App Engine flexible 2018-10-02 04:34:10 +00:00
index.go cmd/godoc: exclude /pkg from search indexing 2015-03-12 00:26:38 +00:00
main.go cmd/godoc: cleanup documentation for CLI mode 2018-10-18 18:24:39 +00:00
Makefile cmd/godoc: add cloud build config 2018-10-04 02:18:13 +00:00
play.go godoc: migrate to App Engine flexible 2018-10-02 04:34:10 +00:00
README.godoc-app cmd/godoc: add cloud build config 2018-10-04 02:18:13 +00:00
regtest_test.go godoc/proxy: remove use of httputil.ReverseProxy for /share 2018-12-12 17:29:21 +00:00
x.go godoc/static: add perf, review, sync subrepos 2018-03-30 16:45:20 +00:00

godoc on Google App Engine
==========================

Prerequisites
-------------

* Google Cloud SDK
  https://cloud.google.com/sdk/

* Redis

* Go sources under $GOROOT

* Godoc sources inside $GOPATH
  (go get -d golang.org/x/tools/cmd/godoc)


Running locally, in production mode
-----------------------------------

Build the app:

  go build -tags golangorg

Run the app:

  ./godoc

godoc should come up at http://localhost:8080

Use the PORT environment variable to change the port:

    PORT=8081 ./godoc

Running locally, in production mode, using Docker
-------------------------------------------------

Build the app's Docker container:

  make docker-build

Make sure redis is running on port 6379:

  $ echo PING | nc localhost 6379
  +PONG
  ^C

Run the datastore emulator:

  gcloud beta emulators datastore start --project golang-org

In another terminal window, run the container:

  $(gcloud beta emulators datastore env-init)

  docker run --rm \
    --net host \
    --env GODOC_REDIS_ADDR=localhost:6379 \
    --env DATASTORE_EMULATOR_HOST=$DATASTORE_EMULATOR_HOST \
    --env DATASTORE_PROJECT_ID=$DATASTORE_PROJECT_ID \
    gcr.io/golang-org/godoc

godoc should come up at http://localhost:8080


Deploying to golang.org
-----------------------

Make sure you're signed in to gcloud:

  gcloud auth login

Build the image, push it to gcr.io, and deploy to Flex:

  make cloud-build deploy

Point the load balancer to the newly deployed version:
(This also runs regression tests)

  make publish

Stop and/or delete down any very old versions. (Stopped versions can be re-started.)
Keep at least one older verson to roll back to, just in case.
You can also migrate traffic to the new version via this UI.

  https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=default&versionssize=50


Troubleshooting
---------------

Ensure the Cloud SDK is on your PATH and you have the app-engine-go component
installed (gcloud components install app-engine-go) and your components are
up-to-date (gcloud components update)