README.godoc-app
1godoc on Google App Engine
2==========================
3
4Prerequisites
5-------------
6
7* Google Cloud SDK
8 https://cloud.google.com/sdk/
9
10* Redis
11
12* Go sources under $GOROOT
13
14* Godoc sources inside $GOPATH
15 (go get -d golang.org/x/tools/cmd/godoc)
16
17
18Running locally, in production mode
19-----------------------------------
20
21Build the app:
22
23 go build -tags golangorg
24
25Run the app:
26
27 ./godoc
28
29godoc should come up at http://localhost:8080
30
31Use the PORT environment variable to change the port:
32
33 PORT=8081 ./godoc
34
35Running locally, in production mode, using Docker
36-------------------------------------------------
37
38Build the app's Docker container:
39
40 make docker-build
41
42Make sure redis is running on port 6379:
43
44 $ echo PING | nc localhost 6379
45 +PONG
46 ^C
47
48Run the datastore emulator:
49
50 gcloud beta emulators datastore start --project golang-org
51
52In another terminal window, run the container:
53
54 $(gcloud beta emulators datastore env-init)
55
56 docker run --rm \
57 --net host \
58 --env GODOC_REDIS_ADDR=localhost:6379 \
59 --env DATASTORE_EMULATOR_HOST=$DATASTORE_EMULATOR_HOST \
60 --env DATASTORE_PROJECT_ID=$DATASTORE_PROJECT_ID \
61 gcr.io/golang-org/godoc
62
63godoc should come up at http://localhost:8080
64
65
66Deploying to golang.org
67-----------------------
68
69Make sure you're signed in to gcloud:
70
71 gcloud auth login
72
73Build the image, push it to gcr.io, and deploy to Flex:
74
75 make cloud-build deploy
76
77Point the load balancer to the newly deployed version:
78(This also runs regression tests)
79
80 make publish
81
82Stop and/or delete down any very old versions. (Stopped versions can be re-started.)
83Keep at least one older verson to roll back to, just in case.
84You can also migrate traffic to the new version via this UI.
85
86 https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=default&versionssize=50
87
88
89Troubleshooting
90---------------
91
92Ensure the Cloud SDK is on your PATH and you have the app-engine-go component
93installed (gcloud components install app-engine-go) and your components are
94up-to-date (gcloud components update)
95