debugger - Clean up documentation and add easier Make targets.

Bug: skia:
Change-Id: Ib834c7f4797ed851d4e937c1bf00368112075605
Reviewed-on: https://skia-review.googlesource.com/c/178540
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
diff --git a/debugger-assets/README.md b/debugger-assets/README.md
index acd59c7..8f0f13e 100644
--- a/debugger-assets/README.md
+++ b/debugger-assets/README.md
@@ -6,20 +6,23 @@
 Running
 =======
 
+The debugger-assets application serves up the HTML/CSS/JS that makes up
+the debugger web UI. This is the place to make changes in the front-end
+functionality of the debugger.
+
 To run the server locally make sure you have Go installed and then run:
 
 ~~~~bash
-go get go.skia.org/infra/debugger/...
-cd $GOPATH/src/go.skia.org/infra/debugger
-make run_server_local
+    make run_server_local
 ~~~~
 
 Make sure you have `$GOPATH/bin` added to your `PATH`.
 
 This will spin up a local asset server on port 9000.
 
-Make sure when you run the command-line debugger that it runs looking for
-http://localhost:9000 and not https://debugger-assets.skia.org. I.e
+At the same time you need a copy of `skiaserver` running that does the actual
+debugging work. You can build this as part of building the Skia library. Make
+sure when you run the command-line debugger that it runs looking for
+http://localhost:9000 and not https://debugger-assets.skia.org. I.e:
 
     ./out/Release/skiaserve --source http://localhost:9000
-
diff --git a/debugger/Makefile b/debugger/Makefile
index c069a9b..9e364bf 100644
--- a/debugger/Makefile
+++ b/debugger/Makefile
@@ -31,7 +31,11 @@
 
 .PHONY: run
 run:
-	 docker run -p8000:8000 -ti debugger
+	docker run -p8000:8000 -ti debugger
+
+.PHONY: run_with_local_assets
+run_with_local_assets:
+	docker run -p8000:8000 -ti debugger --source=http://localhost:9000 --logtostderr --resources_dir=/usr/local/share/debugger
 
 .PHONY: tag_skiaserve
 tag_skiaserve:
diff --git a/debugger/README.md b/debugger/README.md
index 72eab05..4858f94 100644
--- a/debugger/README.md
+++ b/debugger/README.md
@@ -9,24 +9,17 @@
 
 See `DESIGN.md` for more details.
 
-
 Running
 =======
 
 To run the server locally make sure you have Go installed and then run:
 
 ~~~~bash
-go get go.skia.org/infra/debugger/...
-cd $GOPATH/src/go.skia.org/infra/debugger
-make run_server_local
+    $ docker pull gcr.io/skia-public/skia-release:prod
+    $ make release_ci
+    $ make run_with_local_assets
 ~~~~
 
-Make sure you have `$GOPATH/bin` added to your `PATH`.
-
-This will spin up a local server on port 9000.
-
-Make sure when you run the command-line debugger that it runs looking for
-http://localhost:9000 and not https://debugger.skia.org. I.e
-
-    ./out/Release/skiaserve --source http://localhost:9000
-
+This builds the same docker image that runs in prod, including a copy of
+skiaserve built against SwiftShader, so that GPU will work w/o needing
+a physical GPU.
diff --git a/debugger/go/debugger/main.go b/debugger/go/debugger/main.go
index 67b475f..811b432 100644
--- a/debugger/go/debugger/main.go
+++ b/debugger/go/debugger/main.go
@@ -16,9 +16,7 @@
 	"github.com/fiorix/go-web/autogzip"
 	"github.com/gorilla/mux"
 	"go.skia.org/infra/debugger/go/instances"
-	"go.skia.org/infra/go/buildskia"
 	"go.skia.org/infra/go/common"
-	"go.skia.org/infra/go/git/gitinfo"
 	"go.skia.org/infra/go/httputils"
 	"go.skia.org/infra/go/sklog"
 	"go.skia.org/infra/go/util"
@@ -30,18 +28,13 @@
 	port         = flag.String("port", ":8000", "HTTP service address (e.g., ':8000')")
 	promPort     = flag.String("prom_port", ":20000", "Metrics service address (e.g., ':10110')")
 	resourcesDir = flag.String("resources_dir", "", "The directory to find templates, JS, and CSS files. If blank the current directory will be used.")
+	source       = flag.String("source", "https://debugger-assets.skia.org", "Where to load assets from.")
 	versionFile  = flag.String("version_file", "/etc/skia-prod/VERSION", "The full path of the Skia VERSION file.")
 )
 
 var (
 	templates *template.Template
 
-	// repo is the Skia checkout.
-	repo *gitinfo.GitInfo
-
-	// build is responsible to building the LKGR of skiaserve periodically.
-	build *buildskia.ContinuousBuilder
-
 	// co handles proxying requests to skiaserve instances which is spins up and down.
 	co *instances.Instances
 
@@ -190,7 +183,7 @@
 		common.PrometheusOpt(promPort),
 		common.MetricsLoggingOpt(),
 	)
-	co = instances.New()
+	co = instances.New(*source)
 
 	Init()
 
diff --git a/debugger/go/instances/instances.go b/debugger/go/instances/instances.go
index a5ad2fd..989eaab 100644
--- a/debugger/go/instances/instances.go
+++ b/debugger/go/instances/instances.go
@@ -66,6 +66,9 @@
 	// proxy is the proxy connection to talk to the running skiaserve.
 	proxy *httputil.ReverseProxy
 
+	// source is the schema and domain from where to load assets, e.g. "https://debugger.skia.org".
+	source string
+
 	// port is the port that skiaserve is listening on.
 	port int
 
@@ -90,7 +93,7 @@
 func (c *instance) Start(uuid string) (<-chan error, error) {
 	runCmd := &exec.Command{
 		Name:      "xvfb-run",
-		Args:      []string{"--server-args", "-screen 0 1280x1024x24", "--server-num", fmt.Sprintf("%d", c.port), SKIASERVE, "--port", fmt.Sprintf("%d", c.port), "--source", "https://debugger-assets.skia.org", "--hosted"},
+		Args:      []string{"--server-args", "-screen 0 1280x1024x24", "--server-num", fmt.Sprintf("%d", c.port), SKIASERVE, "--port", fmt.Sprintf("%d", c.port), "--source", c.source, "--hosted"},
 		Env:       []string{fmt.Sprintf("DISPLAY=:%d", c.display)},
 		LogStdout: true,
 	}
@@ -142,7 +145,7 @@
 	mutex sync.Mutex
 }
 
-func New() *Instances {
+func New(source string) *Instances {
 	s := &Instances{
 		pool:      []*instance{},
 		instances: map[string]*instance{},
@@ -158,6 +161,7 @@
 			port:    port,
 			display: i + 100,
 			proxy:   httputil.NewSingleHostReverseProxy(u),
+			source:  source,
 		}
 		s.pool = append(s.pool, c)
 	}