2014-12-17 23:00:26 +03:00
|
|
|
# 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
|
|
|
|
docker build -t 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
|
2018-04-11 08:01:01 +03:00
|
|
|
docker run --name=play --rm -d -p 8080:8080 playground
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
For details, see [deploy/go_trigger.json](deploy/go_trigger.json),
|
|
|
|
[deploy/playground_trigger.json](deploy/playground_trigger.json),
|
|
|
|
and [deploy/deploy.json](deploy/deploy.json).
|
|
|
|
|
|
|
|
After making changes to trigger configuration, update configuration by running the following Make target:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
make update-cloudbuild-trigger
|
|
|
|
```
|
|
|
|
|
|
|
|
### 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
|
|
|
|
docker tag playground:latest gcr.io/golang-org/playground:latest
|
|
|
|
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.
|