cmd/golangorg: update README
Make the README cover local non-production mode too, update file name to match, and convert to markdown. Change-Id: I7e3c86bf4ae2a3aeaed2dd2e3134747a275a006b Reviewed-on: https://go-review.googlesource.com/c/website/+/207438 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
Родитель
99763cba2e
Коммит
c0a416a8e8
|
@ -1,94 +0,0 @@
|
|||
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/website/cmd/golangorg)
|
||||
|
||||
|
||||
Running locally, in production mode
|
||||
-----------------------------------
|
||||
|
||||
Build the app:
|
||||
|
||||
go build -tags golangorg
|
||||
|
||||
Run the app:
|
||||
|
||||
./golangorg
|
||||
|
||||
godoc should come up at http://localhost:8080
|
||||
|
||||
Use the PORT environment variable to change the port:
|
||||
|
||||
PORT=8081 ./golangorg
|
||||
|
||||
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)
|
|
@ -0,0 +1,83 @@
|
|||
# Running 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:
|
||||
|
||||
* the Google Cloud SDK; see https://cloud.google.com/sdk/
|
||||
* Redis
|
||||
* Go sources under $GOROOT
|
||||
* Godoc sources inside $GOPATH
|
||||
(`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
|
||||
|
||||
## 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
|
||||
|
||||
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`)
|
|
@ -28,7 +28,7 @@ present in the final binary. They are embedded into `static/static.go` by runnin
|
|||
1) Make changes to an existing file such as `static/style.css`.
|
||||
|
||||
2) If a new file is being added to the `static` directory, add it to the `files`
|
||||
slice in `static/gen`.
|
||||
slice in `static/gen.go`.
|
||||
|
||||
3) Run `go generate golang.org/x/website/content/static` so `static/static.go` is
|
||||
up to date.
|
||||
|
|
Загрузка…
Ссылка в новой задаче