tools/cmd/godoc
Chris Broadfoot 2dbf5794f6 [release-branch.go1.11] godoc: migrate to App Engine flexible
See bug for more details on exactly what was migrated.

Notably:
* No more Google-internal deployment scripts; see README.godoc-app and
  the Makefile for details.
* Build tag "golangorg" is used for the godoc configuration used for
  golang.org.
* Use of App Engine libraries replaced with GCP client libraries.
* Redis is used to replace App Engine memcache.
* Google analytics is controlled by an environment variable.
* Regression tests have been migrated from Google-internal.
* hg -> git hash map is moved from Google-internal.

Updates golang/go#28893
Updates golang/go#27205

Change-Id: Ia0a983f239c50eda8be2363494c8b784f60c2c6d
Reviewed-on: https://go-review.googlesource.com/133355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-on: https://go-review.googlesource.com/c/150599
2018-11-20 23:23:52 +00:00
..
.gitignore [release-branch.go1.11] cmd/godoc: simplify dev and prod environment for App Engine 2018-11-20 20:51:11 +00:00
Dockerfile.prod [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
Makefile [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
README.godoc-app [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
app.dev.yaml [release-branch.go1.11] cmd/godoc: simplify dev and prod environment for App Engine 2018-11-20 20:51:11 +00:00
app.prod.yaml [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
appinit.go [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +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 [release-branch.go1.11] cmd/godoc: redirect to https instead of http for blog.golang.org 2018-08-22 02:33:58 +00:00
codewalk.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
dl.go [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
doc.go cmd/godoc: Fix package comment inconsistencies. 2017-03-04 00:53:44 +00:00
generate-index.bash [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
godoc19_test.go cmd/godoc: fix expected test output for Go 1.8 and older 2017-04-26 05:21:38 +00:00
godoc_test.go cmd/godoc: fix TestWeb for versions < 1.11 2018-07-25 15:26:38 +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 [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
hg-git-mapping.bin [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
index.go cmd/godoc: exclude /pkg from search indexing 2015-03-12 00:26:38 +00:00
main.go [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
play.go [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
regtest.bash [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
remotesearch.go [release-branch.go1.11] godoc: migrate to App Engine flexible 2018-11-20 23:23:52 +00:00
x.go godoc/static: add perf, review, sync subrepos 2018-03-30 16:45:20 +00:00

README.godoc-app

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:

  VERSION=$(git rev-parse HEAD) make docker-prod

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
-----------------------

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

  VERSION=$(git rev-parse HEAD) make deploy-prod

Run regression tests:

  make regtest

Go to the console to migrate traffic to the newly deployed version:

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

Shut down any very old versions (keep at least one to roll back to, just in case).

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)