2014-12-17 23:00:26 +03:00
|
|
|
# playground
|
|
|
|
|
2020-12-04 02:20:49 +03:00
|
|
|
[![Go Reference](https://pkg.go.dev/badge/golang.org/x/playground.svg)](https://pkg.go.dev/golang.org/x/playground)
|
|
|
|
|
2017-12-24 02:02:41 +03:00
|
|
|
This subrepository holds the source for the Go playground:
|
|
|
|
https://play.golang.org/
|
2014-12-17 23:00:26 +03:00
|
|
|
|
2017-12-24 02:02:41 +03:00
|
|
|
## Building
|
2017-12-19 20:43:27 +03:00
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
```bash
|
2017-12-24 02:02:41 +03:00
|
|
|
# build the image
|
2020-07-21 18:04:16 +03:00
|
|
|
docker build -t golang/playground .
|
2017-12-20 03:30:25 +03:00
|
|
|
```
|
|
|
|
|
2017-12-24 02:02:41 +03:00
|
|
|
## Running
|
2014-12-17 23:00:26 +03:00
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
```bash
|
2019-09-10 23:54:26 +03:00
|
|
|
docker run --name=play --rm -p 8080:8080 golang/playground &
|
2018-04-11 08:01:01 +03:00
|
|
|
# run some Go code
|
|
|
|
cat /path/to/code.go | go run client.go | curl -s --upload-file - localhost:8080/compile
|
2014-12-17 23:00:26 +03:00
|
|
|
```
|
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
## Deployment
|
2015-01-14 03:39:11 +03:00
|
|
|
|
2019-07-09 23:30:07 +03:00
|
|
|
### Deployment Triggers
|
|
|
|
|
|
|
|
Playground releases automatically triggered when new Go repository tags are pushed to GitHub, or when master is pushed
|
|
|
|
on the playground repository.
|
|
|
|
|
2021-06-11 23:28:15 +03:00
|
|
|
For details, see [deploy/go_trigger.yaml](deploy/go_trigger.yaml),
|
|
|
|
[deploy/playground_trigger.yaml](deploy/playground_trigger.yaml),
|
2019-07-09 23:30:07 +03:00
|
|
|
and [deploy/deploy.json](deploy/deploy.json).
|
|
|
|
|
2021-06-11 23:28:15 +03:00
|
|
|
Changes to the trigger configuration can be made to the YAML files, or in the GCP UI, which should be kept in sync
|
|
|
|
using the `push-cloudbuild-trigger` and `pull-cloudbuild-trigger` make targets.
|
2019-07-09 23:30:07 +03:00
|
|
|
|
|
|
|
### Deploy via Cloud Build
|
|
|
|
|
|
|
|
The Cloud Build configuration will always build and deploy with the latest supported release of Go.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
gcloud builds submit --config deploy/deploy.json .
|
|
|
|
```
|
|
|
|
|
|
|
|
### Deploy via gcloud app deploy
|
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
Building the playground Docker container takes more than the default 10 minute time limit of cloud build, so increase
|
|
|
|
its timeout first (note, `app/cloud_build_timeout` is a global configuration value):
|
2019-02-28 21:47:27 +03:00
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
```bash
|
2019-02-28 21:47:27 +03:00
|
|
|
gcloud config set app/cloud_build_timeout 1200 # 20 mins
|
|
|
|
```
|
|
|
|
|
2019-05-10 21:19:28 +03:00
|
|
|
Alternatively, to avoid Cloud Build and build locally:
|
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
```bash
|
2019-05-10 21:19:28 +03:00
|
|
|
make docker
|
2019-05-16 17:50:04 +03:00
|
|
|
docker tag golang/playground:latest gcr.io/golang-org/playground:latest
|
2019-05-10 21:19:28 +03:00
|
|
|
docker push gcr.io/golang-org/playground:latest
|
|
|
|
gcloud --project=golang-org --account=you@google.com app deploy app.yaml --image-url=gcr.io/golang-org/playground:latest
|
|
|
|
```
|
|
|
|
|
2019-02-28 21:47:27 +03:00
|
|
|
Then:
|
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
```bash
|
2019-05-10 21:19:28 +03:00
|
|
|
gcloud --project=golang-org --account=you@google.com app deploy app.yaml
|
2017-12-21 01:35:14 +03:00
|
|
|
```
|
2015-01-14 03:39:11 +03:00
|
|
|
|
2019-06-19 19:54:59 +03:00
|
|
|
## Contributing
|
2015-01-14 03:39:11 +03:00
|
|
|
|
2018-04-11 08:01:01 +03:00
|
|
|
To submit changes to this repository, see
|
|
|
|
https://golang.org/doc/contribute.html.
|