For local development, simply build and run. It serves on localhost:6060.
go run .
To run in production mode locally, you need:
go get -d golang.org/x/website/cmd/golangorg
)Build with the golangorg
tag and run:
go build -tags golangorg ./golangorg
In production mode it serves on localhost:8080 (not 6060). The port is controlled by $PORT, as in:
PORT=8081 ./golangorg
To run in production mode locally 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
It serves on localhost:8080.
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
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
)