tree: c33f9499482ca23e075b64c647b54111f51981be [path history] [tgz]
  1. app.dev.yaml
  2. app.prod.yaml
  3. cloudbuild.yaml
  4. codewalk.go
  5. doc.go
  6. Dockerfile.prod
  7. go115.go
  8. godoc.go
  9. godoc_test.go
  10. handlers.go
  11. hg-git-mapping.bin
  12. local.go
  13. main.go
  14. Makefile
  15. prod.go
  16. project.go
  17. README.md
  18. regtest_test.go
  19. release.go
  20. release_test.go
  21. x.go
  22. x_test.go
cmd/golangorg/README.md

golangorg

Local Development

For local development, simply build and run. It serves on localhost:6060.

go run .

Local Production Mode

To run in production mode locally, you need:

Run with the prod tag:

go run -tags prod .

In production mode it serves on localhost:8080 (not 6060). The port is controlled by $PORT, as in:

PORT=8081 ./golangorg

Local Production Mode using Docker

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.

Deploying to golang.org

  1. Run make cloud-build deploy to build the image, push it to gcr.io, and deploy to Flex (but not yet update golang.org to point to it).

  2. Check that the new version, mentioned on “target url:” line, looks OK.

  3. If all is well, run make publish to publish the new version to golang.org. It will run regression tests and then point the load balancer to the newly deployed version.

  4. Stop and/or delete 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 view, stop/delete, or migrate traffic between versions via the GCP Console UI.

  5. You're done.

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

For deployment, make sure you're signed in to gcloud:

gcloud auth login