sourcegraph/dev/tilt
Thorsten Ball 6eb8cffc5f
Remove left-over mentions of dev/start.sh (#25745)
* Remove left-over mentions of `dev/start.sh`

* Fix instructions in README
2021-10-07 16:38:00 +02:00
..
Caddyfile dev: quick notes on how to use tilt and minikube (#10407) 2020-05-08 16:41:59 -07:00
README.md Remove left-over mentions of dev/start.sh (#25745) 2021-10-07 16:38:00 +02:00
Tiltfile dev: quick notes on how to use tilt and minikube (#10407) 2020-05-08 16:41:59 -07:00

Local development environment with tilt.dev and minikube

This is still a work in progress. tilt is useful when you have to develop k8s code and need a local cluster for your edit/compile/test cycle. tilt can also be used with bare processes but we haven't converted and optimized our build pipeline to it. The tilt team have given us a starting point (thanks!). For now, (until we convert, test and optimize this approach) please still use sg start.

(Instructions assume you are in this directory)

  • Install tilt

  • Install minikube

  • Generate manifests from the minikube overlay and copy the generated-cluster directory into this directory.

  • mkdir tilt-watch-targets

  • Prepare the cluster:

    minikube start
    kubectl create namespace ns-sourcegraph
    kubectl -n ns-sourcegraph apply --prune -l deploy=sourcegraph -f generated-cluster --recursive
    kubectl -n ns-sourcegraph expose deployment sourcegraph-frontend --type=NodePort --name sourcegraph --port=3080 --target-port=3080
    minikube service list
    
  • From the minikube service list output take the exposed port and modify the Caddyfile.

  • caddy run (this makes Sourcegraph from the minikube cluster available at https://sourcegraph.test:3443)

  • tilt up (starts tilt)

Tilt will start an initial build of the frontend and deploy it. Whenever you are done editing and want to trigger another build, touch tilt-watch-targets/frontend.

Similar to the frontend you can add other custom_build statements to your Tiltfile to build and watch the other servers.

There are many Tiltfile modifications that can help accelerate the edit/build/deploy cycle: https://docs.tilt.dev/example_go.html