cmd/godoc: add `make publish` to migrate traffic

Also rename `make build` and `make push` to `make docker-build` and
`make docker-push` in preparation to introduce Cloud Build (removing
the dependency on Docker).

Updates golang/go#27205.

Change-Id: Iae19b9a6f77d09246a1332c7ec9eceec449cdba8
Reviewed-on: https://go-review.googlesource.com/c/139239
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Chris Broadfoot 2018-10-02 22:21:05 -07:00
Родитель 140737fa61
Коммит a3d532c85d
2 изменённых файлов: 33 добавлений и 13 удалений

Просмотреть файл

@ -19,7 +19,7 @@ usage:
@echo "See Makefile and README.godoc-app"
@exit 1
docker: Dockerfile.prod
docker-build: Dockerfile.prod
# NOTE(cbro): move up in directory to include entire tools repo.
cd ../..; docker build \
-f cmd/godoc/Dockerfile.prod \
@ -30,24 +30,42 @@ docker: Dockerfile.prod
--tag=$(DOCKER_TAG) \
.
push: docker
docker-push: docker-build
docker push $(DOCKER_TAG)
deploy: push
deploy:
gcloud -q app deploy app.prod.yaml \
--project $(GCP_PROJECT) \
--project=$(GCP_PROJECT) \
--no-promote \
--image-url $(DOCKER_TAG)
--image-url=$(DOCKER_TAG)
get-latest-url:
@gcloud app versions list \
-s default \
--project $(GCP_PROJECT) \
--service=default \
--project=$(GCP_PROJECT) \
--sort-by=~version.createTime \
--format='value(version.versionUrl)' \
--limit 1 | cut -f1 # NOTE(cbro): gcloud prints out createTime as the second field.
get-latest-id:
@gcloud app versions list \
--service=default \
--project=$(GCP_PROJECT) \
--sort-by=~version.createTime \
--format='value(version.id)' \
--limit 1 | cut -f1 # NOTE(cbro): gcloud prints out createTime as the second field.
regtest:
go test -v \
-regtest.host=$(shell make get-latest-url) \
-run=Live
publish: regtest
gcloud -q app services set-traffic default \
--splits=$(shell make get-latest-id)=1 \
--project=$(GCP_PROJECT)
@echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@echo Stop and/or delete old versions:
@echo "https://console.cloud.google.com/appengine/versions?project=$(GCP_PROJECT)&serviceId=default&versionssize=50"
@echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Просмотреть файл

@ -37,7 +37,7 @@ Running locally, in production mode, using Docker
Build the app's Docker container:
make docker
make docker-build
Make sure redis is running on port 6379:
@ -68,17 +68,19 @@ Deploying to golang.org
Build the image, push it to gcr.io, and deploy to Flex:
make deploy
make docker-push deploy
Run regression tests:
Point the load balancer to the newly deployed version:
(This also runs regression tests)
make regtest
make publish
Go to the console to migrate traffic to the newly deployed version:
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
Shut down any very old versions (keep at least one to roll back to, just in case).
Troubleshooting
---------------